diff --git a/console/rgl/include/RGL/private.h b/console/rgl/include/RGL/private.h index 8fb602d194..88e19c69a2 100644 --- a/console/rgl/include/RGL/private.h +++ b/console/rgl/include/RGL/private.h @@ -184,50 +184,50 @@ extern "C" //---------------------------------------- // Platform/Init.c //---------------------------------------- - extern void rglPlatformInit( PSGLinitOptions* options ); - extern void rglPlatformExit(); + extern void rglPlatformInit (PSGLinitOptions* options); + extern void rglPlatformExit (void); //---------------------------------------- // Device/Device.c //---------------------------------------- - extern void rglDeviceInit( PSGLinitOptions* options ); - extern void rglDeviceExit(); - extern PSGLdeviceParameters * rglShadowDeviceParameters( void ); + extern void rglDeviceInit (PSGLinitOptions* options); + extern void rglDeviceExit (void); + extern PSGLdeviceParameters * rglShadowDeviceParameters (void); //---------------------------------------- // Device/.../PlatformDevice.c //---------------------------------------- - extern GLboolean rglPlatformDeviceInit( PSGLinitOptions* options ); - extern void rglPlatformDeviceExit(); - extern int rglPlatformDeviceSize(); - extern int rglPlatformCreateDevice( RGLdevice* device ); - extern void rglPlatformDestroyDevice( RGLdevice* device ); - extern void rglPlatformMakeCurrent( void* device ); - extern void rglPlatformSwapBuffers( RGLdevice* device ); - extern const GLvoid* rglPlatformGetProcAddress( const char *funcName ); + extern GLboolean rglPlatformDeviceInit (PSGLinitOptions* options); + extern void rglPlatformDeviceExit (void); + extern int rglPlatformDeviceSize (void); + extern int rglPlatformCreateDevice (void *data); + extern void rglPlatformDestroyDevice (void *data); + extern void rglPlatformMakeCurrent (void *data); + extern void rglPlatformSwapBuffers (void *data); + extern const GLvoid* rglPlatformGetProcAddress (const char *funcName); //---------------------------------------- // Raster/.../PlatformRaster.c //---------------------------------------- void* rglPlatformRasterInit (void); - void rglPlatformRasterExit (void* driver); + void rglPlatformRasterExit (void* data); void rglPlatformRasterDestroyResources (void); - void rglPlatformDraw( rglDrawParams* dparams ); - GLboolean rglPlatformNeedsConversion( const rglAttributeState* as, GLuint index ); + void rglPlatformDraw (rglDrawParams* dparams); + GLboolean rglPlatformNeedsConversion (const rglAttributeState* as, GLuint index); // [YLIN] Try to avoid LHS inside this function. // In oringinal implementation, indexType and indexCount will be stored right before this function // and since we will load them right after enter this function, there are LHS. GLboolean rglPlatformRequiresSlowPath( rglDrawParams* dparams, const GLenum indexType, uint32_t indexCount); void rglPlatformRasterGetIntegerv( GLenum pname, GLint* params ); - void rglPlatformRasterFlush(); - void rglPlatformRasterFinish(); - void rglValidateFragmentProgram(); - void rglValidateFragmentProgramSharedConstants(); - void rglValidateClipPlanes(); - void rglInvalidateAttributes(); - GLuint rglValidateAttributes( const GLvoid* indices, GLboolean *isMain ); - GLuint rglValidateAttributesSlow( rglDrawParams *dparams, GLboolean *isMain ); + void rglPlatformRasterFlush (void); + void rglPlatformRasterFinish (void); + void rglValidateFragmentProgram (void); + void rglValidateFragmentProgramSharedConstants (void); + void rglValidateClipPlanes (void); + void rglInvalidateAttributes (void); + GLuint rglValidateAttributes (const void* indices, GLboolean *isMain); + GLuint rglValidateAttributesSlow (rglDrawParams *dparams, GLboolean *isMain); //---------------------------------------- // Raster/.../PlatformTexture.c diff --git a/console/rgl/src/ps3/include/rgl-inline.h b/console/rgl/src/ps3/include/rgl-inline.h index 3f44e596f9..4652773e61 100644 --- a/console/rgl/src/ps3/include/rgl-inline.h +++ b/console/rgl/src/ps3/include/rgl-inline.h @@ -43,7 +43,6 @@ static inline GLuint rglPlatformGetBitsPerPixel( GLenum internalFormat ) } } - #define SUBPIXEL_BITS 12 #define SUBPIXEL_ADJUST (0.5/(1<> 24 )&0xff, ( v >> 16 )&0xff, ( v >> 8 )&0xff, v&0xff ); @@ -691,14 +689,14 @@ void static inline rglPrintIt (unsigned int v ) } // prints the last numWords of the command fifo -void static inline rglPrintFifoFromPut( unsigned int numWords ) +static inline void rglPrintFifoFromPut( unsigned int numWords ) { for ( int i = -numWords; i <= -1; i++ ) rglPrintIt((( uint32_t* )rglGcmState_i.fifo.current )[i] ); } // prints the last numWords of the command fifo -void static inline rglPrintFifoFromGet( unsigned int numWords ) +static inline void rglPrintFifoFromGet( unsigned int numWords ) { for ( int i = -numWords; i <= -1; i++ ) rglPrintIt((( uint32_t* )rglGcmState_i.fifo.lastGetRead )[i] ); @@ -706,7 +704,7 @@ void static inline rglPrintFifoFromGet( unsigned int numWords ) // Determine whether a given location in a command buffer has been passed, by // using reference markers. -GLboolean static inline rglGcmFifoGlTestFenceRef( const GLuint ref ) +static inline GLboolean rglGcmFifoGlTestFenceRef (const GLuint ref) { rglGcmFifo *fifo = &rglGcmState_i.fifo; return rglGcmFifoReferenceInUse( fifo, ref ); @@ -714,14 +712,14 @@ GLboolean static inline rglGcmFifoGlTestFenceRef( const GLuint ref ) // Add a reference marker to the command buffer to determine whether a location // in the command buffer has been passed -void static inline rglGcmFifoGlIncFenceRef( GLuint *ref ) +static inline void rglGcmFifoGlIncFenceRef (GLuint *ref) { rglGcmFifo *fifo = &rglGcmState_i.fifo; *ref = rglGcmFifoPutReference( fifo ); } // Flush the current FIFO. -void static inline rglGcmFifoGlFlush( void ) +static inline void rglGcmFifoGlFlush (void) { GCM_FUNC_NO_ARGS( cellGcmSetInvalidateVertexCache ); rglGcmFifoFlush( &rglGcmState_i.fifo ); @@ -856,7 +854,7 @@ static inline void rglGcmFifoGlVertexAttribPointer } // set the vertex attribute to the specified value. -void static inline rglGcmFifoGlVertexAttrib4fv( GLuint index, const GLfloat v[4] ) +static inline void rglGcmFifoGlVertexAttrib4fv( GLuint index, const GLfloat v[4] ) { GCM_FUNC( cellGcmSetVertexData4f, index, v ); } @@ -873,7 +871,7 @@ static inline void rglGcmFifoGlClear( GLbitfield mask ) if ( mask & RGLGCM_COLOR_BUFFER_BIT && rglGcmState_i.renderTarget.colorFormat) hwMask = CELL_GCM_CLEAR_R | CELL_GCM_CLEAR_G | CELL_GCM_CLEAR_B | CELL_GCM_CLEAR_A; - if ( hwMask ) + if (hwMask) { GCM_FUNC( cellGcmSetClearSurface, hwMask ); } @@ -881,7 +879,7 @@ static inline void rglGcmFifoGlClear( GLbitfield mask ) static inline void rglGcmFifoGlEnable( rglGcmEnum cap ) { - switch ( cap ) + switch (cap) { case RGLGCM_BLEND: GCM_FUNC( cellGcmSetBlendEnable, RGLGCM_TRUE ); @@ -900,8 +898,7 @@ static inline void rglGcmFifoGlEnable( rglGcmEnum cap ) static inline void rglGcmFifoGlDisable( rglGcmEnum cap ) { - - switch ( cap ) + switch (cap) { case RGLGCM_BLEND: GCM_FUNC( cellGcmSetBlendEnable, RGLGCM_FALSE ); @@ -1029,9 +1026,3 @@ static inline GLuint rglGcmGetBufferObjectOrigin (GLuint buffer) rglGcmBufferObject *gcmBuffer = ( rglGcmBufferObject * ) & bufferObject->platformBufferObject; return gcmBuffer->bufferId; } - -static inline rglGcmDriver *rglGetGcmDriver(void) -{ - return ( rglGcmDriver * )( _CurrentDevice->rasterDriver ); -} - diff --git a/console/rgl/src/ps3/rgl_ps3.cpp b/console/rgl/src/ps3/rgl_ps3.cpp index 58f7c49907..e70a5d1a9f 100644 --- a/console/rgl/src/ps3/rgl_ps3.cpp +++ b/console/rgl/src/ps3/rgl_ps3.cpp @@ -2976,8 +2976,9 @@ static void rglSetDisplayMode( const VideoMode *vm, GLushort bitsPerPixel, GLuin cellVideoOutConfigure( CELL_VIDEO_OUT_PRIMARY, &videocfg, NULL, 0 ); } -int rglPlatformCreateDevice( RGLdevice* device ) +int rglPlatformCreateDevice (void *data) { + RGLdevice *device = (RGLdevice*)data; rglGcmDevice *gcmDevice = ( rglGcmDevice * )device->platformDevice; RGLdeviceParameters* params = &device->deviceParameters; rglDuringDestroyDevice = GL_FALSE; @@ -3209,10 +3210,11 @@ int rglPlatformCreateDevice( RGLdevice* device ) return 0; } -void rglPlatformDestroyDevice( RGLdevice* device ) +void rglPlatformDestroyDevice (void *data) { + RGLdevice *device = (RGLdevice*)data; rglGcmDevice *gcmDevice = ( rglGcmDevice * )device->platformDevice; - RGLdeviceParameters* params = &device->deviceParameters; + RGLdeviceParameters *params = &device->deviceParameters; rglpFifoGlFinish(); @@ -3249,10 +3251,11 @@ void rglPlatformDestroyDevice( RGLdevice* device ) rglDuringDestroyDevice = GL_FALSE; } -void rglPlatformSwapBuffers( RGLdevice* device ) +void rglPlatformSwapBuffers (void *data) { gmmUpdateFreeList(CELL_GCM_LOCATION_LOCAL); + RGLdevice *device = (RGLdevice*)data; rglGcmDevice *gcmDevice = (rglGcmDevice *)device->platformDevice; const GLuint drawBuffer = gcmDevice->drawBuffer; @@ -3281,7 +3284,8 @@ void rglPlatformSwapBuffers( RGLdevice* device ) if ( res != CELL_OK ) { //RGL_REPORT_EXTRA(RGL_REPORT_RESC_FLIP_ERROR, "WARNING: RESC cellRescSetConvertAndFlip returned error code %d.\n", res); - if ( _CurrentContext ) _CurrentContext->needValidate |= RGL_VALIDATE_FRAMEBUFFER; + if ( _CurrentContext ) + _CurrentContext->needValidate |= RGL_VALIDATE_FRAMEBUFFER; return; } } @@ -3296,7 +3300,8 @@ void rglPlatformSwapBuffers( RGLdevice* device ) cellGcmSetWaitFlip(); // GPU will wait until flip actually occurs } - const char * __restrict v = rglGetGcmDriver()->sharedVPConstants; + rglGcmDriver *driver = (rglGcmDriver*)_CurrentDevice->rasterDriver; + const char * __restrict v = driver->sharedVPConstants; GCM_FUNC( cellGcmSetVertexProgramParameterBlock, 0, 8, ( float* )v ); // GCM_PORT_UNTESTED [KHOFF] rglGcmFifoGlEnable( RGLGCM_DITHER ); @@ -3330,7 +3335,7 @@ void rglPlatformSwapBuffers( RGLdevice* device ) } } -void rglpValidateViewport(void) +void rglpValidateViewport (void) { RGLcontext* LContext = _CurrentContext;