@@ -2706,27 +2706,32 @@ void RasterizerSceneGLES3::_render_post_processing(const RenderDataGLES3 *p_rend
27062706 rb->check_glow_buffers ();
27072707 }
27082708
2709- bool use_bcs = environment_get_adjustments_enabled (p_render_data->environment );
27102709 uint64_t bcs_spec_constants = 0 ;
2711- RID color_correction_texture = environment_get_color_correction (p_render_data->environment );
2712- if (use_bcs && color_correction_texture.is_valid ()) {
2713- bcs_spec_constants |= PostShaderGLES3::USE_BCS;
2714- bcs_spec_constants |= PostShaderGLES3::USE_COLOR_CORRECTION;
2715-
2716- bool use_1d_lut = environment_get_use_1d_color_correction (p_render_data->environment );
2717- GLenum texture_target = GL_TEXTURE_3D;
2718- if (use_1d_lut) {
2719- bcs_spec_constants |= PostShaderGLES3::USE_1D_LUT;
2720- texture_target = GL_TEXTURE_2D;
2721- }
2710+ if (p_render_data->environment .is_valid ()) {
2711+ bool use_bcs = environment_get_adjustments_enabled (p_render_data->environment );
2712+ RID color_correction_texture = environment_get_color_correction (p_render_data->environment );
2713+ if (use_bcs) {
2714+ bcs_spec_constants |= PostShaderGLES3::USE_BCS;
2715+
2716+ if (color_correction_texture.is_valid ()) {
2717+ bcs_spec_constants |= PostShaderGLES3::USE_COLOR_CORRECTION;
27222718
2723- glActiveTexture (GL_TEXTURE2);
2724- glBindTexture (texture_target, texture_storage->texture_get_texid (color_correction_texture));
2725- glTexParameteri (texture_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
2726- glTexParameteri (texture_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
2727- glTexParameteri (texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
2728- glTexParameteri (texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
2729- glTexParameteri (texture_target, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
2719+ bool use_1d_lut = environment_get_use_1d_color_correction (p_render_data->environment );
2720+ GLenum texture_target = GL_TEXTURE_3D;
2721+ if (use_1d_lut) {
2722+ bcs_spec_constants |= PostShaderGLES3::USE_1D_LUT;
2723+ texture_target = GL_TEXTURE_2D;
2724+ }
2725+
2726+ glActiveTexture (GL_TEXTURE2);
2727+ glBindTexture (texture_target, texture_storage->texture_get_texid (color_correction_texture));
2728+ glTexParameteri (texture_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
2729+ glTexParameteri (texture_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
2730+ glTexParameteri (texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
2731+ glTexParameteri (texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
2732+ glTexParameteri (texture_target, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
2733+ }
2734+ }
27302735 }
27312736
27322737 if (view_count == 1 ) {
0 commit comments