1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 17:47:36 +00:00

LibGL+LibSoftGPU: Use device samplers for rendering

We now sample textures from the device owned image samplers.
Passing of enabled texture units has been simplified by only passing a
list of texture unit indices.
This commit is contained in:
Stephan Unverwerth 2021-12-22 22:14:18 +01:00 committed by Brian Gianforcaro
parent f69de5e850
commit d8c17c8838
5 changed files with 19 additions and 30 deletions

View file

@ -224,14 +224,14 @@ void SoftwareGLContext::gl_end()
RETURN_WITH_ERROR_IF(true, GL_INVALID_ENUM);
}
m_bound_texture_units.clear();
for (auto& texture_unit : m_texture_units) {
if (texture_unit.is_bound())
m_bound_texture_units.append(texture_unit);
Vector<size_t, 32> enabled_texture_units;
for (size_t i = 0; i < m_texture_units.size(); ++i) {
if (m_texture_units[i].texture_2d_enabled())
enabled_texture_units.append(i);
}
sync_device_config();
m_rasterizer.draw_primitives(m_current_draw_mode, m_projection_matrix * m_model_view_matrix, m_texture_matrix, m_vertex_list, m_bound_texture_units);
m_rasterizer.draw_primitives(m_current_draw_mode, m_projection_matrix * m_model_view_matrix, m_texture_matrix, m_vertex_list, enabled_texture_units);
m_vertex_list.clear_with_capacity();
}

View file

@ -235,7 +235,6 @@ private:
HashMap<GLuint, RefPtr<Texture>> m_allocated_textures;
Array<TextureUnit, 32> m_texture_units;
TextureUnit* m_active_texture_unit { &m_texture_units[0] };
TextureUnit::BoundList m_bound_texture_units;
SoftGPU::Device m_rasterizer;
bool m_sampler_config_is_dirty { true };

View file

@ -36,9 +36,6 @@ 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 };