Skip to content

Commit

Permalink
Merge pull request #81036 from jsjtxietian/fix_RasterizerCanvasGLES3_…
Browse files Browse the repository at this point in the history
…add_to_batch_crash

GLES3: Fix `glMapBufferRange` return null when `r_index + last_item_index > max_instance`
  • Loading branch information
akien-mga committed Aug 28, 2023
2 parents 231daee + d48b95a commit 5491dcd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/gles3/rasterizer_canvas_gles3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1451,7 +1451,7 @@ void RasterizerCanvasGLES3::_render_batch(Light *p_lights, uint32_t p_index) {
void RasterizerCanvasGLES3::_add_to_batch(uint32_t &r_index, bool &r_batch_broken) {
state.canvas_instance_batches[state.current_batch_index].instance_count++;
r_index++;
if (r_index >= data.max_instances_per_buffer) {
if (r_index + state.last_item_index >= data.max_instances_per_buffer) {
// Copy over all data needed for rendering right away
// then go back to recording item commands.
glBindBuffer(GL_ARRAY_BUFFER, state.canvas_instance_data_buffers[state.current_data_buffer_index].instance_buffers[state.current_instance_buffer_index]);
Expand Down

0 comments on commit 5491dcd

Please sign in to comment.