From 41235eed1dad40abf7a34750beedff1176e0c6e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Tue, 18 Aug 2020 13:53:00 +0200 Subject: GPU: Avoid invalid GL API usage Drawing with 0 sized buffer is prohibited. --- source/blender/gpu/opengl/gl_drawlist.cc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source/blender/gpu/opengl/gl_drawlist.cc') diff --git a/source/blender/gpu/opengl/gl_drawlist.cc b/source/blender/gpu/opengl/gl_drawlist.cc index b02681af892..16ea924d8dc 100644 --- a/source/blender/gpu/opengl/gl_drawlist.cc +++ b/source/blender/gpu/opengl/gl_drawlist.cc @@ -151,6 +151,11 @@ void GLDrawList::append(GPUBatch *batch, int i_first, int i_count) v_count_ = batch->elem ? batch->elem->index_len : batch->verts[0]->vertex_len; } + if (v_count_ == 0) { + /* Nothing to draw. */ + return; + } + if (MDI_INDEXED) { GLDrawCommandIndexed *cmd = reinterpret_cast(data_ + command_offset_); cmd->v_first = v_first_; -- cgit v1.2.3