diff --git a/Makefile.ps3.rgl b/Makefile.ps3.rgl index 10541eb7c8..28fa67103c 100644 --- a/Makefile.ps3.rgl +++ b/Makefile.ps3.rgl @@ -46,7 +46,7 @@ PPU_RANLIB = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ranlib.exe PPU_LDLIBS = -lio_stub -DEFINES += -D__CELLOS_LV2__ -DJS_PLATFORM_CELL +DEFINES += -D__CELLOS_LV2__ ifeq ($(DEBUG), 1) PPU_OPTIMIZE_LV := -O0 -g diff --git a/console/rgl/include/Cg/CgCommon.h b/console/rgl/include/Cg/CgCommon.h index f39a8cbc76..1a974d5af9 100644 --- a/console/rgl/include/Cg/CgCommon.h +++ b/console/rgl/include/Cg/CgCommon.h @@ -29,9 +29,9 @@ extern "C" #define RGL_BOOLEAN_REGISTERS_COUNT 32 // parameter setter, prototype of functions called when a uniform is set. - typedef void( *_cgSetFunction )( struct CgRuntimeParameter* _RGL_RESTRICT, const void* _RGL_RESTRICT ); + typedef void( *_cgSetFunction )( void *, const void* _RGL_RESTRICT ); - typedef void( *_cgSetArrayIndexFunction )( struct CgRuntimeParameter* _RGL_RESTRICT, const void* _RGL_RESTRICT, const int index ); + typedef void( *_cgSetArrayIndexFunction )( void *, const void*, const int index ); typedef struct _CgUniform { @@ -199,12 +199,12 @@ extern "C" RGL_EXPORT void rglCgProgramErase( _CGprogram* prog ); // default setters - void _cgRaiseInvalidParam( CgRuntimeParameter*p, const void*v ); - void _cgRaiseNotMatrixParam( CgRuntimeParameter*p, const void*v ); - void _cgIgnoreSetParam( CgRuntimeParameter*p, const void*v ); - void _cgRaiseInvalidParamIndex( CgRuntimeParameter*p, const void*v, const int index ); - void _cgRaiseNotMatrixParamIndex( CgRuntimeParameter*p, const void*v, const int index ); - void _cgIgnoreSetParamIndex( CgRuntimeParameter*p, const void*v, const int index ); + void _cgRaiseInvalidParam( void *data, const void*v ); + void _cgRaiseNotMatrixParam( void *data, const void*v ); + void _cgIgnoreSetParam( void *dat, const void*v ); + void _cgRaiseInvalidParamIndex( void *dat, const void*v, const int index ); + void _cgRaiseNotMatrixParamIndex( void *dat, const void*v, const int index ); + void _cgIgnoreSetParamIndex( void *dat, const void*v, const int index ); // cg helpers diff --git a/console/rgl/src/ps3/include/rgl-externs.h b/console/rgl/src/ps3/include/rgl-externs.h index 4998271652..da2d38778a 100644 --- a/console/rgl/src/ps3/include/rgl-externs.h +++ b/console/rgl/src/ps3/include/rgl-externs.h @@ -11,7 +11,7 @@ void rglGcmTransferData (GLuint dstId, GLuint dstIdOffset, GLint srcPitch, GLint bytesPerRow, GLint rowCount); int32_t rglOutOfSpaceCallback (void *data, uint32_t spaceInWords); -void rglGcmFifoGlSetRenderTarget (rglGcmRenderTargetEx const * const args); +void rglGcmFifoGlSetRenderTarget (const void *args); void rglpFifoGlFinish (void); void rglCreatePushBuffer (void *data); void rglSetDefaultValuesFP (void *data); diff --git a/console/rgl/src/ps3/rgl_ps3.cpp b/console/rgl/src/ps3/rgl_ps3.cpp index 5cf1273326..570ab93069 100644 --- a/console/rgl/src/ps3/rgl_ps3.cpp +++ b/console/rgl/src/ps3/rgl_ps3.cpp @@ -1006,33 +1006,22 @@ static inline void gmmMemcpy(void *data, const uint8_t mode, static uint8_t gmmInternalSweep(void *data, const uint8_t location) { CellGcmContextData *thisContext = (CellGcmContextData*)data; - GmmAllocator *pAllocator; - GmmBlock *pBlock; - GmmBlock *pSrcBlock; + GmmAllocator *pAllocator = pGmmLocalAllocator; + GmmBlock *pBlock = pAllocator->pSweepHead; + GmmBlock *pSrcBlock = pBlock; GmmBlock *pTempBlock; GmmBlock *pTempBlockNext; - uint32_t dstAddress, srcAddress; + uint32_t dstAddress = 0; + uint32_t srcAddress = 0; uint32_t srcOffset, dstOffset; - uint32_t prevEndAddress; + uint32_t prevEndAddress = 0; uint32_t moveSize, moveDistance; - uint8_t mode; + uint8_t mode = CELL_GCM_TRANSFER_LOCAL_TO_LOCAL; uint8_t ret = 0; uint32_t totalMoveSize = 0; - - pAllocator = pGmmLocalAllocator; - - mode = CELL_GCM_TRANSFER_LOCAL_TO_LOCAL; - - pBlock = pAllocator->pSweepHead; - srcAddress = 0; - dstAddress = 0; - prevEndAddress = 0; - pSrcBlock = pBlock; - while (pBlock != NULL) { - if (pBlock->isPinned == 0) { if (pBlock->pPrev) @@ -1197,10 +1186,8 @@ static uint8_t gmmInternalSweep(void *data, const uint8_t location) return ret; } -static void gmmRemovePendingFree( - GmmAllocator *pAllocator, - GmmBlock *pBlock - ) +static void gmmRemovePendingFree (GmmAllocator *pAllocator, + GmmBlock *pBlock) { if (pBlock == pAllocator->pPendingFreeHead) pAllocator->pPendingFreeHead = pBlock->pNextFree; @@ -1634,9 +1621,10 @@ GLuint rglGcmFifoPutReference (void *data) return fifo->lastSWReferenceWritten; } -GLuint rglGcmFifoReadReference( rglGcmFifo *fifo ) +GLuint rglGcmFifoReadReference (void *data) { - GLuint ref = *(( volatile GLuint * ) & fifo->dmaControl->Reference ); + rglGcmFifo *fifo = (rglGcmFifo*)data; + GLuint ref = *((volatile GLuint *)&fifo->dmaControl->Reference); fifo->lastHWReferenceRead = ref; return ref; } @@ -1662,7 +1650,6 @@ GLboolean rglGcmFifoReferenceInUse (void *data, GLuint reference) return GL_TRUE; } - // Wait until the requested space is available. // If not currently available, will call the out of space callback @@ -1715,11 +1702,8 @@ void rglGcmFifoInit (void *data, void *dmaControl, unsigned long dmaPushBufferOf rglGcmFifoFlush( fifo ); // Here, we jump to this new buffer // a finish that waits for 0 specifically. - for ( ;; ) - { - if ( rglGcmFifoReadReference( fifo ) == 0 ) break; - sys_timer_usleep( 10 ); - } + while (rglGcmFifoReadReference(fifo) != 0) + sys_timer_usleep(10); } fifo->dmaPushBufferGPU = dmaPushBuffer; fifo->spuid = 0; @@ -1823,8 +1807,10 @@ GLuint rglGcmGetGraphicsClock(void) return GraphicsClock; } -GLboolean rglGcmInit( RGLinitOptions* options, rglGcmResource *resource ) +GLboolean rglGcmInit (void *opt_data, void *res_data) { + rglGcmResource *resource = (rglGcmResource*)res_data; + RGLinitOptions *options = (RGLinitOptions*)opt_data; if ( !rglGcmInitFromRM( resource ) ) { fprintf( stderr, "RGL GCM failed initialisation" ); @@ -1953,8 +1939,9 @@ void rglGcmSend( unsigned int dstId, unsigned dstOffset, unsigned int pitch, ============================================================ */ // resc is enabled by setting ANY of the resc related device parameters (using the enable mask) -static inline int rescIsEnabled( RGLdeviceParameters* params ) +static inline int rescIsEnabled (void *data) { + RGLdeviceParameters *params = (RGLdeviceParameters*)data; return params->enable & ( RGL_DEVICE_PARAMETERS_RESC_RENDER_WIDTH_HEIGHT | RGL_DEVICE_PARAMETERS_RESC_RATIO_MODE | RGL_DEVICE_PARAMETERS_RESC_PAL_TEMPORAL_MODE | @@ -1965,8 +1952,9 @@ static inline int rescIsEnabled( RGLdeviceParameters* params ) // Platform-specific initialization for Cell processor: // manage allocation/free of SPUs, and optional debugging console. -void rglPlatformInit( RGLinitOptions* options ) +void rglPlatformInit (void *data) { + (void)data; } @@ -1978,8 +1966,9 @@ void rglPlatformExit(void) PLATFORM REPORTING ============================================================ */ -void rglInitConsole( GLuint enable ) +void rglInitConsole (GLuint enable) { + (void)enable; } void rglExitConsole(void) @@ -2057,6 +2046,7 @@ void rglPsglPlatformInit (void *data) void rglPsglPlatformExit(void) { RGLcontext* LContext = _CurrentContext; + if ( LContext ) { glFlush(); @@ -2363,7 +2353,6 @@ int rglGcmInitRM( rglGcmResource *gcmResource, unsigned int hostMemorySize, int // Set our Fifo functions gCellGcmCurrentContext->callback = ( CellGcmContextCallback )rglOutOfSpaceCallback; - fprintf(stderr, "RGLGCM resource: MClk: %f Mhz NVClk: %f Mhz\n", ( float )gcmResource->MemoryClock / 1E6, ( float )gcmResource->GraphicsClock / 1E6 ); fprintf(stderr, "RGLGCM resource: Video Memory: %i MB\n", gcmResource->localSize / ( 1024*1024 ) ); fprintf(stderr, "RGLGCM resource: localAddress mapped at %p\n", gcmResource->localAddress ); diff --git a/console/rgl/src/ps3/rgl_ps3_cg.cpp b/console/rgl/src/ps3/rgl_ps3_cg.cpp index 4ca90ec3ff..960c234d69 100644 --- a/console/rgl/src/ps3/rgl_ps3_cg.cpp +++ b/console/rgl/src/ps3/rgl_ps3_cg.cpp @@ -69,8 +69,10 @@ static int rglpsLoadFPShader (void *data) return GL_TRUE; } -static void rglpsUnloadFPShader(_CGprogram *program) +static void rglpsUnloadFPShader (void *data) { + _CGprogram *program = (_CGprogram*)data; + if ( program->loadProgramId != GMM_ERROR ) { gmmFree( program->loadProgramId ); diff --git a/console/rgl/src/ps3/rgl_ps3_raster.cpp b/console/rgl/src/ps3/rgl_ps3_raster.cpp index da676a7374..8acb4e3019 100644 --- a/console/rgl/src/ps3/rgl_ps3_raster.cpp +++ b/console/rgl/src/ps3/rgl_ps3_raster.cpp @@ -51,9 +51,9 @@ int rglGetTypeResource( _CGprogram* program, unsigned short typeIndex, short *re int rglGetTypeResourceID( _CGprogram* program, unsigned short typeIndex ); int rglGetTypeResourceRegisterCountVP( _CGprogram* program, short resourceIndex, int resourceCount, unsigned short *resource ); -static void setAttribConstantIndex( CgRuntimeParameter* __restrict ptr, const void* __restrict v, const int ) // index +static void setAttribConstantIndex (void *data, const void* __restrict v, const int ) // index { - // XXX not sure why it was testing unused res + CgRuntimeParameter *ptr = (CgRuntimeParameter*)data; _CGprogram *program = ptr->program; const CgParameterResource *parameterResource = rglGetParameterResource( program, ptr->parameterEntry ); GLuint index = parameterResource->resource - CG_ATTR0; @@ -117,8 +117,9 @@ template static void setVectorTypefp( CgRuntimeParameter* __restrict p } } -template static void setVectorTypeSharedfpIndex( CgRuntimeParameter* __restrict ptr, const void* __restrict v, const int /*index*/ ) +template static void setVectorTypeSharedfpIndex (void *data, const void* __restrict v, const int /*index*/ ) { + CgRuntimeParameter *ptr = (CgRuntimeParameter*)data; RGLcontext * LContext = _CurrentContext; rglGcmDriver *driver = (rglGcmDriver*)_CurrentDevice->rasterDriver; const CgParameterResource *parameterResource = rglGetParameterResource( ptr->program, ptr->parameterEntry ); @@ -139,8 +140,9 @@ template static void setVectorTypeSharedfpIndex( CgRuntimeParameter* _ ++LContext->LastFPConstantModification; } -template static void setVectorTypeSharedfpIndexArray( CgRuntimeParameter* __restrict ptr, const void* __restrict v, const int index ) +template static void setVectorTypeSharedfpIndexArray (void *data, const void* __restrict v, const int index ) { + CgRuntimeParameter *ptr = (CgRuntimeParameter*)data; RGLcontext * LContext = _CurrentContext; rglGcmDriver *driver = (rglGcmDriver*)_CurrentDevice->rasterDriver; const CgParameterResource *parameterResource = rglGetParameterResource( ptr->program, ptr->parameterEntry ); @@ -170,8 +172,9 @@ template static void setVectorTypeSharedfpIndexArray( CgRuntimeParamet // XXX we don't care about 32bit wrapping, do we ? ++LContext->LastFPConstantModification; } -template static void setVectorTypeSharedvpIndex( CgRuntimeParameter* __restrict ptr, const void* __restrict v, const int /*index*/ ) +template static void setVectorTypeSharedvpIndex (void *data, const void* __restrict v, const int /*index*/ ) { + CgRuntimeParameter *ptr = (CgRuntimeParameter*)data; const float * __restrict f = ( const float * __restrict )v; const CgParameterResource *parameterResource = rglGetParameterResource( ptr->program, ptr->parameterEntry ); unsigned short resource = parameterResource->resource; @@ -181,8 +184,9 @@ template static void setVectorTypeSharedvpIndex( CgRuntimeParameter* _ rglPlatformSetVertexRegister4fv( resource, dst ); } -template static void setVectorTypeSharedvpIndexArray( CgRuntimeParameter* __restrict ptr, const void* __restrict v, const int index ) +template static void setVectorTypeSharedvpIndexArray (void *data, const void* __restrict v, const int index ) { + CgRuntimeParameter *ptr = (CgRuntimeParameter*)data; const float * __restrict f = ( const float * __restrict )v; const CgParameterResource *parameterResource = rglGetParameterResource( ptr->program, ptr->parameterEntry ); unsigned short resource = parameterResource->resource + index; ///TODO: assume contiguous here , right ? @@ -202,8 +206,9 @@ template static void setVectorTypeSharedvpIndexArray( CgRuntimeParamet #define ROW_MAJOR 0 #define COL_MAJOR 1 -template static void setVectorTypevpIndex( CgRuntimeParameter* __restrict ptr, const void* __restrict v, const int /*index*/ ) +template static void setVectorTypevpIndex (void *data, const void* __restrict v, const int /*index*/ ) { + CgRuntimeParameter *ptr = (CgRuntimeParameter*)data; RGLcontext * LContext = _CurrentContext; const float * __restrict f = ( const float* )v; float * __restrict dst = ( float* )ptr->pushBufferPointer; @@ -211,8 +216,9 @@ template static void setVectorTypevpIndex( CgRuntimeParameter* __rest dst[i] = f[i]; LContext->needValidate |= RGL_VALIDATE_VERTEX_CONSTANTS; } -template static void setVectorTypevpIndexArray( CgRuntimeParameter* __restrict ptr, const void* __restrict v, const int index ) +template static void setVectorTypevpIndexArray (void *data, const void* __restrict v, const int index ) { + CgRuntimeParameter *ptr = (CgRuntimeParameter*)data; RGLcontext * LContext = _CurrentContext; const float * __restrict f = ( const float* )v; float * __restrict dst = ( float* )( *(( unsigned int ** )ptr->pushBufferPointer + index ) ); @@ -220,10 +226,12 @@ template static void setVectorTypevpIndexArray( CgRuntimeParameter* _ dst[i] = f[i]; LContext->needValidate |= RGL_VALIDATE_VERTEX_CONSTANTS; } -template static void setVectorTypefpIndex( CgRuntimeParameter* __restrict ptr, const void* __restrict v, const int /*index*/ ) + +template static void setVectorTypefpIndex (void *dat, const void *v, const int /*index*/ ) { - float * __restrict f = ( float* )v; - float * __restrict data = ( float* )ptr->pushBufferPointer;/*(float*)ptr->offset*;*/ + CgRuntimeParameter *ptr = (CgRuntimeParameter*)dat; + float * __restrict f = (float*)v; + float * __restrict data = (float*)ptr->pushBufferPointer;/*(float*)ptr->offset*;*/ for ( long i = 0; i < SIZE; ++i ) //TODO: ced: find out if this loop for the get or for the reset in a future use of the same shader or just for the alignment??? data[i] = f[i]; _CGprogram *program = ptr->program; @@ -236,8 +244,10 @@ template static void setVectorTypefpIndex( CgRuntimeParameter* __restr swapandsetfp( program->header.instructionCount*16, program->loadProgramId, program->loadProgramOffset, ec, ( unsigned int * )data ); } } -template static void setVectorTypefpIndexArray( CgRuntimeParameter* __restrict ptr, const void* __restrict v, const int index ) + +template static void setVectorTypefpIndexArray (void *dat, const void* __restrict v, const int index ) { + CgRuntimeParameter *ptr = (CgRuntimeParameter*)dat; float * __restrict f = ( float* )v; float * __restrict data = ( float* )ptr->pushBufferPointer;/*(float*)ptr->offset*;*/ for ( long i = 0; i < SIZE; ++i ) //TODO: ced: find out if this loop for the get or for the reset in a future use of the same shader or just for the alignment??? @@ -260,8 +270,9 @@ template static void setVectorTypefpIndexArray( CgRuntimeParameter* __ } //matrices -template static void setMatrixvpIndex( CgRuntimeParameter* __restrict ptr, const void* __restrict v, const int index ) +template static void setMatrixvpIndex (void *data, const void* __restrict v, const int index ) { + CgRuntimeParameter *ptr = (CgRuntimeParameter*)data; RGLcontext * LContext = _CurrentContext; float * __restrict f = ( float* )v; float * __restrict dst = ( float* )ptr->pushBufferPointer; @@ -273,8 +284,9 @@ template static void setMatrixvpIndex( CgRuntime LContext->needValidate |= RGL_VALIDATE_VERTEX_CONSTANTS; } -template static void setMatrixSharedvpIndex( CgRuntimeParameter* __restrict ptr, const void* __restrict v, const int /*index*/ ) +template static void setMatrixSharedvpIndex (void *data, const void* __restrict v, const int /*index*/ ) { + CgRuntimeParameter *ptr = (CgRuntimeParameter*)data; float * __restrict f = ( float* )v; float * __restrict dst = ( float* )ptr->pushBufferPointer; @@ -291,11 +303,12 @@ template static void setMatrixSharedvpIndex( CgR for ( long col = COLS; col < 4; ++col ) tmp[row*4 + col] = dst[row*4+col]; } - GCM_FUNC( cellGcmSetVertexProgramParameterBlock, resource, ROWS, ( const float* )tmp ); + GCM_FUNC( cellGcmSetVertexProgramParameterBlock, resource, ROWS, (const float*)tmp); } -template static void setMatrixSharedvpIndexArray( CgRuntimeParameter* __restrict ptr, const void* __restrict v, const int index ) +template static void setMatrixSharedvpIndexArray (void *data, const void* __restrict v, const int index ) { + CgRuntimeParameter *ptr = (CgRuntimeParameter*)data; float * __restrict f = ( float* )v; float * __restrict dst = ( float* )ptr->pushBufferPointer; @@ -314,8 +327,9 @@ template static void setMatrixSharedvpIndexArray GCM_FUNC( cellGcmSetVertexProgramParameterBlock, resource, ROWS, tmp ); } -template static void setMatrixSharedfpIndex( CgRuntimeParameter* __restrict ptr, const void* __restrict v, const int /*index*/ ) +template static void setMatrixSharedfpIndex (void *data, const void* __restrict v, const int /*index*/ ) { + CgRuntimeParameter *ptr = (CgRuntimeParameter*)data; rglGcmDriver *driver = (rglGcmDriver*)_CurrentDevice->rasterDriver; const CgParameterResource *parameterResource = rglGetParameterResource( ptr->program, ptr->parameterEntry ); @@ -353,8 +367,9 @@ template static void setMatrixSharedfpIndex( CgR ++LContext->LastFPConstantModification; } -template static void setMatrixSharedfpIndexArray( CgRuntimeParameter* __restrict ptr, const void* __restrict v, const int index ) +template static void setMatrixSharedfpIndexArray (void *data, const void* __restrict v, const int index ) { + CgRuntimeParameter *ptr = (CgRuntimeParameter*)data; //TODO: double check for the semi endian swap... not done here, is it done by the RSX ? rglGcmDriver *driver = (rglGcmDriver*)_CurrentDevice->rasterDriver; @@ -402,8 +417,9 @@ template static void setMatrixSharedfpIndexArray } //TODO ?: check: //works only for the consecutive alloc... -template static void setMatrixvpIndexArray( CgRuntimeParameter* __restrict ptr, const void* __restrict v, const int index ) +template static void setMatrixvpIndexArray (void *data, const void* __restrict v, const int index ) { + CgRuntimeParameter *ptr = (CgRuntimeParameter*)data; RGLcontext * LContext = _CurrentContext; float * __restrict f = ( float* )v; float * __restrict dst = ( float* )( *(( unsigned int ** )ptr->pushBufferPointer + index ) ); @@ -414,8 +430,9 @@ template static void setMatrixvpIndexArray( CgRu } LContext->needValidate |= RGL_VALIDATE_VERTEX_CONSTANTS; } -template static void setMatrixfpIndex( CgRuntimeParameter* __restrict ptr, const void* __restrict v, const int /*index*/ ) +template static void setMatrixfpIndex (void *data, const void* __restrict v, const int /*index*/ ) { + CgRuntimeParameter *ptr = (CgRuntimeParameter*)data; float * __restrict f = ( float* )v; float * __restrict dst = ( float* )ptr->pushBufferPointer; _CGprogram *program = (( CgRuntimeParameter* )ptr )->program; @@ -434,8 +451,9 @@ template static void setMatrixfpIndex( CgRuntime ec += count + 2; //+1 for the register, +1 for the count, + count for the number of embedded consts } } -template static void setMatrixfpIndexArray( CgRuntimeParameter* __restrict ptr, const void* __restrict v, const int index ) +template static void setMatrixfpIndexArray (void *data, const void* __restrict v, const int index ) { + CgRuntimeParameter *ptr = (CgRuntimeParameter*)data; float * __restrict f = ( float* )v; float * __restrict dst = ( float* )ptr->pushBufferPointer; _CGprogram *program = ptr->program; @@ -560,8 +578,9 @@ _cgSetArrayIndexFunction getMatrixTypeIndexSetterFunction( unsigned short a, uns return setMatrixTypeIndex[a][b][c][d][e][f]; } -static void setSamplerfp( CgRuntimeParameter*ptr, const void*v, int ) //index +static void setSamplerfp (void *data, const void*v, int ) //index { + CgRuntimeParameter *ptr = (CgRuntimeParameter*)data; _CGprogram *program = (( CgRuntimeParameter* )ptr )->program; const CgParameterResource *parameterResource = rglGetParameterResource( program, (( CgRuntimeParameter* )ptr )->parameterEntry ); @@ -579,16 +598,17 @@ static void setSamplerfp( CgRuntimeParameter*ptr, const void*v, int ) //index } } -static void setSamplervp( CgRuntimeParameter*ptr, const void*v, int ) //index +static void setSamplervp (void *data, const void*v, int ) //index { // the value of v == NULL when it is called from cgGLEnableTextureParameter // the value of v == NULL when it is called from cgGLSetTextureParameter // this may be called by a connected param to propagate its value // the spec says that the set should not cause the bind // so only do the bind when the call comes from cgGLEnableTextureParameter - if ( v ) + CgRuntimeParameter *ptr = (CgRuntimeParameter*)data; + if (v) { - *( GLuint* )ptr->pushBufferPointer = *( GLuint* )v; + *(GLuint*)ptr->pushBufferPointer = *( GLuint* )v; } } @@ -1170,9 +1190,10 @@ void rglSetDefaultValuesFP (void *data) PLATFORM BUFFER ============================================================ */ -static void rglDeallocateBuffer( rglBufferObject* bufferObject ) +static void rglDeallocateBuffer (void *data) { - rglGcmBufferObject *rglBuffer = ( rglGcmBufferObject * )bufferObject->platformBufferObject; + rglBufferObject *bufferObject = (rglBufferObject*)data; + rglGcmBufferObject *rglBuffer = (rglGcmBufferObject*)bufferObject->platformBufferObject; switch ( rglBuffer->pool ) { @@ -1189,9 +1210,10 @@ static void rglDeallocateBuffer( rglBufferObject* bufferObject ) rglBuffer->bufferId = GMM_ERROR; } -static void rglpsAllocateBuffer(rglBufferObject* bufferObject) +static void rglpsAllocateBuffer (void *data) { - rglGcmBufferObject *rglBuffer = ( rglGcmBufferObject * )bufferObject->platformBufferObject; + rglBufferObject *bufferObject = (rglBufferObject*)data; + rglGcmBufferObject *rglBuffer = (rglGcmBufferObject*)bufferObject->platformBufferObject; // free current buffer (if any) rglDeallocateBuffer( bufferObject ); @@ -2876,10 +2898,11 @@ GLboolean rglPlatformTextureReference (void *data, GLuint pitch, void *data_buf, // Render target rt's color and depth buffer parameters are updated with args // Fifo functions are called as required -void static inline rglGcmSetColorDepthBuffers(void *data, rglGcmRenderTargetEx const * const args ) +void static inline rglGcmSetColorDepthBuffers(void *data, const void *data_args) { rglGcmRenderTarget *rt = (rglGcmRenderTarget*)data; CellGcmSurface *grt = &rt->gcmRenderTarget; + const rglGcmRenderTargetEx* args = (const rglGcmRenderTargetEx*)data_args; rt->colorBufferCount = args->colorBufferCount; @@ -2943,10 +2966,11 @@ void static inline rglGcmSetColorDepthBuffers(void *data, rglGcmRenderTargetEx c } // Update rt's color and depth format with args -void static inline rglGcmSetColorDepthFormats (void *data, rglGcmRenderTargetEx const * const args) +void static inline rglGcmSetColorDepthFormats (void *data, const void *data_args) { rglGcmRenderTarget *rt = (rglGcmRenderTarget*)data; CellGcmSurface * grt = &rt->gcmRenderTarget; + const rglGcmRenderTargetEx *args = (const rglGcmRenderTargetEx*)data_args; // set the color format switch ( args->colorFormat ) @@ -2973,10 +2997,11 @@ void static inline rglGcmSetColorDepthFormats (void *data, rglGcmRenderTargetEx } // Update rt's color targets -static void inline rglGcmSetTarget (void *data, rglGcmRenderTargetEx const * const args ) +static void inline rglGcmSetTarget (void *data, const void *data_args) { rglGcmRenderTarget *rt = (rglGcmRenderTarget*)data; CellGcmSurface * grt = &rt->gcmRenderTarget; + const rglGcmRenderTargetEx *args = (const rglGcmRenderTargetEx*)data_args; // set target combo switch ( rt->colorBufferCount ) @@ -3000,10 +3025,11 @@ static void inline rglGcmSetTarget (void *data, rglGcmRenderTargetEx const * con } // Set current render target to args -void rglGcmFifoGlSetRenderTarget( rglGcmRenderTargetEx const * const args ) +void rglGcmFifoGlSetRenderTarget (const void *data) { rglGcmRenderTarget *rt = &rglGcmState_i.renderTarget; CellGcmSurface * grt = &rglGcmState_i.renderTarget.gcmRenderTarget; + const rglGcmRenderTargetEx *args = (const rglGcmRenderTargetEx*)data; rglGcmSetColorDepthBuffers( rt, args ); rglGcmSetColorDepthFormats( rt, args ); diff --git a/console/rgl/src/rgl_cg.cpp b/console/rgl/src/rgl_cg.cpp index 29ba178a41..93d8c3d231 100644 --- a/console/rgl/src/rgl_cg.cpp +++ b/console/rgl/src/rgl_cg.cpp @@ -263,26 +263,32 @@ unsigned int rglCountFloatsInCgType( CGtype type ) return size; } -void _cgRaiseInvalidParam( CgRuntimeParameter*p, const void*v ) +void _cgRaiseInvalidParam (void *data, const void*v ) { + (void)data; rglCgRaiseError( CG_INVALID_PARAMETER_ERROR ); } -void _cgRaiseInvalidParamIndex( CgRuntimeParameter*p, const void*v, const int index ) +void _cgRaiseInvalidParamIndex (void *data, const void*v, const int index ) { + (void)data; rglCgRaiseError( CG_INVALID_PARAMETER_ERROR ); } -void _cgRaiseNotMatrixParam( CgRuntimeParameter*p, const void*v ) -{ - rglCgRaiseError( CG_NOT_MATRIX_PARAM_ERROR ); -} -void _cgRaiseNotMatrixParamIndex( CgRuntimeParameter*p, const void*v, const int index ) +void _cgRaiseNotMatrixParam (void *data, const void*v ) { + (void)data; rglCgRaiseError( CG_NOT_MATRIX_PARAM_ERROR ); } -void _cgIgnoreSetParamIndex( CgRuntimeParameter*p, const void*v, const int index ) +void _cgRaiseNotMatrixParamIndex( void *data, const void*v, const int index ) { + (void)data; + rglCgRaiseError( CG_NOT_MATRIX_PARAM_ERROR ); +} + +void _cgIgnoreSetParamIndex (void *data, const void*v, const int index ) +{ + (void)data; // nothing } @@ -712,9 +718,10 @@ void rglCgDestroyContextParam( CgRuntimeParameter* ptr ) free( ptr ); } -static void _setSamplerRuntimeParameter( CgRuntimeParameter*ptr, const void*v, int /*index*/ ) +static void _setSamplerRuntimeParameter (void *data, const void*v, int /*index*/ ) { - if ( v ) + CgRuntimeParameter *ptr = (CgRuntimeParameter*)data; + if (v) { *( GLuint* )ptr->pushBufferPointer = *( GLuint* )v; }