1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 11:07:45 +00:00

LibSoftGPU: Use bitwise and instead of modulus operator for POT textures

Where possible the sampler will wrap texture coordinates using a bitwise
and instead of a modulus. This speeds up the calculation quite a bit.
This commit is contained in:
Stephan Unverwerth 2022-01-01 18:19:19 +01:00 committed by Ali Mohammad Pur
parent 034dc480d2
commit 6f261d0362
3 changed files with 46 additions and 6 deletions

View file

@ -21,6 +21,15 @@ Image::Image(ImageFormat format, unsigned width, unsigned height, unsigned depth
VERIFY(levels > 0);
VERIFY(layers > 0);
if ((width & (width - 1)) == 0)
m_width_is_power_of_two = true;
if ((height & (height - 1)) == 0)
m_height_is_power_of_two = true;
if ((depth & (depth - 1)) == 0)
m_depth_is_power_of_two = true;
m_mipmap_sizes.append({ width, height, depth });
m_mipmap_offsets.append(0);