Fix a bug in vitagles2 renderer

This commit is contained in:
Ivan Epifanov 2020-12-09 15:28:57 +03:00 committed by Sam Lantinga
parent 639323ea0d
commit 47c6270ece

View File

@ -1202,12 +1202,16 @@ VITA_GLES2_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void
} }
/* upload the new VBO data for this set of commands. */ /* upload the new VBO data for this set of commands. */
data->glBindBuffer(GL_ARRAY_BUFFER, vbo); /* NULL/zero vertices could happen SetRenderTarget is the first render command */
if (data->vertex_buffer_size[vboidx] < vertsize) { if (vertsize > 0 && vertices != NULL)
data->glBufferData(GL_ARRAY_BUFFER, vertsize, vertices, GL_DYNAMIC_DRAW); {
data->vertex_buffer_size[vboidx] = vertsize; data->glBindBuffer(GL_ARRAY_BUFFER, vbo);
} else { if (data->vertex_buffer_size[vboidx] < vertsize) {
data->glBufferSubData(GL_ARRAY_BUFFER, 0, vertsize, vertices); data->glBufferData(GL_ARRAY_BUFFER, vertsize, vertices, GL_DYNAMIC_DRAW);
data->vertex_buffer_size[vboidx] = vertsize;
} else {
data->glBufferSubData(GL_ARRAY_BUFFER, 0, vertsize, vertices);
}
} }
/* cycle through a few VBOs so the GL has some time with the data before we replace it. */ /* cycle through a few VBOs so the GL has some time with the data before we replace it. */