Viewport: Use column-aligned block data type for dirty block tracking

Use bit operations to reduce looping over individual bits where possible
This commit is contained in:
Jonathan G Rennison
2024-06-19 19:47:03 +01:00
parent 8d11ec1eaa
commit e2dc3a9ac4
5 changed files with 115 additions and 48 deletions

View File

@@ -3514,7 +3514,7 @@ DEF_CONSOLE_CMD(ConViewportMarkDirty)
uint b = std::min<uint>(t + ((argc > 4) ? strtoul(argv[4], nullptr, 0) : 1), vp->dirty_blocks_per_column);
for (uint x = l; x < r; x++) {
for (uint y = t; y < b; y++) {
vp->dirty_blocks[(x * vp->dirty_blocks_per_column) + y] = true;
SetBit(vp->dirty_blocks[(x * vp->dirty_blocks_column_pitch) + (y / VP_BLOCK_BITS)], y % VP_BLOCK_BITS);
}
}
vp->is_dirty = true;