mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:57:46 +00:00
LibGL+Lib*GPU: Set model view and projection matrices separately
LibSoftGPU used to calculate the normal transformation based on the model view transformation for every primitive, because that's when we sent over the matrix. By making LibGL a bit smarter and only update the matrices when they could have changed, we only need to calculate the normal transformation once on every matrix update. When viewing `Tuba.obj` in 3DFileViewer, this brings the percentage of time spent in `FloatMatrix4x4::inverse()` down from 15% to 0%. :^)
This commit is contained in:
parent
126adfc392
commit
edcb6176ce
8 changed files with 75 additions and 24 deletions
|
@ -242,12 +242,13 @@ public:
|
|||
void gl_get_program(GLuint program, GLenum pname, GLint* params);
|
||||
|
||||
private:
|
||||
void sync_clip_planes();
|
||||
void sync_device_config();
|
||||
void sync_device_sampler_config();
|
||||
void sync_device_texture_units();
|
||||
void sync_light_state();
|
||||
void sync_matrices();
|
||||
void sync_stencil_configuration();
|
||||
void sync_clip_planes();
|
||||
|
||||
ErrorOr<ByteBuffer> build_extension_string();
|
||||
|
||||
|
@ -298,10 +299,12 @@ private:
|
|||
Vector<FloatMatrix4x4> m_model_view_matrix_stack { FloatMatrix4x4::identity() };
|
||||
Vector<FloatMatrix4x4>* m_current_matrix_stack { &m_model_view_matrix_stack };
|
||||
FloatMatrix4x4* m_current_matrix { &m_current_matrix_stack->last() };
|
||||
bool m_matrices_dirty { true };
|
||||
|
||||
ALWAYS_INLINE void update_current_matrix(FloatMatrix4x4 const& new_matrix)
|
||||
{
|
||||
*m_current_matrix = new_matrix;
|
||||
m_matrices_dirty = true;
|
||||
|
||||
if (m_current_matrix_mode == GL_TEXTURE)
|
||||
m_texture_units_dirty = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue