mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:47: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:
parent
f201567153
commit
4e3ed16527
5 changed files with 16 additions and 10 deletions
|
@ -328,6 +328,12 @@ void SoftwareGLContext::gl_end()
|
|||
}
|
||||
}
|
||||
|
||||
m_bound_texture_units.clear();
|
||||
for (auto& texture_unit : m_texture_units) {
|
||||
if (texture_unit.is_bound())
|
||||
m_bound_texture_units.append(texture_unit);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < processed_triangles.size(); i++) {
|
||||
GLTriangle& triangle = processed_triangles.at(i);
|
||||
|
||||
|
@ -356,7 +362,7 @@ void SoftwareGLContext::gl_end()
|
|||
swap(triangle.vertices[0], triangle.vertices[1]);
|
||||
}
|
||||
|
||||
m_rasterizer.submit_triangle(triangle, m_texture_units);
|
||||
m_rasterizer.submit_triangle(triangle, m_bound_texture_units);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue