mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-24 16:39:43 +00:00
(RGL) More cleanups pt. 5
This commit is contained in:
parent
e1314a6d32
commit
4382875749
@ -178,7 +178,7 @@ extern PSGLdeviceParameters * rglShadowDeviceParameters (void);
|
||||
//----------------------------------------
|
||||
// Device/.../PlatformDevice.c
|
||||
//----------------------------------------
|
||||
extern GLboolean rglPlatformDeviceInit (PSGLinitOptions* options);
|
||||
extern GLboolean rglPlatformDeviceInit (void *data);
|
||||
extern void rglPlatformDeviceExit (void);
|
||||
extern int rglPlatformDeviceSize (void);
|
||||
extern int rglPlatformCreateDevice (void *data);
|
||||
|
@ -10,7 +10,7 @@ void rglGcmTransferData (GLuint dstId, GLuint dstIdOffset,
|
||||
GLint dstPitch, GLuint srcId, GLuint srcIdOffset,
|
||||
GLint srcPitch, GLint bytesPerRow, GLint rowCount);
|
||||
|
||||
int32_t rglOutOfSpaceCallback (struct CellGcmContextData* fifoContext, uint32_t spaceInWords);
|
||||
int32_t rglOutOfSpaceCallback (void *data, uint32_t spaceInWords);
|
||||
void rglGcmFifoGlSetRenderTarget (rglGcmRenderTargetEx const * const args);
|
||||
void rglpFifoGlFinish (void);
|
||||
void rglCreatePushBuffer (void *data);
|
||||
|
@ -194,7 +194,7 @@ static void gmmFreeFixed(uint8_t isTile, void *pBlock)
|
||||
}
|
||||
}
|
||||
|
||||
static void gmmDestroyFixedAllocator()
|
||||
static void gmmDestroyFixedAllocator (void)
|
||||
{
|
||||
if (pGmmFixedAllocData)
|
||||
{
|
||||
@ -215,32 +215,34 @@ static void gmmDestroyFixedAllocator()
|
||||
}
|
||||
}
|
||||
|
||||
static GmmBlock *gmmAllocFixedBlock()
|
||||
static GmmBlock *gmmAllocFixedBlock (void)
|
||||
{
|
||||
return (GmmBlock *)gmmAllocFixed(0);
|
||||
}
|
||||
|
||||
static void gmmFreeFixedBlock(GmmBlock *pBlock)
|
||||
static void gmmFreeFixedBlock (void *data)
|
||||
{
|
||||
GmmBlock *pBlock = (GmmBlock*)data;
|
||||
gmmFreeFixed(0, pBlock);
|
||||
}
|
||||
|
||||
static GmmTileBlock *gmmAllocFixedTileBlock()
|
||||
static GmmTileBlock *gmmAllocFixedTileBlock (void)
|
||||
{
|
||||
return (GmmTileBlock *)gmmAllocFixed(1);
|
||||
}
|
||||
|
||||
static void gmmFreeFixedTileBlock(GmmTileBlock *pTileBlock)
|
||||
static void gmmFreeFixedTileBlock (void *data)
|
||||
{
|
||||
GmmTileBlock *pTileBlock = (GmmTileBlock*)data;
|
||||
gmmFreeFixed(1, pTileBlock);
|
||||
}
|
||||
|
||||
void gmmPinAllocations()
|
||||
void gmmPinAllocations (void)
|
||||
{
|
||||
pinAllocations = 1;
|
||||
}
|
||||
|
||||
void gmmUnpinAllocations()
|
||||
void gmmUnpinAllocations (void)
|
||||
{
|
||||
pinAllocations = 0;
|
||||
}
|
||||
@ -293,23 +295,16 @@ uint32_t gmmInit(
|
||||
return gmmInitFixedAllocator();
|
||||
}
|
||||
|
||||
static inline void gmmWaitForSweep()
|
||||
static inline void gmmWaitForSweep (void)
|
||||
{
|
||||
do
|
||||
while (cachedLockValue != 0)
|
||||
{
|
||||
if (cachedLockValue == 0)
|
||||
break;
|
||||
|
||||
cachedLockValue = *pLock;
|
||||
|
||||
if (cachedLockValue == 0)
|
||||
break;
|
||||
|
||||
sys_timer_usleep(30);
|
||||
}while(1);
|
||||
cachedLockValue = *pLock;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t gmmDestroy()
|
||||
uint32_t gmmDestroy (void)
|
||||
{
|
||||
GmmBlock *pBlock, *pTmpBlock;
|
||||
GmmTileBlock *pTileBlock, *pTmpTileBlock;
|
||||
@ -555,10 +550,9 @@ static GmmTileBlock *gmmCreateTileBlock(
|
||||
return pNewBlock;
|
||||
}
|
||||
|
||||
static void gmmFreeTileBlock(
|
||||
GmmTileBlock *pTileBlock
|
||||
)
|
||||
static void gmmFreeTileBlock (void *data)
|
||||
{
|
||||
GmmTileBlock *pTileBlock = (GmmTileBlock*)data;
|
||||
GmmAllocator *pAllocator;
|
||||
|
||||
if (pTileBlock->pPrev)
|
||||
@ -2019,8 +2013,10 @@ enable: 0,
|
||||
static int rglInitCompleted = 0;
|
||||
int _getJsInitCompleted(){ return rglInitCompleted; } // accessor
|
||||
|
||||
void rglPsglPlatformInit( RGLinitOptions* options )
|
||||
void rglPsglPlatformInit (void *data)
|
||||
{
|
||||
RGLinitOptions *options = (RGLinitOptions*)data;
|
||||
|
||||
if ( !rglInitCompleted )
|
||||
{
|
||||
int ret = cellSysmoduleLoadModule( CELL_SYSMODULE_GCM_SYS );
|
||||
@ -2085,9 +2081,10 @@ RGL_EXPORT RGLdevice* rglPlatformCreateDeviceAuto( GLenum colorFormat, GLenum de
|
||||
return psglCreateDeviceExtended( ¶meters );
|
||||
}
|
||||
|
||||
RGL_EXPORT RGLdevice* rglPlatformCreateDeviceExtended( const RGLdeviceParameters *parameters )
|
||||
RGL_EXPORT RGLdevice* rglPlatformCreateDeviceExtended (const void *data)
|
||||
{
|
||||
RGLdevice *device = ( RGLdevice * )malloc( sizeof( RGLdevice ) + rglPlatformDeviceSize() );
|
||||
RGLdeviceParameters *parameters = (RGLdeviceParameters*)data;
|
||||
RGLdevice *device = (RGLdevice*)malloc( sizeof( RGLdevice ) + rglPlatformDeviceSize() );
|
||||
if ( !device )
|
||||
{
|
||||
rglSetError( GL_OUT_OF_MEMORY );
|
||||
@ -2163,8 +2160,9 @@ RGL_EXPORT RGLdevice* rglPlatformCreateDeviceExtended( const RGLdeviceParameters
|
||||
return device;
|
||||
}
|
||||
|
||||
RGL_EXPORT GLfloat rglPlatformGetDeviceAspectRatio( const RGLdevice * device )
|
||||
RGL_EXPORT GLfloat rglPlatformGetDeviceAspectRatio (const void *data)
|
||||
{
|
||||
const RGLdevice *device = (const RGLdevice*)data;
|
||||
CellVideoOutState videoState;
|
||||
cellVideoOutGetState(CELL_VIDEO_OUT_PRIMARY, 0, &videoState);
|
||||
|
||||
@ -2211,10 +2209,9 @@ RGL_EXPORT GLfloat rglPlatformGetDeviceAspectRatio( const RGLdevice * device )
|
||||
#define RGLGCM_CONTEXT_2D_SURFACE 0xBBBB2000
|
||||
#define RGLGCM_CONTEXT_SWIZ_SURFACE 0xBBBB2001
|
||||
|
||||
int32_t rglOutOfSpaceCallback( struct CellGcmContextData* fifoContext, uint32_t spaceInWords )
|
||||
int32_t rglOutOfSpaceCallback (void *data, uint32_t spaceInWords)
|
||||
{
|
||||
// NOTE the fifo passed in is our very own rglGcmFifo.fifo
|
||||
// but let's just make sure
|
||||
struct CellGcmContextData *fifoContext = (struct CellGcmContextData*)data;
|
||||
rglGcmFifo * fifo = &rglGcmState_i.fifo;
|
||||
|
||||
// make sure that the space requested will actually fit in to
|
||||
@ -2416,8 +2413,9 @@ void rglGcmTiledMemoryInit( void )
|
||||
retVal = cellGcmUnbindTile( i );
|
||||
}
|
||||
|
||||
GLboolean rglPlatformDeviceInit( RGLinitOptions* options )
|
||||
GLboolean rglPlatformDeviceInit (void *data)
|
||||
{
|
||||
RGLinitOptions *options = (RGLinitOptions*)data;
|
||||
GLuint fifoSize = RGLGCM_FIFO_SIZE_DEFAULT;
|
||||
GLuint hostSize = RGLGCM_HOST_SIZE_DEFAULT;
|
||||
|
||||
@ -2439,14 +2437,14 @@ GLboolean rglPlatformDeviceInit( RGLinitOptions* options )
|
||||
}
|
||||
|
||||
|
||||
void rglPlatformDeviceExit()
|
||||
void rglPlatformDeviceExit (void)
|
||||
{
|
||||
rglGcmDestroy();
|
||||
rglGcmDestroyRM( &rglGcmResource );
|
||||
}
|
||||
|
||||
|
||||
int rglPlatformDeviceSize()
|
||||
int rglPlatformDeviceSize (void)
|
||||
{
|
||||
return sizeof( rglGcmDevice );
|
||||
}
|
||||
|
@ -53,16 +53,18 @@ CGprofile rglpGetLatestProfile( CGGLenum profile_type )
|
||||
|
||||
// uploads the given fp shader to gpu memory. Allocates if needed.
|
||||
// This also builds the shared constants push buffer if needed, since it depends on the load address
|
||||
static int rglpsLoadFPShader( _CGprogram *program )
|
||||
static int rglpsLoadFPShader (void *data)
|
||||
{
|
||||
_CGprogram *program = (_CGprogram*)data;
|
||||
unsigned int ucodeSize = program->header.instructionCount * 16;
|
||||
|
||||
if ( program->loadProgramId == GMM_ERROR )
|
||||
{
|
||||
program->loadProgramId = gmmAlloc((CellGcmContextData*)&rglGcmState_i.fifo,
|
||||
CELL_GCM_LOCATION_LOCAL, 0, ucodeSize);
|
||||
program->loadProgramOffset = 0;
|
||||
}
|
||||
// always upload shader
|
||||
|
||||
rglGcmSend( program->loadProgramId, program->loadProgramOffset, 0, ( char* )program->ucode, ucodeSize );
|
||||
return GL_TRUE;
|
||||
}
|
||||
@ -79,10 +81,10 @@ static void rglpsUnloadFPShader(_CGprogram *program)
|
||||
|
||||
//new binary addition
|
||||
|
||||
int rglGcmGenerateProgram( _CGprogram *program, int profileIndex, const CgProgramHeader *programHeader, const void *ucode, const CgParameterTableHeader *parameterHeader,
|
||||
int rglGcmGenerateProgram (void *data, int profileIndex, const CgProgramHeader *programHeader, const void *ucode, const CgParameterTableHeader *parameterHeader,
|
||||
const CgParameterEntry *parameterEntries, const char *stringTable, const float *defaultValues )
|
||||
{
|
||||
// validate the input
|
||||
_CGprogram *program = (_CGprogram*)data;
|
||||
CGprofile profile = ( CGprofile )programHeader->profile;
|
||||
|
||||
int need_swapping = 0;
|
||||
@ -416,13 +418,13 @@ void rglCgDestroyProgramGroup( CGprogramGroup group )
|
||||
free( _group );
|
||||
}
|
||||
|
||||
const char *rglCgGetProgramGroupName( CGprogramGroup group )
|
||||
const char *rglCgGetProgramGroupName (CGprogramGroup group)
|
||||
{
|
||||
_CGprogramGroup *_group = ( _CGprogramGroup * )group;
|
||||
return _group->name;
|
||||
}
|
||||
|
||||
int rglCgGetProgramIndex( CGprogramGroup group, const char *name )
|
||||
int rglCgGetProgramIndex (CGprogramGroup group, const char *name)
|
||||
{
|
||||
int i;
|
||||
for ( i = 0;i < ( int )group->programCount;i++ )
|
||||
@ -433,9 +435,10 @@ int rglCgGetProgramIndex( CGprogramGroup group, const char *name )
|
||||
return -1;
|
||||
}
|
||||
|
||||
void rglpProgramErase( _CGprogram* platformProgram )
|
||||
void rglpProgramErase (void *data)
|
||||
{
|
||||
_CGprogram* program = ( _CGprogram* )platformProgram;
|
||||
_CGprogram* platformProgram = (_CGprogram*)data;
|
||||
_CGprogram* program = (_CGprogram*)platformProgram;
|
||||
|
||||
if ( program->loadProgramId != GMM_ERROR )
|
||||
rglpsUnloadFPShader( program );
|
||||
@ -471,8 +474,10 @@ void rglpProgramErase( _CGprogram* platformProgram )
|
||||
}
|
||||
|
||||
//TODO: use a ref mechanism for the string table or duplicate it !
|
||||
int rglpCopyProgram( _CGprogram* source, _CGprogram* destination )
|
||||
int rglpCopyProgram (void *src_data, void *dst_data)
|
||||
{
|
||||
_CGprogram *source = (_CGprogram*)src_data;
|
||||
_CGprogram *destination = (_CGprogram*)dst_data;
|
||||
//extract the layout of the parameter buffers from the source
|
||||
CgParameterTableHeader parameterHeader;
|
||||
parameterHeader.entryCount = source->rtParametersCount;
|
||||
@ -502,21 +507,20 @@ int rglpCopyProgram( _CGprogram* source, _CGprogram* destination )
|
||||
return rglGcmGenerateProgram( destination, profileIndex, &source->header, source->ucode, ¶meterHeader, source->parametersEntries, source->stringTable, source->defaultValues );
|
||||
}
|
||||
|
||||
int rglpGenerateVertexProgram( _CGprogram *program,
|
||||
const CgProgramHeader *programHeader, const void *ucode,
|
||||
const CgParameterTableHeader *parameterHeader, const char *stringTable,
|
||||
int rglpGenerateVertexProgram (void *data, const CgProgramHeader *programHeader,
|
||||
const void *ucode, const CgParameterTableHeader *parameterHeader, const char *stringTable,
|
||||
const float *defaultValues )
|
||||
{
|
||||
// we currently have the same interface for vertex and fragment programs.
|
||||
_CGprogram *program = (_CGprogram*)data;
|
||||
return rglGcmGenerateProgram( program, VERTEX_PROFILE_INDEX, programHeader,
|
||||
ucode, parameterHeader, NULL, stringTable, defaultValues );
|
||||
|
||||
}
|
||||
|
||||
int rglpGenerateFragmentProgram( _CGprogram *program, const CgProgramHeader *programHeader, const void *ucode,
|
||||
int rglpGenerateFragmentProgram (void *data, const CgProgramHeader *programHeader, const void *ucode,
|
||||
const CgParameterTableHeader *parameterHeader, const char *stringTable, const float *defaultValues )
|
||||
{
|
||||
// we currently have the same interface for vertex and fragment programs.
|
||||
_CGprogram *program = (_CGprogram*)data;
|
||||
return rglGcmGenerateProgram( program, FRAGMENT_PROFILE_INDEX, programHeader, ucode, parameterHeader, NULL, stringTable, defaultValues );
|
||||
|
||||
}
|
||||
|
@ -29,11 +29,11 @@
|
||||
|
||||
#include <Cg/CgCommon.h>
|
||||
|
||||
void rglPsglPlatformInit( RGLinitOptions* options );
|
||||
void rglPsglPlatformExit(void);
|
||||
void rglPsglPlatformInit (void *data);
|
||||
void rglPsglPlatformExit (void);
|
||||
|
||||
RGL_EXPORT RGLdevice* rglPlatformCreateDeviceAuto( GLenum colorFormat, GLenum depthFormat, GLenum multisamplingMode );
|
||||
RGL_EXPORT RGLdevice* rglPlatformCreateDeviceExtended( const RGLdeviceParameters *parameters );
|
||||
RGL_EXPORT GLfloat rglPlatformGetDeviceAspectRatio( const RGLdevice * device );
|
||||
RGL_EXPORT RGLdevice* rglPlatformCreateDeviceExtended (const void *data);
|
||||
RGL_EXPORT GLfloat rglPlatformGetDeviceAspectRatio (const void *data);
|
||||
|
||||
#endif
|
||||
|
@ -81,13 +81,13 @@ typedef struct
|
||||
extern CGbool rglpSupportsVertexProgram( CGprofile p );
|
||||
extern CGbool rglpSupportsFragmentProgram( CGprofile p );
|
||||
extern CGprofile rglpGetLatestProfile( CGGLenum profile_type );
|
||||
extern int rglpCopyProgram( _CGprogram* source, _CGprogram* destination );
|
||||
extern int rglpGenerateFragmentProgram( _CGprogram *program,
|
||||
extern int rglpCopyProgram (void *src_data, void *dst_data);
|
||||
extern int rglpGenerateFragmentProgram (void *data,
|
||||
const CgProgramHeader *programHeader, const void *ucode,
|
||||
const CgParameterTableHeader *parameterHeader,
|
||||
const char *stringTable, const float *defaultValues );
|
||||
|
||||
extern int rglpGenerateVertexProgram( _CGprogram *program,
|
||||
extern int rglpGenerateVertexProgram (void *data,
|
||||
const CgProgramHeader *programHeader, const void *ucode,
|
||||
const CgParameterTableHeader *parameterHeader, const char *stringTable,
|
||||
const float *defaultValues );
|
||||
@ -95,7 +95,7 @@ extern int rglpGenerateVertexProgram( _CGprogram *program,
|
||||
extern CGprogram rglpCgUpdateProgramAtIndex( CGprogramGroup group, int index,
|
||||
int refcount );
|
||||
|
||||
extern void rglpProgramErase( _CGprogram* prog );
|
||||
extern void rglpProgramErase (void *data);
|
||||
|
||||
extern bool cgOpenElf( const void *ptr, size_t size, CGELFBinary *elfBinary );
|
||||
extern bool cgGetElfProgramByIndex( CGELFBinary *elfBinary, int index, CGELFProgram *elfProgram );
|
||||
|
Loading…
Reference in New Issue
Block a user