mirror of
https://github.com/godotengine/godot
synced 2024-10-04 17:04:20 +00:00
Ensure that environment is available before checking for BCS
This commit is contained in:
parent
b9e022302a
commit
8eae822b54
|
@ -2706,27 +2706,32 @@ void RasterizerSceneGLES3::_render_post_processing(const RenderDataGLES3 *p_rend
|
||||||
rb->check_glow_buffers();
|
rb->check_glow_buffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool use_bcs = environment_get_adjustments_enabled(p_render_data->environment);
|
|
||||||
uint64_t bcs_spec_constants = 0;
|
uint64_t bcs_spec_constants = 0;
|
||||||
RID color_correction_texture = environment_get_color_correction(p_render_data->environment);
|
if (p_render_data->environment.is_valid()) {
|
||||||
if (use_bcs && color_correction_texture.is_valid()) {
|
bool use_bcs = environment_get_adjustments_enabled(p_render_data->environment);
|
||||||
bcs_spec_constants |= PostShaderGLES3::USE_BCS;
|
RID color_correction_texture = environment_get_color_correction(p_render_data->environment);
|
||||||
bcs_spec_constants |= PostShaderGLES3::USE_COLOR_CORRECTION;
|
if (use_bcs) {
|
||||||
|
bcs_spec_constants |= PostShaderGLES3::USE_BCS;
|
||||||
|
|
||||||
bool use_1d_lut = environment_get_use_1d_color_correction(p_render_data->environment);
|
if (color_correction_texture.is_valid()) {
|
||||||
GLenum texture_target = GL_TEXTURE_3D;
|
bcs_spec_constants |= PostShaderGLES3::USE_COLOR_CORRECTION;
|
||||||
if (use_1d_lut) {
|
|
||||||
bcs_spec_constants |= PostShaderGLES3::USE_1D_LUT;
|
bool use_1d_lut = environment_get_use_1d_color_correction(p_render_data->environment);
|
||||||
texture_target = GL_TEXTURE_2D;
|
GLenum texture_target = GL_TEXTURE_3D;
|
||||||
|
if (use_1d_lut) {
|
||||||
|
bcs_spec_constants |= PostShaderGLES3::USE_1D_LUT;
|
||||||
|
texture_target = GL_TEXTURE_2D;
|
||||||
|
}
|
||||||
|
|
||||||
|
glActiveTexture(GL_TEXTURE2);
|
||||||
|
glBindTexture(texture_target, texture_storage->texture_get_texid(color_correction_texture));
|
||||||
|
glTexParameteri(texture_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
|
glTexParameteri(texture_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
|
glTexParameteri(texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||||
|
glTexParameteri(texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||||
|
glTexParameteri(texture_target, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE2);
|
|
||||||
glBindTexture(texture_target, texture_storage->texture_get_texid(color_correction_texture));
|
|
||||||
glTexParameteri(texture_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
|
||||||
glTexParameteri(texture_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
|
||||||
glTexParameteri(texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
|
||||||
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) {
|
if (view_count == 1) {
|
||||||
|
|
Loading…
Reference in a new issue