(RGL PS3) rglDeallocateBuffer - turn into macro

This commit is contained in:
twinaphex 2013-11-17 22:57:42 +01:00
parent b22842ede2
commit 46d2c31cd8
2 changed files with 9 additions and 22 deletions

View File

@ -63,6 +63,12 @@ static inline void rglGcmSetVertexProgramParameterBlock(struct CellGcmContextDat
#define SUBPIXEL_BITS 12
#define SUBPIXEL_ADJUST (0.5/(1<<SUBPIXEL_BITS))
#define rglDeallocateBuffer(bufferObject, rglBuffer) \
if (rglBuffer->pool == RGLGCM_SURFACE_POOL_LINEAR) \
gmmFree( rglBuffer->bufferId ); \
rglBuffer->pool = RGLGCM_SURFACE_POOL_NONE; \
rglBuffer->bufferId = GMM_ERROR
#define rglGcmSetTextureAddress(thisContext, index, wraps, wrapt, wrapr, unsignedRemap, zfunc, gamma) \
(thisContext->current)[0] = (((1) << (18)) | ((0x00001a08) + 0x20 * ((index)))); \
(thisContext->current)[1] = (((wraps)) | ((0) << 4) | (((wrapt)) << 8) | (((unsignedRemap)) << 12) | (((wrapr)) << 16) | (((gamma)) << 20) |((0) << 24) | (((zfunc)) << 28)); \

View File

@ -762,33 +762,13 @@ void rglCreatePushBuffer(void *data)
PLATFORM BUFFER
============================================================ */
static void rglDeallocateBuffer (void *data)
{
rglBufferObject *bufferObject = (rglBufferObject*)data;
rglGcmBufferObject *rglBuffer = (rglGcmBufferObject*)bufferObject->platformBufferObject;
switch ( rglBuffer->pool )
{
case RGLGCM_SURFACE_POOL_LINEAR:
gmmFree( rglBuffer->bufferId );
break;
case RGLGCM_SURFACE_POOL_NONE:
break;
default:
break;
}
rglBuffer->pool = RGLGCM_SURFACE_POOL_NONE;
rglBuffer->bufferId = GMM_ERROR;
}
static void rglpsAllocateBuffer (void *data)
{
rglBufferObject *bufferObject = (rglBufferObject*)data;
rglGcmBufferObject *rglBuffer = (rglGcmBufferObject*)bufferObject->platformBufferObject;
// free current buffer (if any)
rglDeallocateBuffer( bufferObject );
rglDeallocateBuffer(bufferObject, rglBuffer);
// allocate in GPU memory
rglBuffer->pool = RGLGCM_SURFACE_POOL_LINEAR;
@ -834,7 +814,8 @@ GLboolean rglpCreateBufferObject (void *data)
void rglPlatformDestroyBufferObject (void *data)
{
rglBufferObject *bufferObject = (rglBufferObject*)data;
rglDeallocateBuffer( bufferObject );
rglGcmBufferObject *rglBuffer = (rglGcmBufferObject*)bufferObject->platformBufferObject;
rglDeallocateBuffer(bufferObject, rglBuffer);
}
void rglPlatformBufferObjectSetData(void *buf_data, GLintptr offset, GLsizeiptr size, const GLvoid *data, GLboolean tryImmediateCopy)