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

LibSoftGPU: Return a const& texel in Image to prevent copying

On every texel access, some floating point instructions involved in
copying 4 floats popped up. Let `Image::texel() const` return a
`FloatVector4 const&` to prevent these operations.

This results in a ~7% FPS increase in GLQuake on my machine.
This commit is contained in:
Jelle Raaijmakers 2022-09-14 16:19:39 +02:00 committed by Andreas Kling
parent e9d2f9a95e
commit 8ff7c52cf4
3 changed files with 10 additions and 10 deletions

View file

@ -129,7 +129,7 @@ void Image::copy_texels(GPU::Image const& source, u32 source_level, Vector3<u32>
for (u32 z = 0; z < size.z(); ++z) {
for (u32 y = 0; y < size.y(); ++y) {
for (u32 x = 0; x < size.x(); ++x) {
auto color = src_image.texel(source_level, source_offset.x() + x, source_offset.y() + y, source_offset.z() + z);
auto const& color = src_image.texel(source_level, source_offset.x() + x, source_offset.y() + y, source_offset.z() + z);
set_texel(destination_level, destination_offset.x() + x, destination_offset.y() + y, destination_offset.z() + z, color);
}
}