mirror of
https://github.com/libretro/RetroArch
synced 2025-01-01 12:11:47 +00:00
(RGL) Move some stuff around
This commit is contained in:
parent
f04e079d77
commit
dfd5571f12
@ -35,15 +35,6 @@ using namespace cell::Gcm;
|
||||
|
||||
extern void _RGLFifoGlSetRenderTarget( RGLRenderTargetEx const * const args );
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int id;
|
||||
GLuint offset;
|
||||
GLuint size;
|
||||
GLuint pitch;
|
||||
GLuint bank;
|
||||
} jsTiledRegion;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
jsTiledRegion region[MAX_TILED_REGIONS];
|
||||
@ -60,6 +51,9 @@ static const uint32_t WaitLabelIndex = 111;
|
||||
extern GLuint nvFenceCounter;
|
||||
RGLState _RGLState;
|
||||
|
||||
extern GmmAllocator *pGmmLocalAllocator;
|
||||
extern GmmAllocator *pGmmMainAllocator;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int width;
|
||||
@ -1161,7 +1155,54 @@ PSGLdevice *psglGetCurrentDevice(void)
|
||||
return _CurrentDevice;
|
||||
}
|
||||
|
||||
extern void gmmUpdateFreeList (const uint8_t location);
|
||||
static void gmmRemovePendingFree(GmmAllocator *pAllocator, GmmBlock *pBlock)
|
||||
{
|
||||
if (pBlock == pAllocator->pPendingFreeHead)
|
||||
pAllocator->pPendingFreeHead = pBlock->pNextFree;
|
||||
|
||||
if (pBlock == pAllocator->pPendingFreeTail)
|
||||
pAllocator->pPendingFreeTail = pBlock->pPrevFree;
|
||||
|
||||
if (pBlock->pNextFree)
|
||||
pBlock->pNextFree->pPrevFree = pBlock->pPrevFree;
|
||||
|
||||
if (pBlock->pPrevFree)
|
||||
pBlock->pPrevFree->pNextFree = pBlock->pNextFree;
|
||||
}
|
||||
|
||||
extern void gmmAddFree(GmmAllocator *pAllocator, GmmBlock *pBlock);
|
||||
|
||||
static void gmmUpdateFreeLists (void)
|
||||
{
|
||||
for(int i = 0; i < 2; i++)
|
||||
{
|
||||
uint8_t location = i == 0 ? CELL_GCM_LOCATION_LOCAL : CELL_GCM_LOCATION_MAIN;
|
||||
GmmAllocator *pAllocator;
|
||||
const uint32_t fence = _RGLState.semaphores->userSemaphores[SEMA_FENCE].val;
|
||||
GmmBlock *pBlock = NULL;
|
||||
GmmBlock *pTemp = NULL;
|
||||
|
||||
pAllocator = (location == CELL_GCM_LOCATION_LOCAL) ?
|
||||
pGmmLocalAllocator :
|
||||
pGmmMainAllocator;
|
||||
|
||||
pBlock = pAllocator->pPendingFreeHead;
|
||||
|
||||
while (pBlock)
|
||||
{
|
||||
pTemp = pBlock->pNextFree;
|
||||
|
||||
if ( !(( fence - pBlock->fence ) & 0x80000000 ) )
|
||||
{
|
||||
gmmRemovePendingFree(pAllocator, pBlock);
|
||||
gmmAddFree(pAllocator, pBlock);
|
||||
}
|
||||
|
||||
pBlock = pTemp;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
GLAPI void psglSwap(void)
|
||||
{
|
||||
@ -1169,8 +1210,7 @@ GLAPI void psglSwap(void)
|
||||
PSGLdevice *device = _CurrentDevice;
|
||||
RGLFifo *fifo = &_RGLState.fifo;
|
||||
|
||||
gmmUpdateFreeList(CELL_GCM_LOCATION_LOCAL);
|
||||
gmmUpdateFreeList(CELL_GCM_LOCATION_MAIN);
|
||||
gmmUpdateFreeLists();
|
||||
|
||||
RGLDevice *gcmDevice = ( RGLDevice * )device->platformDevice;
|
||||
|
||||
@ -1300,11 +1340,3 @@ GLboolean _RGLTryResizeTileRegion(GLuint address, GLuint size, void* data)
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
void _RGLGetTileRegionInfo(void* data, GLuint *address, GLuint *size)
|
||||
{
|
||||
jsTiledRegion* region = ( jsTiledRegion* )data;
|
||||
|
||||
*address = region->offset;
|
||||
*size = region->size;
|
||||
}
|
||||
|
@ -2080,21 +2080,6 @@ static uint32_t gmmInitFixedAllocator (void)
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
static void gmmRemovePendingFree(GmmAllocator *pAllocator, GmmBlock *pBlock)
|
||||
{
|
||||
if (pBlock == pAllocator->pPendingFreeHead)
|
||||
pAllocator->pPendingFreeHead = pBlock->pNextFree;
|
||||
|
||||
if (pBlock == pAllocator->pPendingFreeTail)
|
||||
pAllocator->pPendingFreeTail = pBlock->pPrevFree;
|
||||
|
||||
if (pBlock->pNextFree)
|
||||
pBlock->pNextFree->pPrevFree = pBlock->pPrevFree;
|
||||
|
||||
if (pBlock->pPrevFree)
|
||||
pBlock->pPrevFree->pNextFree = pBlock->pNextFree;
|
||||
}
|
||||
|
||||
static uint8_t gmmSizeToFreeIndex(uint32_t size)
|
||||
{
|
||||
if (size >= GMM_FREE_BIN_0 && size < GMM_FREE_BIN_1)
|
||||
@ -2143,7 +2128,7 @@ static uint8_t gmmSizeToFreeIndex(uint32_t size)
|
||||
return 21;
|
||||
}
|
||||
|
||||
static void gmmAddFree(GmmAllocator *pAllocator, GmmBlock *pBlock)
|
||||
void gmmAddFree(GmmAllocator *pAllocator, GmmBlock *pBlock)
|
||||
{
|
||||
uint8_t freeIndex = gmmSizeToFreeIndex(pBlock->base.size);
|
||||
|
||||
@ -2187,34 +2172,6 @@ static void gmmAddFree(GmmAllocator *pAllocator, GmmBlock *pBlock)
|
||||
}
|
||||
}
|
||||
|
||||
void gmmUpdateFreeList (const uint8_t location)
|
||||
{
|
||||
GmmAllocator *pAllocator;
|
||||
const uint32_t fence = _RGLState.semaphores->userSemaphores[SEMA_FENCE].val;
|
||||
GmmBlock *pBlock = NULL;
|
||||
GmmBlock *pTemp = NULL;
|
||||
|
||||
pAllocator = (location == CELL_GCM_LOCATION_LOCAL) ?
|
||||
pGmmLocalAllocator :
|
||||
pGmmMainAllocator;
|
||||
|
||||
|
||||
pBlock = pAllocator->pPendingFreeHead;
|
||||
|
||||
while (pBlock)
|
||||
{
|
||||
pTemp = pBlock->pNextFree;
|
||||
|
||||
if ( !(( fence - pBlock->fence ) & 0x80000000 ) )
|
||||
{
|
||||
gmmRemovePendingFree(pAllocator, pBlock);
|
||||
gmmAddFree(pAllocator, pBlock);
|
||||
}
|
||||
|
||||
pBlock = pTemp;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void *gmmAllocFixed(uint8_t isTile)
|
||||
{
|
||||
@ -2382,6 +2339,14 @@ char *gmmIdToAddress(const uint32_t id)
|
||||
return (char *)pBaseBlock->address;
|
||||
}
|
||||
|
||||
static void _RGLGetTileRegionInfo(void* data, GLuint *address, GLuint *size)
|
||||
{
|
||||
jsTiledRegion* region = ( jsTiledRegion* )data;
|
||||
|
||||
*address = region->offset;
|
||||
*size = region->size;
|
||||
}
|
||||
|
||||
static GmmBlock *gmmAllocBlock(GmmAllocator *pAllocator, uint32_t size)
|
||||
{
|
||||
uint32_t address;
|
||||
|
@ -185,6 +185,15 @@ typedef struct
|
||||
int X, Y, XSize, YSize;
|
||||
} jsViewPort;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int id;
|
||||
GLuint offset;
|
||||
GLuint size;
|
||||
GLuint pitch;
|
||||
GLuint bank;
|
||||
} jsTiledRegion;
|
||||
|
||||
enum
|
||||
{
|
||||
IMAGE_DATASTATE_UNSET = 0x0,
|
||||
@ -860,7 +869,6 @@ void _RGLSetNativeCgVertexProgram( const void *header );
|
||||
void _RGLSetNativeCgFragmentProgram( const void *header );
|
||||
|
||||
GLboolean _RGLTryResizeTileRegion( GLuint address, GLuint size, void* data );
|
||||
void _RGLGetTileRegionInfo( void* data, GLuint *address, GLuint *size );
|
||||
|
||||
static inline GLuint _RGLPlatformGetBitsPerPixel( GLenum internalFormat )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user