(RGL PS3) Reimplement cellGcmSetTransferLocation, cellGcInlineTransfer,

cellGcmSetClearColor
This commit is contained in:
twinaphex 2013-04-14 20:41:24 +02:00
parent 7923ac4849
commit 09ad685541
3 changed files with 29 additions and 9 deletions

View File

@ -74,6 +74,22 @@ static inline GLuint rglPlatformGetBitsPerPixel (GLenum internalFormat)
(thisContext->current)[1] = (remap); \
(thisContext->current) += 2;
#define rglGcmSetTransferLocation(thisContext, location) \
(thisContext->current)[0] = (((1) << (18)) | ((0x00006188))); \
(thisContext->current)[1] = ((0xFEED0000) + location); \
(thisContext->current) += 2;
#define rglGcmInlineTransfer(thisContext, dstOffset, srcAdr, sizeInWords, location) \
(thisContext->current)[0] = (((1) << (18)) | ((0x00006188))); \
(thisContext->current)[1] = ((0xFEED0000) + location); \
(thisContext->current) += 2; \
cellGcmSetInlineTransferUnsafeInline(thisContext, dstOffset, srcAdr, sizeInWords);
#define rglGcmSetClearColor(thisContext, color) \
(thisContext->current)[0] = (((1) << (18)) | ((0x00001d90))); \
(thisContext->current)[1] = (color); \
(thisContext->current) += 2;
static inline void rglGcmSetDrawArrays(struct CellGcmContextData *thisContext, uint8_t mode,
uint32_t first, uint32_t count)
{

View File

@ -1705,7 +1705,7 @@ void rglGcmSetOpenGLState (void *data)
GCM_FUNC( cellGcmSetBlendColor, 0, 0);
GCM_FUNC( cellGcmSetBlendEquation, RGLGCM_FUNC_ADD, RGLGCM_FUNC_ADD );
GCM_FUNC( cellGcmSetBlendFunc, RGLGCM_ONE, RGLGCM_ZERO, RGLGCM_ONE, RGLGCM_ZERO );
GCM_FUNC( cellGcmSetClearColor, 0 );
rglGcmSetClearColor(thisContext, 0 );
GCM_FUNC( cellGcmSetBlendEnable, RGLGCM_FALSE );
GCM_FUNC( cellGcmSetBlendEnableMrt, RGLGCM_FALSE, RGLGCM_FALSE, RGLGCM_FALSE );
GCM_FUNC( cellGcmSetFragmentProgramGammaEnable, RGLGCM_FALSE );
@ -2880,7 +2880,7 @@ int rglPlatformCreateDevice (void *data)
v->w = width;
v->h = height;
rglGcmFifoGlViewport(v, 0.0f, 1.0f);
GCM_FUNC( cellGcmSetClearColor, 0 );
rglGcmSetClearColor(thisContext, 0 );
if ( fpColor )
{

View File

@ -84,7 +84,8 @@ void rglPlatformSetVertexRegister4fv (unsigned int reg, const float * __restrict
//here ec has been advanced and is already on top of the embedded constant count
template<int SIZE> inline static void swapandsetfp( int ucodeSize, unsigned int loadProgramId, unsigned int loadProgramOffset, unsigned short *ec, const unsigned int * __restrict v )
{
GCM_FUNC( cellGcmSetTransferLocation, CELL_GCM_LOCATION_LOCAL );
CellGcmContextData *thisContext = (CellGcmContextData*)gCellGcmCurrentContext;
rglGcmSetTransferLocation(thisContext, CELL_GCM_LOCATION_LOCAL );
unsigned short count = *( ec++ );
for ( unsigned long offsetIndex = 0; offsetIndex < count; ++offsetIndex )
{
@ -122,6 +123,7 @@ template<int SIZE> static void setVectorTypefp( void *dat, const void* __restric
template<int SIZE> static void setVectorTypeSharedfpIndex (void *data, const void* __restrict v, const int /*index*/ )
{
CellGcmContextData *thisContext = (CellGcmContextData*)gCellGcmCurrentContext;
CgRuntimeParameter *ptr = (CgRuntimeParameter*)data;
RGLcontext * LContext = _CurrentContext;
rglGcmDriver *driver = (rglGcmDriver*)_CurrentDevice->rasterDriver;
@ -136,7 +138,7 @@ template<int SIZE> static void setVectorTypeSharedfpIndex (void *data, const voi
values[1] = ( 1 < SIZE ) ? SWAP_IF_BIG_ENDIAN( vi[1] ) : 0;
values[2] = ( 2 < SIZE ) ? SWAP_IF_BIG_ENDIAN( vi[2] ) : 0;
values[3] = ( 3 < SIZE ) ? SWAP_IF_BIG_ENDIAN( vi[3] ) : 0;
GCM_FUNC( cellGcmInlineTransfer, dstVidOffset, values, 4, 0 );
rglGcmInlineTransfer(thisContext, dstVidOffset, values, 4, 0 );
// XXX we don't care about 32bit wrapping, do we ?
++LContext->LastFPConstantModification;
@ -144,6 +146,7 @@ template<int SIZE> static void setVectorTypeSharedfpIndex (void *data, const voi
template<int SIZE> static void setVectorTypeSharedfpIndexArray (void *data, const void* __restrict v, const int index )
{
CellGcmContextData *thisContext = (CellGcmContextData*)gCellGcmCurrentContext;
CgRuntimeParameter *ptr = (CgRuntimeParameter*)data;
RGLcontext * LContext = _CurrentContext;
rglGcmDriver *driver = (rglGcmDriver*)_CurrentDevice->rasterDriver;
@ -168,7 +171,7 @@ template<int SIZE> static void setVectorTypeSharedfpIndexArray (void *data, cons
values[1] = ( 1 < SIZE ) ? SWAP_IF_BIG_ENDIAN( vi[1] ) : 0;
values[2] = ( 2 < SIZE ) ? SWAP_IF_BIG_ENDIAN( vi[2] ) : 0;
values[3] = ( 3 < SIZE ) ? SWAP_IF_BIG_ENDIAN( vi[3] ) : 0;
GCM_FUNC( cellGcmInlineTransfer, dstVidOffset, values, 4, 0 );
rglGcmInlineTransfer(thisContext, dstVidOffset, values, 4, 0 );
// XXX we don't care about 32bit wrapping, do we ?
++LContext->LastFPConstantModification;
@ -330,6 +333,7 @@ template <int ROWS, int COLS, int ORDER> static void setMatrixSharedvpIndexArray
template <int ROWS, int COLS, int ORDER> static void setMatrixSharedfpIndex (void *data, const void* __restrict v, const int /*index*/ )
{
CellGcmContextData *thisContext = (CellGcmContextData*)gCellGcmCurrentContext;
CgRuntimeParameter *ptr = (CgRuntimeParameter*)data;
rglGcmDriver *driver = (rglGcmDriver*)_CurrentDevice->rasterDriver;
@ -349,7 +353,7 @@ template <int ROWS, int COLS, int ORDER> static void setMatrixSharedfpIndex (voi
tmp[row*4 + 2] = (( 2 < COLS ) ? (( ORDER == ROW_MAJOR ) ? u[row * COLS + 2] : u[2 * ROWS + row] ) : 0 );
tmp[row*4 + 3] = (( 3 < COLS ) ? (( ORDER == ROW_MAJOR ) ? u[row * COLS + 3] : u[3 * ROWS + row] ) : 0 );
}
GCM_FUNC( cellGcmSetTransferLocation, CELL_GCM_LOCATION_LOCAL );
rglGcmSetTransferLocation(thisContext, CELL_GCM_LOCATION_LOCAL );
void *pointer=NULL;
GCM_FUNC( cellGcmSetInlineTransferPointer, dstVidOffset, 4*ROWS, &pointer);
float *fp = (float*)pointer;
@ -369,6 +373,7 @@ template <int ROWS, int COLS, int ORDER> static void setMatrixSharedfpIndex (voi
template <int ROWS, int COLS, int ORDER> static void setMatrixSharedfpIndexArray (void *data, const void* __restrict v, const int index )
{
CellGcmContextData *thisContext = (CellGcmContextData*)gCellGcmCurrentContext;
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;
@ -398,7 +403,7 @@ template <int ROWS, int COLS, int ORDER> static void setMatrixSharedfpIndexArray
tmp[row*4 + 3] = (( 3 < COLS ) ? (( ORDER == ROW_MAJOR ) ? u[row * COLS + 3] : u[3 * ROWS + row] ) : 0 );
}
GCM_FUNC( cellGcmSetTransferLocation, CELL_GCM_LOCATION_LOCAL );
rglGcmSetTransferLocation(thisContext, CELL_GCM_LOCATION_LOCAL );
void *pointer=NULL;
@ -1349,8 +1354,7 @@ GLAPI void APIENTRY glClear( GLbitfield mask )
if (!driver->rtValid)
return;
GCM_FUNC( cellGcmSetClearColor, 0 );
rglGcmSetClearColor(thisContext, 0 );
rglGcmSetClearSurface(thisContext, CELL_GCM_CLEAR_R | CELL_GCM_CLEAR_G |
CELL_GCM_CLEAR_B | CELL_GCM_CLEAR_A );
rglGcmSetInvalidateVertexCache(thisContext);