Merge pull request #69858 from Malcolmnixon/gles3-index-array-cache

Fix for glDrawElements crash on GLES3
This commit is contained in:
Rémi Verschelde 2022-12-10 19:35:40 +01:00 committed by GitHub
commit 39fe0bfdc3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2210,10 +2210,13 @@ void RasterizerSceneGLES3::_render_list_template(RenderListParameters *p_params,
glBindVertexArray(vertex_array_gl); glBindVertexArray(vertex_array_gl);
} }
prev_vertex_array_gl = vertex_array_gl; prev_vertex_array_gl = vertex_array_gl;
// Invalidate the previous index array
prev_index_array_gl = 0;
} }
bool use_index_buffer = index_array_gl != 0; bool use_index_buffer = index_array_gl != 0;
if (prev_index_array_gl != index_array_gl || prev_vertex_array_gl != vertex_array_gl) { if (prev_index_array_gl != index_array_gl) {
if (index_array_gl != 0) { if (index_array_gl != 0) {
// Bind index each time so we can use LODs // Bind index each time so we can use LODs
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, index_array_gl); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, index_array_gl);