Ensure that environment is available before checking for BCS

This commit is contained in:
clayjohn 2024-04-29 10:34:17 -07:00
parent b9e022302a
commit 8eae822b54

View file

@ -2706,11 +2706,14 @@ void RasterizerSceneGLES3::_render_post_processing(const RenderDataGLES3 *p_rend
rb->check_glow_buffers();
}
bool use_bcs = environment_get_adjustments_enabled(p_render_data->environment);
uint64_t bcs_spec_constants = 0;
if (p_render_data->environment.is_valid()) {
bool use_bcs = environment_get_adjustments_enabled(p_render_data->environment);
RID color_correction_texture = environment_get_color_correction(p_render_data->environment);
if (use_bcs && color_correction_texture.is_valid()) {
if (use_bcs) {
bcs_spec_constants |= PostShaderGLES3::USE_BCS;
if (color_correction_texture.is_valid()) {
bcs_spec_constants |= PostShaderGLES3::USE_COLOR_CORRECTION;
bool use_1d_lut = environment_get_use_1d_color_correction(p_render_data->environment);
@ -2728,6 +2731,8 @@ void RasterizerSceneGLES3::_render_post_processing(const RenderDataGLES3 *p_rend
glTexParameteri(texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(texture_target, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
}
}
}
if (view_count == 1) {
// Resolve if needed.