mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-22 11:56:49 +01:00
Prevent drawing MultiMesh with zero instance count
Issuing a driver drawcall for MultiMesh with zero instances crashes some drivers.
This commit is contained in:
parent
0859d5b60f
commit
19dc79114d
@ -935,7 +935,15 @@ void RasterizerCanvasGLES2::render_batches(Item *p_current_clip, bool &r_reclip,
|
||||
break;
|
||||
}
|
||||
|
||||
state.canvas_shader.set_conditional(CanvasShaderGLES2::USE_INSTANCE_CUSTOM, multi_mesh->custom_data_format != RS::MULTIMESH_CUSTOM_DATA_NONE);
|
||||
int amount = MIN(multi_mesh->size, multi_mesh->visible_instances);
|
||||
|
||||
if (amount == -1) {
|
||||
amount = multi_mesh->size;
|
||||
}
|
||||
|
||||
if (!amount) {
|
||||
break;
|
||||
}
|
||||
state.canvas_shader.set_conditional(CanvasShaderGLES2::USE_INSTANCING, true);
|
||||
_set_texture_rect_mode(false);
|
||||
|
||||
@ -953,12 +961,6 @@ void RasterizerCanvasGLES2::render_batches(Item *p_current_clip, bool &r_reclip,
|
||||
|
||||
//reset shader and force rebind
|
||||
|
||||
int amount = MIN(multi_mesh->size, multi_mesh->visible_instances);
|
||||
|
||||
if (amount == -1) {
|
||||
amount = multi_mesh->size;
|
||||
}
|
||||
|
||||
int stride = multi_mesh->color_floats + multi_mesh->custom_data_floats + multi_mesh->xform_floats;
|
||||
|
||||
int color_ofs = multi_mesh->xform_floats;
|
||||
|
@ -1710,6 +1710,10 @@ void RasterizerSceneGLES2::_render_geometry(RenderList::Element *p_element) {
|
||||
amount = multi_mesh->size;
|
||||
}
|
||||
|
||||
if (!amount) {
|
||||
return;
|
||||
}
|
||||
|
||||
int stride = multi_mesh->color_floats + multi_mesh->custom_data_floats + multi_mesh->xform_floats;
|
||||
|
||||
int color_ofs = multi_mesh->xform_floats;
|
||||
|
Loading…
Reference in New Issue
Block a user