Merge pull request #68173 from clayjohn/GLES3-panorama

Bind DirectionalLight buffer to uniform slot even when not used
This commit is contained in:
Rémi Verschelde 2022-11-02 22:36:25 +01:00
commit b509d16652
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -595,6 +595,7 @@ void RasterizerSceneGLES3::_setup_sky(const RenderDataGLES3 *p_render_data, cons
sky->reflection_dirty = true; sky->reflection_dirty = true;
} }
glBindBufferBase(GL_UNIFORM_BUFFER, SKY_DIRECTIONAL_LIGHT_UNIFORM_LOCATION, sky_globals.directional_light_buffer);
if (shader_data->uses_light) { if (shader_data->uses_light) {
sky_globals.directional_light_count = 0; sky_globals.directional_light_count = 0;
for (int i = 0; i < (int)p_lights.size(); i++) { for (int i = 0; i < (int)p_lights.size(); i++) {
@ -678,7 +679,6 @@ void RasterizerSceneGLES3::_setup_sky(const RenderDataGLES3 *p_render_data, cons
} }
if (light_data_dirty) { if (light_data_dirty) {
glBindBufferBase(GL_UNIFORM_BUFFER, SKY_DIRECTIONAL_LIGHT_UNIFORM_LOCATION, sky_globals.directional_light_buffer);
glBufferData(GL_UNIFORM_BUFFER, sizeof(DirectionalLightData) * sky_globals.max_directional_lights, sky_globals.directional_lights, GL_STREAM_DRAW); glBufferData(GL_UNIFORM_BUFFER, sizeof(DirectionalLightData) * sky_globals.max_directional_lights, sky_globals.directional_lights, GL_STREAM_DRAW);
glBindBuffer(GL_UNIFORM_BUFFER, 0); glBindBuffer(GL_UNIFORM_BUFFER, 0);