From 229188b815beb4fe6c8d947b73840b841a7c976b Mon Sep 17 00:00:00 2001 From: Lenny Maiorani Date: Wed, 26 Jan 2022 20:46:26 -0700 Subject: [PATCH] LibGL: Set rasterizer material state without copying Each of the material faces is copied member by member then the copied material state is passed by `const&` to another function, then destroyed. This is changed to simply passing the material state directly without copying. --- Userland/Libraries/LibGL/SoftwareGLContext.cpp | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/Userland/Libraries/LibGL/SoftwareGLContext.cpp b/Userland/Libraries/LibGL/SoftwareGLContext.cpp index 1c531a73a9..565d66ac0e 100644 --- a/Userland/Libraries/LibGL/SoftwareGLContext.cpp +++ b/Userland/Libraries/LibGL/SoftwareGLContext.cpp @@ -3158,22 +3158,8 @@ void SoftwareGLContext::sync_light_state() m_rasterizer.set_light_state(light_id, current_light_state); } - auto update_material_state = [&](SoftGPU::Face face, SoftGPU::Material const& current_material_state) { - SoftGPU::Material material; - - material.ambient = current_material_state.ambient; - material.diffuse = current_material_state.diffuse; - material.specular = current_material_state.specular; - material.emissive = current_material_state.emissive; - material.shininess = current_material_state.shininess; - material.ambient_color_index = current_material_state.ambient_color_index; - material.diffuse_color_index = current_material_state.diffuse_color_index; - material.specular_color_index = current_material_state.specular_color_index; - - m_rasterizer.set_material_state(face, material); - }; - update_material_state(SoftGPU::Face::Front, m_material_states[Face::Front]); - update_material_state(SoftGPU::Face::Back, m_material_states[Face::Back]); + m_rasterizer.set_material_state(SoftGPU::Face::Front, m_material_states[Face::Front]); + m_rasterizer.set_material_state(SoftGPU::Face::Back, m_material_states[Face::Back]); } void SoftwareGLContext::sync_device_texcoord_config()