Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incorrect enabling of post process in OpenGL #93530

Merged
merged 1 commit into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions drivers/gles3/rasterizer_scene_gles3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2247,7 +2247,6 @@ void RasterizerSceneGLES3::render_scene(const Ref<RenderSceneBuffers> &p_render_
bool glow_enabled = false;
if (p_environment.is_valid()) {
glow_enabled = environment_get_glow_enabled(p_environment);
rb->ensure_internal_buffers(); // Ensure our intermediate buffer is available if glow is enabled
if (glow_enabled) {
// If glow is enabled, we apply tonemapping etc. in post, so disable it during rendering
apply_color_adjustments_in_post = true;
Expand Down Expand Up @@ -2339,7 +2338,6 @@ void RasterizerSceneGLES3::render_scene(const Ref<RenderSceneBuffers> &p_render_
if (render_data.environment.is_valid()) {
bool use_bcs = environment_get_adjustments_enabled(render_data.environment);
if (use_bcs) {
rb->ensure_internal_buffers();
apply_color_adjustments_in_post = true;
}

Expand Down Expand Up @@ -2473,6 +2471,7 @@ void RasterizerSceneGLES3::render_scene(const Ref<RenderSceneBuffers> &p_render_
if (is_reflection_probe) {
fbo = GLES3::LightStorage::get_singleton()->reflection_probe_instance_get_framebuffer(render_data.reflection_probe, render_data.reflection_probe_pass);
} else {
rb->set_apply_color_adjustments_in_post(apply_color_adjustments_in_post);
fbo = rb->get_render_fbo();
}

Expand Down
6 changes: 3 additions & 3 deletions drivers/gles3/storage/render_scene_buffers_gles3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ void RenderSceneBuffersGLES3::_check_render_buffers() {

ERR_FAIL_COND(view_count == 0);

bool use_internal_buffer = scaling_3d_mode != RS::VIEWPORT_SCALING_3D_MODE_OFF || needs_internal_buffers;
bool use_internal_buffer = scaling_3d_mode != RS::VIEWPORT_SCALING_3D_MODE_OFF || apply_color_adjustments_in_post;
uint32_t depth_format_size = 3;
bool use_multiview = view_count > 1;

Expand Down Expand Up @@ -558,8 +558,8 @@ void RenderSceneBuffersGLES3::_clear_back_buffers() {
}
}

void RenderSceneBuffersGLES3::ensure_internal_buffers() {
needs_internal_buffers = true;
void RenderSceneBuffersGLES3::set_apply_color_adjustments_in_post(bool p_apply_in_post) {
apply_color_adjustments_in_post = p_apply_in_post;
}

void RenderSceneBuffersGLES3::check_glow_buffers() {
Expand Down
4 changes: 2 additions & 2 deletions drivers/gles3/storage/render_scene_buffers_gles3.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class RenderSceneBuffersGLES3 : public RenderSceneBuffers {
//bool use_taa = false;
//bool use_debanding = false;
uint32_t view_count = 1;
bool needs_internal_buffers = false;
bool apply_color_adjustments_in_post = false;

RID render_target;

Expand Down Expand Up @@ -106,12 +106,12 @@ class RenderSceneBuffersGLES3 : public RenderSceneBuffers {
virtual void set_fsr_sharpness(float p_fsr_sharpness) override{};
virtual void set_texture_mipmap_bias(float p_texture_mipmap_bias) override{};
virtual void set_use_debanding(bool p_use_debanding) override{};
void set_apply_color_adjustments_in_post(bool p_apply_in_post);

void free_render_buffer_data();

void check_backbuffer(bool p_need_color, bool p_need_depth); // Check if we need to initialize our backbuffer.
void check_glow_buffers(); // Check if we need to initialize our glow buffers.
void ensure_internal_buffers();

GLuint get_render_fbo();
GLuint get_msaa3d_fbo() {
Expand Down
Loading