[iortcw] 412/497: All: Fix not swapping buffers because out of cmd buffer space
Simon McVittie
smcv at debian.org
Fri Sep 8 10:37:38 UTC 2017
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to annotated tag 1.42d
in repository iortcw.
commit 880e67a40dc995961cec9f1a03093a003233b04d
Author: Donny <M4N4T4RMS at gmail.com>
Date: Tue Oct 20 07:37:39 2015 -0400
All: Fix not swapping buffers because out of cmd buffer space
---
MP/code/rend2/tr_cmds.c | 22 +++++++++++++++++-----
MP/code/renderer/tr_cmds.c | 22 +++++++++++++++++-----
SP/code/rend2/tr_cmds.c | 22 +++++++++++++++++-----
SP/code/renderer/tr_cmds.c | 22 +++++++++++++++++-----
4 files changed, 68 insertions(+), 20 deletions(-)
diff --git a/MP/code/rend2/tr_cmds.c b/MP/code/rend2/tr_cmds.c
index c2bbe9a..6d7555f 100644
--- a/MP/code/rend2/tr_cmds.c
+++ b/MP/code/rend2/tr_cmds.c
@@ -131,12 +131,12 @@ void R_IssuePendingRenderCommands( void ) {
/*
============
-R_GetCommandBuffer
+R_GetCommandBufferReserved
make sure there is enough command space
============
*/
-void *R_GetCommandBuffer( int bytes ) {
+void *R_GetCommandBufferReserved( int bytes, int reservedBytes ) {
renderCommandList_t *cmdList;
if ( !tr.registered ) { //DAJ BUGFIX
@@ -146,8 +146,8 @@ void *R_GetCommandBuffer( int bytes ) {
bytes = PAD(bytes, sizeof(void *));
// always leave room for the end of list command
- if ( cmdList->used + bytes + 4 > MAX_RENDER_COMMANDS ) {
- if ( bytes > MAX_RENDER_COMMANDS - 4 ) {
+ if ( cmdList->used + bytes + sizeof( int ) + reservedBytes > MAX_RENDER_COMMANDS ) {
+ if ( bytes > MAX_RENDER_COMMANDS - sizeof( int ) ) {
ri.Error( ERR_FATAL, "R_GetCommandBuffer: bad size %i", bytes );
}
// if we run out of room, just start dropping commands
@@ -162,6 +162,18 @@ void *R_GetCommandBuffer( int bytes ) {
/*
=============
+R_GetCommandBuffer
+
+returns NULL if there is not enough space for important commands
+=============
+*/
+void *R_GetCommandBuffer( int bytes ) {
+ return R_GetCommandBufferReserved( bytes, sizeof ( swapBuffersCommand_t ) );
+}
+
+
+/*
+=============
R_AddDrawSurfCmd
=============
@@ -618,7 +630,7 @@ void RE_EndFrame( int *frontEndMsec, int *backEndMsec ) {
if ( !tr.registered ) {
return;
}
- cmd = R_GetCommandBuffer( sizeof( *cmd ) );
+ cmd = R_GetCommandBufferReserved( sizeof( *cmd ), 0 );
if ( !cmd ) {
return;
}
diff --git a/MP/code/renderer/tr_cmds.c b/MP/code/renderer/tr_cmds.c
index bd3c76e..390f680 100644
--- a/MP/code/renderer/tr_cmds.c
+++ b/MP/code/renderer/tr_cmds.c
@@ -124,12 +124,12 @@ void R_IssuePendingRenderCommands( void ) {
/*
============
-R_GetCommandBuffer
+R_GetCommandBufferReserved
make sure there is enough command space
============
*/
-void *R_GetCommandBuffer( int bytes ) {
+void *R_GetCommandBufferReserved( int bytes, int reservedBytes ) {
renderCommandList_t *cmdList;
if ( !tr.registered ) { //DAJ BUGFIX
@@ -139,8 +139,8 @@ void *R_GetCommandBuffer( int bytes ) {
bytes = PAD(bytes, sizeof(void *));
// always leave room for the end of list command
- if ( cmdList->used + bytes + 4 > MAX_RENDER_COMMANDS ) {
- if ( bytes > MAX_RENDER_COMMANDS - 4 ) {
+ if ( cmdList->used + bytes + sizeof( int ) + reservedBytes > MAX_RENDER_COMMANDS ) {
+ if ( bytes > MAX_RENDER_COMMANDS - sizeof( int ) ) {
ri.Error( ERR_FATAL, "R_GetCommandBuffer: bad size %i", bytes );
}
// if we run out of room, just start dropping commands
@@ -155,6 +155,18 @@ void *R_GetCommandBuffer( int bytes ) {
/*
=============
+R_GetCommandBuffer
+
+returns NULL if there is not enough space for important commands
+=============
+*/
+void *R_GetCommandBuffer( int bytes ) {
+ return R_GetCommandBufferReserved( bytes, sizeof ( swapBuffersCommand_t ) );
+}
+
+
+/*
+=============
R_AddDrawSurfCmd
=============
@@ -559,7 +571,7 @@ void RE_EndFrame( int *frontEndMsec, int *backEndMsec ) {
if ( !tr.registered ) {
return;
}
- cmd = R_GetCommandBuffer( sizeof( *cmd ) );
+ cmd = R_GetCommandBufferReserved( sizeof( *cmd ), 0 );
if ( !cmd ) {
return;
}
diff --git a/SP/code/rend2/tr_cmds.c b/SP/code/rend2/tr_cmds.c
index 6c9e4a7..940bcbe 100644
--- a/SP/code/rend2/tr_cmds.c
+++ b/SP/code/rend2/tr_cmds.c
@@ -128,20 +128,20 @@ void R_IssuePendingRenderCommands( void ) {
/*
============
-R_GetCommandBuffer
+R_GetCommandBufferReserved
make sure there is enough command space
============
*/
-void *R_GetCommandBuffer( int bytes ) {
+void *R_GetCommandBufferReserved( int bytes, int reservedBytes ) {
renderCommandList_t *cmdList;
cmdList = &backEndData->commands;
bytes = PAD(bytes, sizeof(void *));
// always leave room for the end of list command
- if ( cmdList->used + bytes + 4 > MAX_RENDER_COMMANDS ) {
- if ( bytes > MAX_RENDER_COMMANDS - 4 ) {
+ if ( cmdList->used + bytes + sizeof( int ) + reservedBytes > MAX_RENDER_COMMANDS ) {
+ if ( bytes > MAX_RENDER_COMMANDS - sizeof( int ) ) {
ri.Error( ERR_FATAL, "R_GetCommandBuffer: bad size %i", bytes );
}
// if we run out of room, just start dropping commands
@@ -156,6 +156,18 @@ void *R_GetCommandBuffer( int bytes ) {
/*
=============
+R_GetCommandBuffer
+
+returns NULL if there is not enough space for important commands
+=============
+*/
+void *R_GetCommandBuffer( int bytes ) {
+ return R_GetCommandBufferReserved( bytes, sizeof ( swapBuffersCommand_t ) );
+}
+
+
+/*
+=============
R_AddDrawSurfCmd
=============
@@ -631,7 +643,7 @@ void RE_EndFrame( int *frontEndMsec, int *backEndMsec ) {
if ( !tr.registered ) {
return;
}
- cmd = R_GetCommandBuffer( sizeof( *cmd ) );
+ cmd = R_GetCommandBufferReserved( sizeof( *cmd ), 0 );
if ( !cmd ) {
return;
}
diff --git a/SP/code/renderer/tr_cmds.c b/SP/code/renderer/tr_cmds.c
index 9b65950..7cef1e2 100644
--- a/SP/code/renderer/tr_cmds.c
+++ b/SP/code/renderer/tr_cmds.c
@@ -121,20 +121,20 @@ void R_IssuePendingRenderCommands( void ) {
/*
============
-R_GetCommandBuffer
+R_GetCommandBufferReserved
make sure there is enough command space
============
*/
-void *R_GetCommandBuffer( int bytes ) {
+void *R_GetCommandBufferReserved( int bytes, int reservedBytes ) {
renderCommandList_t *cmdList;
cmdList = &backEndData->commands;
bytes = PAD(bytes, sizeof(void *));
// always leave room for the end of list command
- if ( cmdList->used + bytes + 4 > MAX_RENDER_COMMANDS ) {
- if ( bytes > MAX_RENDER_COMMANDS - 4 ) {
+ if ( cmdList->used + bytes + sizeof( int ) + reservedBytes > MAX_RENDER_COMMANDS ) {
+ if ( bytes > MAX_RENDER_COMMANDS - sizeof( int ) ) {
ri.Error( ERR_FATAL, "R_GetCommandBuffer: bad size %i", bytes );
}
// if we run out of room, just start dropping commands
@@ -149,6 +149,18 @@ void *R_GetCommandBuffer( int bytes ) {
/*
=============
+R_GetCommandBuffer
+
+returns NULL if there is not enough space for important commands
+=============
+*/
+void *R_GetCommandBuffer( int bytes ) {
+ return R_GetCommandBufferReserved( bytes, sizeof ( swapBuffersCommand_t ) );
+}
+
+
+/*
+=============
R_AddDrawSurfCmd
=============
@@ -572,7 +584,7 @@ void RE_EndFrame( int *frontEndMsec, int *backEndMsec ) {
if ( !tr.registered ) {
return;
}
- cmd = R_GetCommandBuffer( sizeof( *cmd ) );
+ cmd = R_GetCommandBufferReserved( sizeof( *cmd ), 0 );
if ( !cmd ) {
return;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git
More information about the Pkg-games-commits
mailing list