diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2019-12-04 12:16:50 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2019-12-04 12:16:50 +0100 |
commit | 745a8915fc5ef0e98c97623cef2792eb95f9aa2b (patch) | |
tree | 4bc32d6ea0bdf5ad5c7bbf8d302ac63d5b304e3e /drivers | |
parent | e1dda5195cb2b8620a61740e8491cbb243aa653c (diff) |
Properly orphan polygon index buffer after binding (take 2)
Follow-up to #34088, patch by @oeleo1 from
https://github.com/godotengine/godot/issues/34065#issuecomment-561530896
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gles3/rasterizer_canvas_gles3.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index 981b9a3576..b3263ce41c 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -479,9 +479,8 @@ void RasterizerCanvasGLES3::_draw_generic_indices(GLuint p_primitive, const int glBindBuffer(GL_ARRAY_BUFFER, data.polygon_buffer); #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_ELEMENT_ARRAY_BUFFER, data.polygon_index_buffer_size, NULL, GL_DYNAMIC_DRAW); #endif uint32_t buffer_ofs = 0; @@ -532,6 +531,10 @@ void RasterizerCanvasGLES3::_draw_generic_indices(GLuint p_primitive, const int //bind the indices 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); //draw the triangles. |