You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-07 12:30:27 +00:00
Merge pull request #34088 from clayjohn/GLES3-polygon-buffer-orphaning-fix
Properly orphan polygon index buffer after binding
This commit is contained in:
@@ -327,9 +327,8 @@ void RasterizerCanvasGLES3::_draw_polygon(const int *p_indices, int p_index_coun
|
|||||||
glBindBuffer(GL_ARRAY_BUFFER, data.polygon_buffer);
|
glBindBuffer(GL_ARRAY_BUFFER, data.polygon_buffer);
|
||||||
|
|
||||||
#ifndef GLES_OVER_GL
|
#ifndef GLES_OVER_GL
|
||||||
// Orphan the buffers to avoid CPU/GPU sync points caused by glBufferSubData
|
// Orphan the buffer to avoid CPU/GPU sync points caused by glBufferSubData
|
||||||
glBufferData(GL_ARRAY_BUFFER, data.polygon_buffer_size, NULL, GL_DYNAMIC_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, data.polygon_buffer_size, NULL, GL_DYNAMIC_DRAW);
|
||||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, data.polygon_index_buffer_size, NULL, GL_DYNAMIC_DRAW);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint32_t buffer_ofs = 0;
|
uint32_t buffer_ofs = 0;
|
||||||
@@ -402,6 +401,10 @@ void RasterizerCanvasGLES3::_draw_polygon(const int *p_indices, int p_index_coun
|
|||||||
|
|
||||||
//bind the indices buffer.
|
//bind the indices buffer.
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, data.polygon_index_buffer);
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, data.polygon_index_buffer);
|
||||||
|
#ifndef GLES_OVER_GL
|
||||||
|
// Orphan the buffer to avoid CPU/GPU sync points caused by glBufferSubData
|
||||||
|
glBufferData(GL_ELEMENT_ARRAY_BUFFER, data.polygon_index_buffer_size, NULL, GL_DYNAMIC_DRAW);
|
||||||
|
#endif
|
||||||
glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, sizeof(int) * p_index_count, p_indices);
|
glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, sizeof(int) * p_index_count, p_indices);
|
||||||
|
|
||||||
//draw the triangles.
|
//draw the triangles.
|
||||||
@@ -424,9 +427,8 @@ void RasterizerCanvasGLES3::_draw_generic(GLuint p_primitive, int p_vertex_count
|
|||||||
glBindBuffer(GL_ARRAY_BUFFER, data.polygon_buffer);
|
glBindBuffer(GL_ARRAY_BUFFER, data.polygon_buffer);
|
||||||
|
|
||||||
#ifndef GLES_OVER_GL
|
#ifndef GLES_OVER_GL
|
||||||
// Orphan the buffers to avoid CPU/GPU sync points caused by glBufferSubData
|
// Orphan the buffer to avoid CPU/GPU sync points caused by glBufferSubData
|
||||||
glBufferData(GL_ARRAY_BUFFER, data.polygon_buffer_size, NULL, GL_DYNAMIC_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, data.polygon_buffer_size, NULL, GL_DYNAMIC_DRAW);
|
||||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, data.polygon_index_buffer_size, NULL, GL_DYNAMIC_DRAW);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint32_t buffer_ofs = 0;
|
uint32_t buffer_ofs = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user