aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRay <raysan5@gmail.com>2018-01-07 23:54:11 +0100
committerRay <raysan5@gmail.com>2018-01-07 23:54:11 +0100
commit4dcc02ff1ef4d6ab6c10ece84c47892f12290908 (patch)
treec6b148253d34ef52af80cc9be41f58bd3279f2dc /src
parente4be917d1b36a65286ca49b85328187ea8c190ad (diff)
downloadraylib-4dcc02ff1ef4d6ab6c10ece84c47892f12290908.tar.gz
raylib-4dcc02ff1ef4d6ab6c10ece84c47892f12290908.zip
Launch draw call if buffer limits reached
Note that this solution is a temporal patch, not properly tested and prone to fail, specially if matrix are pushed into the stack...
Diffstat (limited to 'src')
-rw-r--r--src/rlgl.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/rlgl.c b/src/rlgl.c
index b893d5e5..de81fde1 100644
--- a/src/rlgl.c
+++ b/src/rlgl.c
@@ -644,6 +644,14 @@ void rlEnd(void)
// as well as depth buffer bit-depth (16bit or 24bit or 32bit)
// Correct increment formula would be: depthInc = (zfar - znear)/pow(2, bits)
currentDepth += (1.0f/20000.0f);
+
+ // TODO: Verify internal buffers limits
+ // NOTE: Before launching draw, verify no matrix are left in the stack!
+ // NOTE: Probably a lines/triangles margin should be left, rlEnd could be called
+ // after an undetermined number of triangles buffered (check shapes::DrawPoly())
+ if ((lines.vCounter/2 >= MAX_LINES_BATCH - 2) ||
+ (triangles.vCounter/3 >= MAX_TRIANGLES_BATCH - 16) ||
+ (quads.vCounter/4 >= MAX_QUADS_BATCH - 2)) rlglDraw();
}
// Define one vertex (position)