summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-01-15 13:28:14 +0100
committerRémi Verschelde <rverschelde@gmail.com>2024-01-15 13:28:14 +0100
commit463edd0daf34e15e5c5eb50549bf2fff6bc9e662 (patch)
tree0e8444630bad138ca6cd38b10ee2dde681f9e11e /drivers
parentfb45210e2cf97fd9c4133cd36bae2079845cb5b4 (diff)
parentac87d5f9a29e37e96aebe64efbb66a6996d07d4d (diff)
downloadredot-engine-463edd0daf34e15e5c5eb50549bf2fff6bc9e662.tar.gz
Merge pull request #87067 from moonpirates/bugfix-canvastexture-uvs-compatibility
Fix UV issues in Compatibility renderer
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gles3/rasterizer_canvas_gles3.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp
index 5d6cef6e05..fe16d8838b 100644
--- a/drivers/gles3/rasterizer_canvas_gles3.cpp
+++ b/drivers/gles3/rasterizer_canvas_gles3.cpp
@@ -2295,14 +2295,18 @@ void RasterizerCanvasGLES3::_prepare_canvas_texture(RID p_texture, RS::CanvasIte
GLES3::Texture *texture = texture_storage->get_texture(ct->diffuse);
Size2i size_cache;
+
+ // Cache default white resource ID.
+ const RID default_texture_id = texture_storage->texture_gl_get_default(GLES3::DEFAULT_GL_TEXTURE_WHITE);
+
+ // If no texture is assigned, assign default white.
if (!texture) {
- ct->diffuse = texture_storage->texture_gl_get_default(GLES3::DEFAULT_GL_TEXTURE_WHITE);
- GLES3::Texture *tex = texture_storage->get_texture(ct->diffuse);
- size_cache = Size2i(tex->width, tex->height);
- } else {
- size_cache = Size2i(texture->width, texture->height);
+ ct->diffuse = default_texture_id;
}
+ // Enforce a 1x1 size if default white texture.
+ size_cache = ct->diffuse == default_texture_id ? Size2i(1, 1) : Size2i(texture->width, texture->height);
+
GLES3::Texture *normal_map = texture_storage->get_texture(ct->normal_map);
if (ct->specular_color.a < 0.999) {