Batching - Don't join items with invalid shaders
When users create an invalid shader, the shader->valid flag is set to false. Batching previously assumes that shaders are valid, and this can result in primitives with invalid shader being joined, causing visual errors. This PR prevents joining items that have invalid shaders.
This commit is contained in:
parent
4a942afb9b
commit
6c2cc01f73
2 changed files with 12 additions and 0 deletions
|
@ -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.
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue