mirror of
https://github.com/libretro/RetroArch
synced 2025-04-16 08:43:10 +00:00
(RGL PS3) Main memory is not managed
This commit is contained in:
parent
fcfaaa7c55
commit
b4721106f6
@ -166,7 +166,6 @@ extern "C" {
|
|||||||
RGL::Vector<rglFramebuffer *> framebuffers;
|
RGL::Vector<rglFramebuffer *> framebuffers;
|
||||||
|
|
||||||
GLuint imageCount;
|
GLuint imageCount;
|
||||||
GLuint faceCount;
|
|
||||||
rglImage* image;
|
rglImage* image;
|
||||||
void * platformTexture[]; // C99 flexible array member
|
void * platformTexture[]; // C99 flexible array member
|
||||||
} rglTexture;
|
} rglTexture;
|
||||||
|
@ -50,7 +50,6 @@ typedef struct GmmFixedAllocData{
|
|||||||
typedef struct GmmBaseBlock{
|
typedef struct GmmBaseBlock{
|
||||||
|
|
||||||
uint8_t isTile;
|
uint8_t isTile;
|
||||||
//uint8_t isMain;
|
|
||||||
uint32_t address;
|
uint32_t address;
|
||||||
uint32_t size;
|
uint32_t size;
|
||||||
}GmmBaseBlock;
|
}GmmBaseBlock;
|
||||||
@ -110,10 +109,7 @@ typedef struct GmmAllocator{
|
|||||||
uint32_t gmmInit(
|
uint32_t gmmInit(
|
||||||
const void *localMemoryBase,
|
const void *localMemoryBase,
|
||||||
const void *localStartAddress,
|
const void *localStartAddress,
|
||||||
const uint32_t localSize,
|
const uint32_t localSize
|
||||||
const void *mainMemoryBase,
|
|
||||||
const void *mainStartAddress,
|
|
||||||
const uint32_t mainSize
|
|
||||||
);
|
);
|
||||||
|
|
||||||
uint32_t gmmDestroy(void);
|
uint32_t gmmDestroy(void);
|
||||||
@ -129,21 +125,13 @@ uint32_t gmmFPOffsetToId(
|
|||||||
void gmmPinId (const uint32_t id);
|
void gmmPinId (const uint32_t id);
|
||||||
void gmmUnpinId (const uint32_t id);
|
void gmmUnpinId (const uint32_t id);
|
||||||
uint32_t gmmFree (const uint32_t freeId);
|
uint32_t gmmFree (const uint32_t freeId);
|
||||||
void gmmUpdateFreeList (const uint8_t location);
|
|
||||||
|
|
||||||
uint32_t gmmAlloc(
|
uint32_t gmmAlloc(
|
||||||
void *data,
|
void *data,
|
||||||
const uint8_t location,
|
|
||||||
const uint8_t isTile,
|
const uint8_t isTile,
|
||||||
const uint32_t size
|
const uint32_t size
|
||||||
);
|
);
|
||||||
|
|
||||||
uint32_t gmmAllocExtendedTileBlock(
|
|
||||||
const uint8_t location,
|
|
||||||
const uint32_t size,
|
|
||||||
const uint32_t tag
|
|
||||||
);
|
|
||||||
|
|
||||||
uint32_t gmmGetBlockSize (const uint32_t id);
|
uint32_t gmmGetBlockSize (const uint32_t id);
|
||||||
|
|
||||||
void gmmSetTileAttrib(
|
void gmmSetTileAttrib(
|
||||||
|
@ -230,22 +230,16 @@ static void gmmFreeFixedTileBlock (void *data)
|
|||||||
uint32_t gmmInit(
|
uint32_t gmmInit(
|
||||||
const void *localMemoryBase,
|
const void *localMemoryBase,
|
||||||
const void *localStartAddress,
|
const void *localStartAddress,
|
||||||
const uint32_t localSize,
|
const uint32_t localSize
|
||||||
const void *mainMemoryBase,
|
|
||||||
const void *mainStartAddress,
|
|
||||||
const uint32_t mainSize
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
GmmAllocator *pAllocator;
|
GmmAllocator *pAllocator;
|
||||||
uint32_t alignedLocalSize, alignedMainSize;
|
uint32_t alignedLocalSize, alignedMainSize;
|
||||||
uint32_t localEndAddress = (uint32_t)localStartAddress + localSize;
|
uint32_t localEndAddress = (uint32_t)localStartAddress + localSize;
|
||||||
uint32_t mainEndAddress = (uint32_t)mainStartAddress + mainSize;
|
|
||||||
|
|
||||||
localEndAddress = (localEndAddress / GMM_TILE_ALIGNMENT) * GMM_TILE_ALIGNMENT;
|
localEndAddress = (localEndAddress / GMM_TILE_ALIGNMENT) * GMM_TILE_ALIGNMENT;
|
||||||
mainEndAddress = (mainEndAddress / GMM_TILE_ALIGNMENT) * GMM_TILE_ALIGNMENT;
|
|
||||||
|
|
||||||
alignedLocalSize = localEndAddress - (uint32_t)localStartAddress;
|
alignedLocalSize = localEndAddress - (uint32_t)localStartAddress;
|
||||||
alignedMainSize = mainEndAddress - (uint32_t)mainStartAddress;
|
|
||||||
|
|
||||||
pAllocator = (GmmAllocator *)malloc(2*sizeof(GmmAllocator));
|
pAllocator = (GmmAllocator *)malloc(2*sizeof(GmmAllocator));
|
||||||
|
|
||||||
@ -562,11 +556,7 @@ static void gmmFreeTileBlock (void *data)
|
|||||||
gmmFreeFixedTileBlock(pTileBlock);
|
gmmFreeFixedTileBlock(pTileBlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t gmmAllocExtendedTileBlock(
|
static uint32_t gmmAllocExtendedTileBlock(const uint32_t size, const uint32_t tag)
|
||||||
const uint8_t location,
|
|
||||||
const uint32_t size,
|
|
||||||
const uint32_t tag
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
GmmAllocator *pAllocator;
|
GmmAllocator *pAllocator;
|
||||||
uint32_t retId = 0;
|
uint32_t retId = 0;
|
||||||
@ -973,7 +963,7 @@ static inline void gmmMemcpy(void *data, const uint8_t mode,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t gmmInternalSweep(void *data, const uint8_t location)
|
static uint8_t gmmInternalSweep(void *data)
|
||||||
{
|
{
|
||||||
CellGcmContextData *thisContext = (CellGcmContextData*)data;
|
CellGcmContextData *thisContext = (CellGcmContextData*)data;
|
||||||
GmmAllocator *pAllocator = pGmmLocalAllocator;
|
GmmAllocator *pAllocator = pGmmLocalAllocator;
|
||||||
@ -1168,30 +1158,7 @@ static void gmmRemovePendingFree (GmmAllocator *pAllocator,
|
|||||||
pBlock->pPrevFree->pNextFree = pBlock->pNextFree;
|
pBlock->pPrevFree->pNextFree = pBlock->pNextFree;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gmmUpdateFreeList(const uint8_t location)
|
static void gmmFreeAll(void)
|
||||||
{
|
|
||||||
const uint32_t fence = rglGcmState_i.semaphores->userSemaphores[RGLGCM_SEMA_FENCE].val;
|
|
||||||
GmmBlock *pBlock = NULL;
|
|
||||||
GmmBlock *pTemp = NULL;
|
|
||||||
GmmAllocator *pAllocator = pGmmLocalAllocator;
|
|
||||||
|
|
||||||
pBlock = pAllocator->pPendingFreeHead;
|
|
||||||
|
|
||||||
while (pBlock)
|
|
||||||
{
|
|
||||||
pTemp = pBlock->pNextFree;
|
|
||||||
|
|
||||||
if ( !(( fence - pBlock->fence ) & 0x80000000 ) )
|
|
||||||
{
|
|
||||||
gmmRemovePendingFree(pAllocator, pBlock);
|
|
||||||
gmmAddFree(pAllocator, pBlock);
|
|
||||||
}
|
|
||||||
|
|
||||||
pBlock = pTemp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void gmmFreeAll(const uint8_t location)
|
|
||||||
{
|
{
|
||||||
GmmBlock *pBlock;
|
GmmBlock *pBlock;
|
||||||
GmmBlock *pTemp;
|
GmmBlock *pTemp;
|
||||||
@ -1221,12 +1188,12 @@ static void gmmFreeAll(const uint8_t location)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gmmAllocSweep(void *data, const uint8_t location)
|
static void gmmAllocSweep(void *data)
|
||||||
{
|
{
|
||||||
CellGcmContextData *thisContext = (CellGcmContextData*)data;
|
CellGcmContextData *thisContext = (CellGcmContextData*)data;
|
||||||
gmmFreeAll(location);
|
gmmFreeAll();
|
||||||
|
|
||||||
if (gmmInternalSweep(thisContext, location))
|
if (gmmInternalSweep(thisContext))
|
||||||
{
|
{
|
||||||
*pLock = 1;
|
*pLock = 1;
|
||||||
cachedLockValue = 1;
|
cachedLockValue = 1;
|
||||||
@ -1331,7 +1298,7 @@ static uint32_t gmmFindFreeBlock(
|
|||||||
return retId;
|
return retId;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t gmmAlloc(void *data, const uint8_t location,
|
uint32_t gmmAlloc(void *data,
|
||||||
const uint8_t isTile, const uint32_t size)
|
const uint8_t isTile, const uint32_t size)
|
||||||
{
|
{
|
||||||
CellGcmContextData *thisContext = (CellGcmContextData*)data;
|
CellGcmContextData *thisContext = (CellGcmContextData*)data;
|
||||||
@ -1364,7 +1331,7 @@ uint32_t gmmAlloc(void *data, const uint8_t location,
|
|||||||
|
|
||||||
if (retId == GMM_ERROR)
|
if (retId == GMM_ERROR)
|
||||||
{
|
{
|
||||||
gmmAllocSweep(thisContext, location);
|
gmmAllocSweep(thisContext);
|
||||||
|
|
||||||
retId = gmmInternalAlloc(pAllocator,
|
retId = gmmInternalAlloc(pAllocator,
|
||||||
isTile,
|
isTile,
|
||||||
@ -1704,10 +1671,7 @@ GLboolean rglGcmInit (void *opt_data, void *res_data)
|
|||||||
|
|
||||||
if ( gmmInit( resource->localAddress, // pass in the base address, which "could" diff from start address
|
if ( gmmInit( resource->localAddress, // pass in the base address, which "could" diff from start address
|
||||||
resource->localAddress,
|
resource->localAddress,
|
||||||
resource->localSize,
|
resource->localSize) == GMM_ERROR )
|
||||||
resource->hostMemoryBase, // pass in the base address
|
|
||||||
resource->hostMemoryBase + resource->hostMemoryReserved,
|
|
||||||
resource->hostMemorySize - resource->hostMemoryReserved ) == GMM_ERROR )
|
|
||||||
{
|
{
|
||||||
fprintf( stderr, "Could not init GPU memory manager" );
|
fprintf( stderr, "Could not init GPU memory manager" );
|
||||||
rglGcmDestroy();
|
rglGcmDestroy();
|
||||||
@ -1806,9 +1770,7 @@ void rglGcmSend( unsigned int dstId, unsigned dstOffset, unsigned int pitch,
|
|||||||
{
|
{
|
||||||
// try allocating the whole block in the bounce buffer
|
// try allocating the whole block in the bounce buffer
|
||||||
GLuint id = gmmAlloc((CellGcmContextData*)&rglGcmState_i.fifo,
|
GLuint id = gmmAlloc((CellGcmContextData*)&rglGcmState_i.fifo,
|
||||||
CELL_GCM_LOCATION_LOCAL,
|
0, size);
|
||||||
0,
|
|
||||||
size);
|
|
||||||
|
|
||||||
memcpy( gmmIdToAddress(id), src, size );
|
memcpy( gmmIdToAddress(id), src, size );
|
||||||
rglGcmMemcpy( dstId, dstOffset, pitch, id, 0, size );
|
rglGcmMemcpy( dstId, dstOffset, pitch, id, 0, size );
|
||||||
@ -2256,9 +2218,7 @@ typedef struct
|
|||||||
GLuint offset;
|
GLuint offset;
|
||||||
GLuint size; // 0 size indicates an unused tile
|
GLuint size; // 0 size indicates an unused tile
|
||||||
GLuint pitch; // in bytes
|
GLuint pitch; // in bytes
|
||||||
GLenum compression;
|
|
||||||
GLuint bank;
|
GLuint bank;
|
||||||
GLuint memory; // 0 for GPU, 1 for host
|
|
||||||
} rglTiledRegion;
|
} rglTiledRegion;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@ -2395,8 +2355,6 @@ GLboolean rglGcmTryResizeTileRegion( GLuint address, GLuint size, void* data )
|
|||||||
region->offset = 0;
|
region->offset = 0;
|
||||||
region->size = 0;
|
region->size = 0;
|
||||||
region->pitch = 0;
|
region->pitch = 0;
|
||||||
region->compression = CELL_GCM_COMPMODE_DISABLED;
|
|
||||||
region->memory = 0;
|
|
||||||
|
|
||||||
if ( ! rglDuringDestroyDevice )
|
if ( ! rglDuringDestroyDevice )
|
||||||
{
|
{
|
||||||
@ -2416,7 +2374,7 @@ GLboolean rglGcmTryResizeTileRegion( GLuint address, GLuint size, void* data )
|
|||||||
|
|
||||||
retVal = cellGcmSetTileInfo(
|
retVal = cellGcmSetTileInfo(
|
||||||
region->id,
|
region->id,
|
||||||
region->memory,
|
CELL_GCM_LOCATION_LOCAL,
|
||||||
region->offset,
|
region->offset,
|
||||||
region->size,
|
region->size,
|
||||||
region->pitch,
|
region->pitch,
|
||||||
@ -2442,14 +2400,11 @@ void rglGcmGetTileRegionInfo( void* data, GLuint *address, GLuint *size )
|
|||||||
#define RGLGCM_TILED_BUFFER_HEIGHT_ALIGNMENT 64
|
#define RGLGCM_TILED_BUFFER_HEIGHT_ALIGNMENT 64
|
||||||
|
|
||||||
GLuint rglGcmAllocCreateRegion(
|
GLuint rglGcmAllocCreateRegion(
|
||||||
uint8_t memoryLocation,
|
|
||||||
GLboolean isZBuffer,
|
|
||||||
GLuint size,
|
GLuint size,
|
||||||
GLint tag,
|
GLint tag,
|
||||||
void* data )
|
void* data )
|
||||||
{
|
{
|
||||||
uint32_t id = gmmAlloc((CellGcmContextData*)&rglGcmState_i.fifo,
|
uint32_t id = gmmAlloc((CellGcmContextData*)&rglGcmState_i.fifo, 1, size);
|
||||||
memoryLocation, 1, size);
|
|
||||||
|
|
||||||
if ( id != GMM_ERROR )
|
if ( id != GMM_ERROR )
|
||||||
{
|
{
|
||||||
@ -2470,21 +2425,14 @@ GLuint rglGcmAllocCreateRegion(
|
|||||||
|
|
||||||
static void rglGcmAllocateTiledSurface(
|
static void rglGcmAllocateTiledSurface(
|
||||||
rglTiledMemoryManager* mm,
|
rglTiledMemoryManager* mm,
|
||||||
GLboolean isLocalMemory,
|
|
||||||
GLboolean isZBuffer,
|
|
||||||
GLuint width,
|
GLuint width,
|
||||||
GLuint height,
|
GLuint height,
|
||||||
GLuint bitsPerPixel,
|
GLuint bitsPerPixel,
|
||||||
GLuint antiAliasing,
|
GLuint antiAliasing,
|
||||||
GLenum compression,
|
|
||||||
GLuint* id,
|
GLuint* id,
|
||||||
GLuint* pitchAllocated,
|
GLuint* pitchAllocated,
|
||||||
GLuint* bytesAllocated )
|
GLuint* bytesAllocated )
|
||||||
{
|
{
|
||||||
// XXX no compression on A01 silicon
|
|
||||||
// also disabled it if not on local memory
|
|
||||||
compression = CELL_GCM_COMPMODE_DISABLED;
|
|
||||||
|
|
||||||
// determine pitch (in bytes)
|
// determine pitch (in bytes)
|
||||||
const unsigned int pitch = width * bitsPerPixel / 8;
|
const unsigned int pitch = width * bitsPerPixel / 8;
|
||||||
const unsigned int tiledPitch = findValidPitch( pitch );
|
const unsigned int tiledPitch = findValidPitch( pitch );
|
||||||
@ -2514,11 +2462,9 @@ static void rglGcmAllocateTiledSurface(
|
|||||||
|
|
||||||
// attempt to extend an existing region
|
// attempt to extend an existing region
|
||||||
// The region tag is a hash of the pitch, compression, and isZBuffer.
|
// The region tag is a hash of the pitch, compression, and isZBuffer.
|
||||||
const GLuint tag = *pitchAllocated | compression | ( isZBuffer ? 0x80000000 : 0x0 );
|
const GLuint tag = *pitchAllocated | 0;
|
||||||
|
|
||||||
*id = gmmAllocExtendedTileBlock(CELL_GCM_LOCATION_LOCAL,
|
*id = gmmAllocExtendedTileBlock(*bytesAllocated, tag);
|
||||||
*bytesAllocated,
|
|
||||||
tag);
|
|
||||||
|
|
||||||
if ( *id == GMM_ERROR )
|
if ( *id == GMM_ERROR )
|
||||||
{
|
{
|
||||||
@ -2531,14 +2477,10 @@ static void rglGcmAllocateTiledSurface(
|
|||||||
// Address and size will be set in the callback.
|
// Address and size will be set in the callback.
|
||||||
mm->region[i].id = i;
|
mm->region[i].id = i;
|
||||||
mm->region[i].pitch = *pitchAllocated;
|
mm->region[i].pitch = *pitchAllocated;
|
||||||
mm->region[i].compression = compression;
|
mm->region[i].bank = 0x0; // XXX experiment
|
||||||
mm->region[i].bank = isZBuffer ? 0x3 : 0x0; // XXX experiment
|
|
||||||
mm->region[i].memory = CELL_GCM_LOCATION_LOCAL;
|
|
||||||
|
|
||||||
// allocate space for our region
|
// allocate space for our region
|
||||||
*id = rglGcmAllocCreateRegion(
|
*id = rglGcmAllocCreateRegion(
|
||||||
mm->region[i].memory,
|
|
||||||
isZBuffer,
|
|
||||||
*bytesAllocated,
|
*bytesAllocated,
|
||||||
tag,
|
tag,
|
||||||
&mm->region[i] );
|
&mm->region[i] );
|
||||||
@ -2564,7 +2506,6 @@ static void rglGcmAllocateTiledSurface(
|
|||||||
// color surface allocation
|
// color surface allocation
|
||||||
|
|
||||||
GLboolean rglGcmAllocateColorSurface(
|
GLboolean rglGcmAllocateColorSurface(
|
||||||
GLboolean isLocalMemory,
|
|
||||||
GLuint width,
|
GLuint width,
|
||||||
GLuint height,
|
GLuint height,
|
||||||
GLuint bitsPerPixel,
|
GLuint bitsPerPixel,
|
||||||
@ -2576,16 +2517,10 @@ GLboolean rglGcmAllocateColorSurface(
|
|||||||
{
|
{
|
||||||
rglTiledMemoryManager* mm = &rglGcmTiledMemoryManager;
|
rglTiledMemoryManager* mm = &rglGcmTiledMemoryManager;
|
||||||
|
|
||||||
// compression type depends on antialiasing
|
|
||||||
GLenum compression = CELL_GCM_COMPMODE_DISABLED;
|
|
||||||
|
|
||||||
rglGcmAllocateTiledSurface(
|
rglGcmAllocateTiledSurface(
|
||||||
mm,
|
mm,
|
||||||
isLocalMemory,
|
|
||||||
GL_FALSE, // not a z buffer
|
|
||||||
width, height, bitsPerPixel,
|
width, height, bitsPerPixel,
|
||||||
antiAliasing,
|
antiAliasing,
|
||||||
compression,
|
|
||||||
id,
|
id,
|
||||||
pitchAllocated,
|
pitchAllocated,
|
||||||
bytesAllocated );
|
bytesAllocated );
|
||||||
@ -2739,7 +2674,7 @@ static void rescInit( const RGLdeviceParameters* params, rglGcmDevice *gcmDevice
|
|||||||
GLuint size;
|
GLuint size;
|
||||||
GLuint colorBuffersPitch;
|
GLuint colorBuffersPitch;
|
||||||
uint32_t numColorBuffers = cellRescGetNumColorBuffers( dstBufferMode, ( CellRescPalTemporalMode )conf.palTemporalMode, 0 );
|
uint32_t numColorBuffers = cellRescGetNumColorBuffers( dstBufferMode, ( CellRescPalTemporalMode )conf.palTemporalMode, 0 );
|
||||||
result = rglGcmAllocateColorSurface( GL_TRUE, params->width, params->height * numColorBuffers,
|
result = rglGcmAllocateColorSurface(params->width, params->height * numColorBuffers,
|
||||||
4*8, RGLGCM_TRUE, 1, &(gcmDevice->RescColorBuffersId), &colorBuffersPitch, &size );
|
4*8, RGLGCM_TRUE, 1, &(gcmDevice->RescColorBuffersId), &colorBuffersPitch, &size );
|
||||||
|
|
||||||
// set the destination buffer format and pitch
|
// set the destination buffer format and pitch
|
||||||
@ -2753,9 +2688,9 @@ static void rescInit( const RGLdeviceParameters* params, rglGcmDevice *gcmDevice
|
|||||||
int32_t colorBuffersSize, vertexArraySize, fragmentShaderSize;
|
int32_t colorBuffersSize, vertexArraySize, fragmentShaderSize;
|
||||||
cellRescGetBufferSize( &colorBuffersSize, &vertexArraySize, &fragmentShaderSize );
|
cellRescGetBufferSize( &colorBuffersSize, &vertexArraySize, &fragmentShaderSize );
|
||||||
gcmDevice->RescVertexArrayId = gmmAlloc((CellGcmContextData*)&rglGcmState_i.fifo,
|
gcmDevice->RescVertexArrayId = gmmAlloc((CellGcmContextData*)&rglGcmState_i.fifo,
|
||||||
CELL_GCM_LOCATION_LOCAL, 0, vertexArraySize);
|
0, vertexArraySize);
|
||||||
gcmDevice->RescFragmentShaderId = gmmAlloc((CellGcmContextData*)&rglGcmState_i.fifo,
|
gcmDevice->RescFragmentShaderId = gmmAlloc((CellGcmContextData*)&rglGcmState_i.fifo,
|
||||||
CELL_GCM_LOCATION_LOCAL, 0, fragmentShaderSize);
|
0, fragmentShaderSize);
|
||||||
|
|
||||||
|
|
||||||
// tell resc how to access the destination (scanout) buffer
|
// tell resc how to access the destination (scanout) buffer
|
||||||
@ -2773,7 +2708,7 @@ static void rescInit( const RGLdeviceParameters* params, rglGcmDevice *gcmDevice
|
|||||||
const unsigned int tableLength = 32; // this was based on the guidelines in the resc reference guide
|
const unsigned int tableLength = 32; // this was based on the guidelines in the resc reference guide
|
||||||
unsigned int tableSize = sizeof(uint16_t) * 4 * tableLength; // 2 bytes per FLOAT16 * 4 values per entry * length of table
|
unsigned int tableSize = sizeof(uint16_t) * 4 * tableLength; // 2 bytes per FLOAT16 * 4 values per entry * length of table
|
||||||
void *interlaceTable = gmmIdToAddress(gmmAlloc((CellGcmContextData*)&rglGcmState_i.fifo,
|
void *interlaceTable = gmmIdToAddress(gmmAlloc((CellGcmContextData*)&rglGcmState_i.fifo,
|
||||||
CELL_GCM_LOCATION_LOCAL, 0, tableSize));
|
0, tableSize));
|
||||||
int32_t errorCode = cellRescCreateInterlaceTable(interlaceTable,params->renderHeight,CELL_RESC_ELEMENT_HALF,tableLength);
|
int32_t errorCode = cellRescCreateInterlaceTable(interlaceTable,params->renderHeight,CELL_RESC_ELEMENT_HALF,tableLength);
|
||||||
(void)errorCode;
|
(void)errorCode;
|
||||||
}
|
}
|
||||||
@ -2935,7 +2870,6 @@ int rglPlatformCreateDevice (void *data)
|
|||||||
// allocate tiled memory
|
// allocate tiled memory
|
||||||
GLuint size;
|
GLuint size;
|
||||||
result = rglGcmAllocateColorSurface(
|
result = rglGcmAllocateColorSurface(
|
||||||
GL_TRUE, // create in local memory
|
|
||||||
width, height, // dimensions
|
width, height, // dimensions
|
||||||
gcmDevice->color[i].bpp*8, // bits per sample
|
gcmDevice->color[i].bpp*8, // bits per sample
|
||||||
RGLGCM_TRUE, // scan out enable
|
RGLGCM_TRUE, // scan out enable
|
||||||
@ -3134,7 +3068,25 @@ void rglPlatformDestroyDevice (void *data)
|
|||||||
|
|
||||||
GLAPI void RGL_EXPORT psglSwap (void)
|
GLAPI void RGL_EXPORT psglSwap (void)
|
||||||
{
|
{
|
||||||
gmmUpdateFreeList(CELL_GCM_LOCATION_LOCAL);
|
const uint32_t fence = rglGcmState_i.semaphores->userSemaphores[RGLGCM_SEMA_FENCE].val;
|
||||||
|
GmmBlock *pBlock = NULL;
|
||||||
|
GmmBlock *pTemp = NULL;
|
||||||
|
GmmAllocator *pAllocator = pGmmLocalAllocator;
|
||||||
|
|
||||||
|
pBlock = pAllocator->pPendingFreeHead;
|
||||||
|
|
||||||
|
while (pBlock)
|
||||||
|
{
|
||||||
|
pTemp = pBlock->pNextFree;
|
||||||
|
|
||||||
|
if ( !(( fence - pBlock->fence ) & 0x80000000 ) )
|
||||||
|
{
|
||||||
|
gmmRemovePendingFree(pAllocator, pBlock);
|
||||||
|
gmmAddFree(pAllocator, pBlock);
|
||||||
|
}
|
||||||
|
|
||||||
|
pBlock = pTemp;
|
||||||
|
}
|
||||||
|
|
||||||
RGLdevice *device = (RGLdevice*)_CurrentDevice;
|
RGLdevice *device = (RGLdevice*)_CurrentDevice;
|
||||||
rglGcmDevice *gcmDevice = (rglGcmDevice *)device->platformDevice;
|
rglGcmDevice *gcmDevice = (rglGcmDevice *)device->platformDevice;
|
||||||
@ -4334,7 +4286,6 @@ rglTexture *rglAllocateTexture(void)
|
|||||||
texture->image = NULL;
|
texture->image = NULL;
|
||||||
texture->isComplete = GL_FALSE;
|
texture->isComplete = GL_FALSE;
|
||||||
texture->imageCount = 0;
|
texture->imageCount = 0;
|
||||||
texture->faceCount = 1;
|
|
||||||
texture->revalidate = 0;
|
texture->revalidate = 0;
|
||||||
texture->referenceBuffer = NULL;
|
texture->referenceBuffer = NULL;
|
||||||
new( &texture->framebuffers ) RGL::Vector<rglFramebuffer *>();
|
new( &texture->framebuffers ) RGL::Vector<rglFramebuffer *>();
|
||||||
@ -4487,10 +4438,7 @@ void rglBindTextureInternal (void *data, GLuint name, GLenum target )
|
|||||||
texture = ( rglTexture * )LContext->textureNameSpace.data[name];
|
texture = ( rglTexture * )LContext->textureNameSpace.data[name];
|
||||||
|
|
||||||
if (!texture->target)
|
if (!texture->target)
|
||||||
{
|
|
||||||
texture->target = target;
|
texture->target = target;
|
||||||
texture->faceCount = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unit->bound2D = name;
|
unit->bound2D = name;
|
||||||
|
@ -253,7 +253,7 @@ static int rglGcmGenerateProgram (void *data, int profileIndex, const CgProgramH
|
|||||||
if ( program->loadProgramId == GMM_ERROR )
|
if ( program->loadProgramId == GMM_ERROR )
|
||||||
{
|
{
|
||||||
program->loadProgramId = gmmAlloc((CellGcmContextData*)&rglGcmState_i.fifo,
|
program->loadProgramId = gmmAlloc((CellGcmContextData*)&rglGcmState_i.fifo,
|
||||||
CELL_GCM_LOCATION_LOCAL, 0, ucodeSize);
|
0, ucodeSize);
|
||||||
program->loadProgramOffset = 0;
|
program->loadProgramOffset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1108,7 +1108,7 @@ static void rglpsAllocateBuffer (void *data)
|
|||||||
// allocate in GPU memory
|
// allocate in GPU memory
|
||||||
rglBuffer->pool = RGLGCM_SURFACE_POOL_LINEAR;
|
rglBuffer->pool = RGLGCM_SURFACE_POOL_LINEAR;
|
||||||
rglBuffer->bufferId = gmmAlloc((CellGcmContextData*)&rglGcmState_i.fifo,
|
rglBuffer->bufferId = gmmAlloc((CellGcmContextData*)&rglGcmState_i.fifo,
|
||||||
CELL_GCM_LOCATION_LOCAL, 0, rglBuffer->bufferSize);
|
0, rglBuffer->bufferSize);
|
||||||
rglBuffer->pitch = 0;
|
rglBuffer->pitch = 0;
|
||||||
|
|
||||||
if ( rglBuffer->bufferId == GMM_ERROR )
|
if ( rglBuffer->bufferId == GMM_ERROR )
|
||||||
@ -1384,7 +1384,7 @@ GLAPI void APIENTRY glClear( GLbitfield mask )
|
|||||||
};
|
};
|
||||||
|
|
||||||
GLuint bufferId = gmmAlloc((CellGcmContextData*)&rglGcmState_i.fifo,
|
GLuint bufferId = gmmAlloc((CellGcmContextData*)&rglGcmState_i.fifo,
|
||||||
CELL_GCM_LOCATION_LOCAL, 0, sizeof(rglClearVertexBuffer));
|
0, sizeof(rglClearVertexBuffer));
|
||||||
|
|
||||||
__builtin_memcpy(gmmIdToAddress(bufferId), rglClearVertexBuffer, sizeof(rglClearVertexBuffer));
|
__builtin_memcpy(gmmIdToAddress(bufferId), rglClearVertexBuffer, sizeof(rglClearVertexBuffer));
|
||||||
rglGcmFifoGlVertexAttribPointer( 0, 3, RGLGCM_FLOAT, RGLGCM_FALSE, 3*sizeof( GLfloat ), 1, 0, gmmIdToOffset(bufferId) );
|
rglGcmFifoGlVertexAttribPointer( 0, 3, RGLGCM_FLOAT, RGLGCM_FALSE, 3*sizeof( GLfloat ), 1, 0, gmmIdToOffset(bufferId) );
|
||||||
@ -1627,7 +1627,7 @@ void *rglPlatformRasterInit (void)
|
|||||||
// [YLIN] Make it 16 byte align
|
// [YLIN] Make it 16 byte align
|
||||||
driver->sharedVPConstants = (char*)memalign(16, 4 * sizeof( float ) * RGL_MAX_VP_SHARED_CONSTANTS);
|
driver->sharedVPConstants = (char*)memalign(16, 4 * sizeof( float ) * RGL_MAX_VP_SHARED_CONSTANTS);
|
||||||
driver->sharedFPConstantsId = gmmAlloc((CellGcmContextData*)&rglGcmState_i.fifo,
|
driver->sharedFPConstantsId = gmmAlloc((CellGcmContextData*)&rglGcmState_i.fifo,
|
||||||
CELL_GCM_LOCATION_LOCAL, 0, 4 * sizeof(float) * RGL_MAX_FP_SHARED_CONSTANTS);
|
0, 4 * sizeof(float) * RGL_MAX_FP_SHARED_CONSTANTS);
|
||||||
|
|
||||||
return driver;
|
return driver;
|
||||||
}
|
}
|
||||||
@ -1974,7 +1974,7 @@ GLAPI void APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count)
|
|||||||
if ( RGL_UNLIKELY( dparams->xferTotalSize ) )
|
if ( RGL_UNLIKELY( dparams->xferTotalSize ) )
|
||||||
{
|
{
|
||||||
xferId = gmmAlloc((CellGcmContextData*)&rglGcmState_i.fifo,
|
xferId = gmmAlloc((CellGcmContextData*)&rglGcmState_i.fifo,
|
||||||
CELL_GCM_LOCATION_LOCAL, 0, dparams->xferTotalSize);
|
0, dparams->xferTotalSize);
|
||||||
xferBuffer = gmmIdToAddress(xferId);
|
xferBuffer = gmmIdToAddress(xferId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2366,7 +2366,7 @@ void rglPlatformReallocateGcmTexture (void *data)
|
|||||||
rglImage *image = texture->image + texture->baseLevel;
|
rglImage *image = texture->image + texture->baseLevel;
|
||||||
|
|
||||||
newLayout.levels = 1;
|
newLayout.levels = 1;
|
||||||
newLayout.faces = texture->faceCount;
|
newLayout.faces = 1;
|
||||||
newLayout.baseWidth = image->width;
|
newLayout.baseWidth = image->width;
|
||||||
newLayout.baseHeight = image->height;
|
newLayout.baseHeight = image->height;
|
||||||
newLayout.baseDepth = image->depth;
|
newLayout.baseDepth = image->depth;
|
||||||
@ -2396,9 +2396,8 @@ void rglPlatformReallocateGcmTexture (void *data)
|
|||||||
{
|
{
|
||||||
// allocate in the specified pool
|
// allocate in the specified pool
|
||||||
id = gmmAlloc((CellGcmContextData*)&rglGcmState_i.fifo,
|
id = gmmAlloc((CellGcmContextData*)&rglGcmState_i.fifo,
|
||||||
CELL_GCM_LOCATION_LOCAL,
|
0, size);
|
||||||
0,
|
|
||||||
size);
|
|
||||||
if ( id != GMM_ERROR )
|
if ( id != GMM_ERROR )
|
||||||
{
|
{
|
||||||
// drop old allocation
|
// drop old allocation
|
||||||
@ -2525,7 +2524,7 @@ source: RGLGCM_SURFACE_SOURCE_TEXTURE,
|
|||||||
// lazy allocation of bounce buffer
|
// lazy allocation of bounce buffer
|
||||||
if ( bounceBufferId == GMM_ERROR && layout->baseDepth == 1 )
|
if ( bounceBufferId == GMM_ERROR && layout->baseDepth == 1 )
|
||||||
bounceBufferId = gmmAlloc((CellGcmContextData*)&rglGcmState_i.fifo,
|
bounceBufferId = gmmAlloc((CellGcmContextData*)&rglGcmState_i.fifo,
|
||||||
CELL_GCM_LOCATION_LOCAL, 0, gcmTexture->gpuSize);
|
0, gcmTexture->gpuSize);
|
||||||
|
|
||||||
if ( bounceBufferId != GMM_ERROR )
|
if ( bounceBufferId != GMM_ERROR )
|
||||||
{
|
{
|
||||||
@ -2831,7 +2830,7 @@ GLAPI void APIENTRY glTextureReferenceSCE( GLenum target, GLuint levels,
|
|||||||
rglImage *image = texture->image + texture->baseLevel;
|
rglImage *image = texture->image + texture->baseLevel;
|
||||||
|
|
||||||
newLayout.levels = 1;
|
newLayout.levels = 1;
|
||||||
newLayout.faces = texture->faceCount;
|
newLayout.faces = 1;
|
||||||
newLayout.baseWidth = image->width;
|
newLayout.baseWidth = image->width;
|
||||||
newLayout.baseHeight = image->height;
|
newLayout.baseHeight = image->height;
|
||||||
newLayout.baseDepth = image->depth;
|
newLayout.baseDepth = image->depth;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user