Mute errors on surface->index_array_len == 0 in the GLES3 renderer
This error is generated whenever rendering collision debug meshes. There's no reason why this should be treated as an error as index-less meshes are supported and used across the engine.
This commit is contained in:
parent
1ff170e67f
commit
1dd98baaa6
|
@ -3632,28 +3632,30 @@ PoolVector<uint8_t> RasterizerStorageGLES3::mesh_surface_get_index_array(RID p_m
|
||||||
|
|
||||||
Surface *surface = mesh->surfaces[p_surface];
|
Surface *surface = mesh->surfaces[p_surface];
|
||||||
|
|
||||||
ERR_FAIL_COND_V(surface->index_array_len == 0, PoolVector<uint8_t>());
|
|
||||||
|
|
||||||
PoolVector<uint8_t> ret;
|
PoolVector<uint8_t> ret;
|
||||||
ret.resize(surface->index_array_byte_size);
|
ret.resize(surface->index_array_byte_size);
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, surface->index_id);
|
|
||||||
|
if (surface->index_array_byte_size > 0) {
|
||||||
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, surface->index_id);
|
||||||
|
|
||||||
#if defined(GLES_OVER_GL) || defined(__EMSCRIPTEN__)
|
#if defined(GLES_OVER_GL) || defined(__EMSCRIPTEN__)
|
||||||
{
|
{
|
||||||
PoolVector<uint8_t>::Write w = ret.write();
|
PoolVector<uint8_t>::Write w = ret.write();
|
||||||
glGetBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, surface->index_array_byte_size, w.ptr());
|
glGetBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, surface->index_array_byte_size, w.ptr());
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
void *data = glMapBufferRange(GL_ELEMENT_ARRAY_BUFFER, 0, surface->index_array_byte_size, GL_MAP_READ_BIT);
|
void *data = glMapBufferRange(GL_ELEMENT_ARRAY_BUFFER, 0, surface->index_array_byte_size, GL_MAP_READ_BIT);
|
||||||
ERR_FAIL_NULL_V(data, PoolVector<uint8_t>());
|
ERR_FAIL_NULL_V(data, PoolVector<uint8_t>());
|
||||||
{
|
{
|
||||||
PoolVector<uint8_t>::Write w = ret.write();
|
PoolVector<uint8_t>::Write w = ret.write();
|
||||||
copymem(w.ptr(), data, surface->index_array_byte_size);
|
copymem(w.ptr(), data, surface->index_array_byte_size);
|
||||||
}
|
}
|
||||||
glUnmapBuffer(GL_ELEMENT_ARRAY_BUFFER);
|
glUnmapBuffer(GL_ELEMENT_ARRAY_BUFFER);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue