mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-29 19:10:26 +00:00
LibGL: Set rasterizer light state without copying
There is a loop over the lights in which each light state is copied member by member then the copied light state is passed by `const&` to another function, then destroyed. This is changed to simply passing the light state directly without copying.
This commit is contained in:
parent
cf92bc42a2
commit
354017e01d
Notes:
sideshowbarker
2024-07-17 20:09:01 +09:00
Author: https://github.com/ldm5180 Commit: https://github.com/SerenityOS/serenity/commit/354017e01d9 Pull-request: https://github.com/SerenityOS/serenity/pull/12154 Reviewed-by: https://github.com/gmta ✅
1 changed files with 1 additions and 15 deletions
|
@ -3154,22 +3154,8 @@ void SoftwareGLContext::sync_light_state()
|
|||
m_rasterizer.set_options(options);
|
||||
|
||||
for (auto light_id = 0u; light_id < SoftGPU::NUM_LIGHTS; light_id++) {
|
||||
SoftGPU::Light light;
|
||||
auto const& current_light_state = m_light_states.at(light_id);
|
||||
|
||||
light.is_enabled = current_light_state.is_enabled;
|
||||
light.ambient_intensity = current_light_state.ambient_intensity;
|
||||
light.diffuse_intensity = current_light_state.diffuse_intensity;
|
||||
light.specular_intensity = current_light_state.specular_intensity;
|
||||
light.position = current_light_state.position;
|
||||
light.spotlight_direction = current_light_state.spotlight_direction;
|
||||
light.spotlight_exponent = current_light_state.spotlight_exponent;
|
||||
light.spotlight_cutoff_angle = current_light_state.spotlight_cutoff_angle;
|
||||
light.constant_attenuation = current_light_state.constant_attenuation;
|
||||
light.linear_attenuation = current_light_state.linear_attenuation;
|
||||
light.quadratic_attenuation = current_light_state.quadratic_attenuation;
|
||||
|
||||
m_rasterizer.set_light_state(light_id, light);
|
||||
m_rasterizer.set_light_state(light_id, current_light_state);
|
||||
}
|
||||
|
||||
auto update_material_state = [&](SoftGPU::Face face, SoftGPU::Material const& current_material_state) {
|
||||
|
|
Loading…
Reference in a new issue