From 4492f6d193160883fa21a07d66c9e50ec75c09ef Mon Sep 17 00:00:00 2001 From: clayjohn Date: Tue, 30 Jul 2019 13:32:36 -0700 Subject: [PATCH] properly pass SCREEN_PIEXEL_SIZE to canvas light shader (cherry picked from commit 518f0fb1900b29c761c939559195ae10de610ec8) --- drivers/gles3/rasterizer_canvas_gles3.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index 648e6d52d53..9cd43c6da17 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -1586,6 +1586,11 @@ void RasterizerCanvasGLES3::canvas_render_items(Item *p_item_list, int p_z, cons state.canvas_shader.set_uniform(CanvasShaderGLES3::FINAL_MODULATE, state.canvas_item_modulate); state.canvas_shader.set_uniform(CanvasShaderGLES3::MODELVIEW_MATRIX, state.final_transform); state.canvas_shader.set_uniform(CanvasShaderGLES3::EXTRA_MATRIX, Transform2D()); + if (storage->frame.current_rt) { + state.canvas_shader.set_uniform(CanvasShaderGLES3::SCREEN_PIXEL_SIZE, Vector2(1.0 / storage->frame.current_rt->width, 1.0 / storage->frame.current_rt->height)); + } else { + state.canvas_shader.set_uniform(CanvasShaderGLES3::SCREEN_PIXEL_SIZE, Vector2(1.0, 1.0)); + } } glBindBufferBase(GL_UNIFORM_BUFFER, 1, static_cast(light->light_internal.get_data())->ubo);