1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:17:35 +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

@ -28,6 +28,9 @@ public:
unsigned level_depth(unsigned level) const { return m_mipmap_sizes[level].z(); }
unsigned num_levels() const { return m_num_levels; }
unsigned num_layers() const { return m_num_layers; }
bool width_is_power_of_two() const { return m_width_is_power_of_two; }
bool height_is_power_of_two() const { return m_height_is_power_of_two; }
bool depth_is_power_of_two() const { return m_depth_is_power_of_two; }
FloatVector4 texel(unsigned layer, unsigned level, unsigned x, unsigned y, unsigned z) const
{
@ -68,6 +71,9 @@ private:
Vector<size_t, 16> m_mipmap_offsets;
Vector<Vector3<unsigned>, 16> m_mipmap_sizes;
Vector<u8> m_data;
bool m_width_is_power_of_two { false };
bool m_height_is_power_of_two { false };
bool m_depth_is_power_of_two { false };
};
}