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

LibGL: Only pass bound texture units to rasterizer

Before, `SoftwareRasterizer` was iterating over all 32 possible texture
units for each fragment and checking each if they're bound to a texture.

After this change, an intrusive list containing only texture units with
bound textures is passed to the rasterizer. In GLQuake, this results in
a performance improvement of ~30% (from 12 to 16 FPS in the first demo)
on my machine.
This commit is contained in:
Jelle Raaijmakers 2021-12-12 21:43:21 +01:00 committed by Brian Gianforcaro
parent f201567153
commit 4e3ed16527
5 changed files with 16 additions and 10 deletions

View file

@ -6,6 +6,7 @@
#pragma once
#include <AK/IntrusiveList.h>
#include <AK/OwnPtr.h>
#include <LibGL/Tex/Texture2D.h>
@ -35,6 +36,9 @@ public:
bool texture_cube_map_enabled() const { return m_texture_cube_map_enabled; };
void set_texture_cube_map_enabled(bool texture_cube_map_enabled) { m_texture_cube_map_enabled = texture_cube_map_enabled; }
IntrusiveListNode<TextureUnit> m_bound_node;
using BoundList = IntrusiveList<&TextureUnit::m_bound_node>;
private:
mutable RefPtr<Texture2D> m_texture_target_2d { nullptr };
mutable RefPtr<Texture> m_currently_bound_texture { nullptr };