diff --git a/drivers/gles2/rasterizer_canvas_gles2.cpp b/drivers/gles2/rasterizer_canvas_gles2.cpp index 1e4e436ea5b..eefdde51487 100644 --- a/drivers/gles2/rasterizer_canvas_gles2.cpp +++ b/drivers/gles2/rasterizer_canvas_gles2.cpp @@ -1356,6 +1356,12 @@ bool RasterizerCanvasGLES2::try_join_item(Item *p_ci, RenderItemState &r_ris, bo if (material_ptr) { shader_ptr = material_ptr->shader; + // special case, if the user has made an error in the shader code + if (shader_ptr && !shader_ptr->valid) { + join = false; + r_batch_break = true; + } + if (shader_ptr && shader_ptr->mode != VS::SHADER_CANVAS_ITEM) { shader_ptr = NULL; // not a canvas item shader, don't use. } diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index b58d45ecd3e..0b480e43e77 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -1754,6 +1754,12 @@ bool RasterizerCanvasGLES3::try_join_item(Item *p_ci, RenderItemState &r_ris, bo if (material_ptr) { shader_ptr = material_ptr->shader; + // special case, if the user has made an error in the shader code + if (shader_ptr && !shader_ptr->valid) { + join = false; + r_batch_break = true; + } + if (shader_ptr && shader_ptr->mode != VS::SHADER_CANVAS_ITEM) { shader_ptr = NULL; // not a canvas item shader, don't use. }