summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormausimus <[email protected]>2021-09-29 21:26:29 +0000
committerGitHub <[email protected]>2021-09-29 23:26:29 +0200
commitdfbb134bfeb0089b187568c6b6bcc8c033cb3c23 (patch)
tree7c6edab46a06679dbef88fccdce8f78ed67fcabf
parent92f6290dbb89adadc51f13b98237c657ca3815a8 (diff)
downloadraylib-dfbb134bfeb0089b187568c6b6bcc8c033cb3c23.tar.gz
raylib-dfbb134bfeb0089b187568c6b6bcc8c033cb3c23.zip
RLGL: restore draw batch state after limit check (#2018)
-rw-r--r--src/rlgl.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/rlgl.h b/src/rlgl.h
index 2974ee13..3851982e 100644
--- a/src/rlgl.h
+++ b/src/rlgl.h
@@ -2548,8 +2548,15 @@ bool rlCheckRenderBatchLimit(int vCount)
if ((RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].vCounter + vCount) >=
(RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].elementCount*4))
{
+ int currentMode = RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].mode;
+ int currentTexture = RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].textureId;
+
overflow = true;
rlDrawRenderBatch(RLGL.currentBatch); // NOTE: Stereo rendering is checked inside
+
+ // restore state of last batch so we can continue adding vertices
+ RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].mode = currentMode;
+ RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].textureId = currentTexture;
}
#endif