From 081d016e6020e79a9bec90a8b2c0c5e6fdc9b9ea Mon Sep 17 00:00:00 2001 From: clayjohn Date: Sat, 3 Oct 2020 12:15:58 -0700 Subject: [PATCH] Use separate texture unit for light_texture --- drivers/gles2/rasterizer_canvas_gles2.cpp | 4 ++-- drivers/gles2/shaders/canvas.glsl | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gles2/rasterizer_canvas_gles2.cpp b/drivers/gles2/rasterizer_canvas_gles2.cpp index 711648bd379..3c97a9ff8c4 100644 --- a/drivers/gles2/rasterizer_canvas_gles2.cpp +++ b/drivers/gles2/rasterizer_canvas_gles2.cpp @@ -2604,7 +2604,7 @@ void RasterizerCanvasGLES2::_canvas_render_item(Item *p_ci, RenderItemState &r_r _set_uniforms(); state.canvas_shader.use_material((void *)material_ptr); - glActiveTexture(GL_TEXTURE0 + storage->config.max_texture_image_units - 4); + glActiveTexture(GL_TEXTURE0 + storage->config.max_texture_image_units - 6); RasterizerStorageGLES2::Texture *t = storage->texture_owner.getornull(light->texture); if (!t) { glBindTexture(GL_TEXTURE_2D, storage->resources.white_tex); @@ -3000,7 +3000,7 @@ void RasterizerCanvasGLES2::render_joined_item(const BItemJoined &p_bij, RenderI _set_uniforms(); state.canvas_shader.use_material((void *)material_ptr); - glActiveTexture(GL_TEXTURE0 + storage->config.max_texture_image_units - 4); + glActiveTexture(GL_TEXTURE0 + storage->config.max_texture_image_units - 6); RasterizerStorageGLES2::Texture *t = storage->texture_owner.getornull(light->texture); if (!t) { glBindTexture(GL_TEXTURE_2D, storage->resources.white_tex); diff --git a/drivers/gles2/shaders/canvas.glsl b/drivers/gles2/shaders/canvas.glsl index 04f313d3439..38b9998d63d 100644 --- a/drivers/gles2/shaders/canvas.glsl +++ b/drivers/gles2/shaders/canvas.glsl @@ -333,7 +333,7 @@ uniform highp float light_height; uniform highp float light_outside_alpha; uniform highp float shadow_distance_mult; -uniform lowp sampler2D light_texture; // texunit:-4 +uniform lowp sampler2D light_texture; // texunit:-6 varying vec4 light_uv_interp; varying vec2 transformed_light_uv;