Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Erwin <significant.bit@gmail.com>2016-10-08 04:09:03 +0300
committerMike Erwin <significant.bit@gmail.com>2016-10-08 06:50:52 +0300
commitb071ac315cb7f068372073d6f5bae6e771a5d860 (patch)
treefc7822a35f2949d12fbd992f741c52ca5a8d0636 /source/blender/gpu/gawain/immediate.c
parent2a76da9ec24c5c86cfcd2cbae8d3a71bd93a0e0c (diff)
Gawain: allow immBeginAtMost, immEnd with no vertices
The whole point of BeginAtMost is to avoid counting before drawing. Sometimes the uncounted count is zero, and that's ok!
Diffstat (limited to 'source/blender/gpu/gawain/immediate.c')
-rw-r--r--source/blender/gpu/gawain/immediate.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/source/blender/gpu/gawain/immediate.c b/source/blender/gpu/gawain/immediate.c
index 5be7372fa1b..3849453dd7b 100644
--- a/source/blender/gpu/gawain/immediate.c
+++ b/source/blender/gpu/gawain/immediate.c
@@ -320,7 +320,7 @@ void immEnd()
{
#if TRUST_NO_ONE
assert(imm.vertex_idx <= imm.vertex_ct);
- assert(vertex_count_makes_sense_for_primitive(imm.vertex_idx, imm.primitive));
+ assert(imm.vertex_idx == 0 || vertex_count_makes_sense_for_primitive(imm.vertex_idx, imm.primitive));
#endif
// printf("used %u of %u verts,", imm.vertex_idx, imm.vertex_ct);
imm.vertex_ct = imm.vertex_idx;
@@ -351,9 +351,11 @@ void immEnd()
#endif
glUnmapBuffer(GL_ARRAY_BUFFER);
- immDrawSetup();
-
- glDrawArrays(imm.primitive, 0, imm.vertex_ct);
+ if (imm.vertex_ct > 0)
+ {
+ immDrawSetup();
+ glDrawArrays(imm.primitive, 0, imm.vertex_ct);
+ }
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindVertexArray(0);