From 1a994ef1c35f456674f6a4b6c8d8f0ccf14ecf8b Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 17 Oct 2014 06:47:31 +0200 Subject: [PATCH] (GCM GL) Cleanups --- ps3/gcmgl/src/rgl_ps3.cpp | 20 ++++++-------------- ps3/gcmgl/src/rgl_ps3_raster.cpp | 14 ++++++-------- 2 files changed, 12 insertions(+), 22 deletions(-) diff --git a/ps3/gcmgl/src/rgl_ps3.cpp b/ps3/gcmgl/src/rgl_ps3.cpp index 29efa9b5d3..38658ff02e 100644 --- a/ps3/gcmgl/src/rgl_ps3.cpp +++ b/ps3/gcmgl/src/rgl_ps3.cpp @@ -516,13 +516,12 @@ static GmmBlock *gmmAllocBlock( { pNewBlock->pPrev = pBlock; pBlock->pNext = pNewBlock; - pAllocator->pTail = pNewBlock; } else { pAllocator->pHead = pNewBlock; - pAllocator->pTail = pNewBlock; } + pAllocator->pTail = pNewBlock; } return pNewBlock; @@ -610,15 +609,10 @@ static GmmTileBlock *gmmCreateTileBlock( pNewBlock->pNext = pAllocator->pTileHead; if (pAllocator->pTileHead) - { pAllocator->pTileHead->pPrev = pNewBlock; - pAllocator->pTileHead = pNewBlock; - } else - { - pAllocator->pTileHead = pNewBlock; pAllocator->pTileTail = pNewBlock; - } + pAllocator->pTileHead = pNewBlock; return pNewBlock; } @@ -804,20 +798,19 @@ static void gmmAddPendingFree (void *data) pAllocator = pGmmLocalAllocator; + pBlock->pNextFree = NULL; + if (pAllocator->pPendingFreeTail) { - pBlock->pNextFree = NULL; pBlock->pPrevFree = pAllocator->pPendingFreeTail; pAllocator->pPendingFreeTail->pNextFree = pBlock; - pAllocator->pPendingFreeTail = pBlock; } else { - pBlock->pNextFree = NULL; pBlock->pPrevFree = NULL; pAllocator->pPendingFreeHead = pBlock; - pAllocator->pPendingFreeTail = pBlock; } + pAllocator->pPendingFreeTail = pBlock; pBlock->isPinned = 0; @@ -4211,11 +4204,10 @@ GLAPI void APIENTRY glActiveTexture( GLenum texture ) int unit = texture - GL_TEXTURE0; LContext->ActiveTexture = unit; + LContext->CurrentImageUnit = NULL; if(unit < RGL_MAX_TEXTURE_IMAGE_UNITS) LContext->CurrentImageUnit = LContext->TextureImageUnits + unit; - else - LContext->CurrentImageUnit = NULL; } /*============================================================ diff --git a/ps3/gcmgl/src/rgl_ps3_raster.cpp b/ps3/gcmgl/src/rgl_ps3_raster.cpp index 4edac4adf8..91a536d800 100644 --- a/ps3/gcmgl/src/rgl_ps3_raster.cpp +++ b/ps3/gcmgl/src/rgl_ps3_raster.cpp @@ -419,27 +419,25 @@ void rglCreatePushBuffer(void *data) //TODO: this is tmp program->samplerCount = samplerCount; + program->samplerValuesLocation = NULL; + program->samplerIndices = NULL; + program->samplerUnits = NULL; + if ( samplerCount ) { program->samplerValuesLocation = ( GLuint* )malloc( samplerCount * sizeof( GLuint ) ); program->samplerIndices = ( GLuint* )malloc( samplerCount * sizeof( GLuint ) ); program->samplerUnits = ( GLuint* )malloc( samplerCount * sizeof( GLuint ) ); } - else - { - program->samplerValuesLocation = NULL; - program->samplerIndices = NULL; - program->samplerUnits = NULL; - } GLuint *samplerValuesLocation = program->samplerValuesLocation; GLuint *samplerIndices = program->samplerIndices; GLuint *samplerUnits = program->samplerUnits; + program->constantPushBufferPointers = NULL; + if ( programPushBufferPointersSize ) program->constantPushBufferPointers = ( unsigned int** )malloc( programPushBufferPointersSize * 4 ); - else - program->constantPushBufferPointers = NULL; uint32_t *rglGcmCurrent = (uint32_t*)program->memoryBlock; program->constantPushBuffer = ( bufferSize > 0 ) ? ( unsigned int * )rglGcmCurrent : NULL;