summaryrefslogtreecommitdiff
path: root/src/renderer
diff options
context:
space:
mode:
authorThilo Schulz <arny@ats.s.bawue.de>2011-05-09 23:39:40 +0000
committerTim Angus <tim@ngus.net>2013-01-09 21:38:39 +0000
commit978c0599002feabd27b18767389182cf77e5a3e6 (patch)
treeaf7ca5fb2f7be3010acfd68e342262f4d9b4b620 /src/renderer
parent91afb0a90e002901a98139be600a550a34d9eced (diff)
Choose better alignment for heavy-duty rendering structures, patch by Matt Turner (#4981)
Diffstat (limited to 'src/renderer')
-rw-r--r--src/renderer/tr_backend.c2
-rw-r--r--src/renderer/tr_cmds.c1
-rw-r--r--src/renderer/tr_init.c4
-rw-r--r--src/renderer/tr_shader.c2
4 files changed, 7 insertions, 2 deletions
diff --git a/src/renderer/tr_backend.c b/src/renderer/tr_backend.c
index 54431ab8..704d947f 100644
--- a/src/renderer/tr_backend.c
+++ b/src/renderer/tr_backend.c
@@ -1143,6 +1143,8 @@ void RB_ExecuteRenderCommands( const void *data ) {
}
while ( 1 ) {
+ data = PADP(data, sizeof(void *));
+
switch ( *(const int *)data ) {
case RC_SET_COLOR:
data = RB_SetColor( data );
diff --git a/src/renderer/tr_cmds.c b/src/renderer/tr_cmds.c
index 833c0f07..3958a718 100644
--- a/src/renderer/tr_cmds.c
+++ b/src/renderer/tr_cmds.c
@@ -196,6 +196,7 @@ void *R_GetCommandBuffer( int bytes ) {
renderCommandList_t *cmdList;
cmdList = &backEndData[tr.smpFrame]->commands;
+ bytes = PAD(bytes, sizeof(void *));
// always leave room for the end of list command
if ( cmdList->used + bytes + 4 > MAX_RENDER_COMMANDS ) {
diff --git a/src/renderer/tr_init.c b/src/renderer/tr_init.c
index 10ea222c..7715cd7f 100644
--- a/src/renderer/tr_init.c
+++ b/src/renderer/tr_init.c
@@ -394,7 +394,7 @@ byte *RB_ReadPixels(int x, int y, int width, int height, size_t *offset, int *pa
// Allocate a few more bytes so that we can choose an alignment we like
buffer = ri.Hunk_AllocateTempMemory(padwidth * height + *offset + packAlign - 1);
- bufstart = (byte *) PAD((intptr_t) buffer + *offset, packAlign);
+ bufstart = PADP((intptr_t) buffer + *offset, packAlign);
qglReadPixels(x, y, width, height, GL_RGB, GL_UNSIGNED_BYTE, bufstart);
*offset = bufstart - buffer;
@@ -792,7 +792,7 @@ const void *RB_TakeVideoFrameCmd( const void *data )
avipadwidth = PAD(linelen, AVI_LINE_PADDING);
avipadlen = avipadwidth - linelen;
- cBuf = (byte *) PAD((intptr_t) cmd->captureBuffer, packAlign);
+ cBuf = PADP(cmd->captureBuffer, packAlign);
qglReadPixels(0, 0, cmd->width, cmd->height, GL_RGB,
GL_UNSIGNED_BYTE, cBuf);
diff --git a/src/renderer/tr_shader.c b/src/renderer/tr_shader.c
index 22e340c6..4b2452e2 100644
--- a/src/renderer/tr_shader.c
+++ b/src/renderer/tr_shader.c
@@ -1879,6 +1879,8 @@ static void FixRenderCommandList( int newShader ) {
const void *curCmd = cmdList->cmds;
while ( 1 ) {
+ curCmd = PADP(curCmd, sizeof(void *));
+
switch ( *(const int *)curCmd ) {
case RC_SET_COLOR:
{