mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-22 11:04:35 +00:00
(RGL PS3) Implement our own versions of cellGcmSetDrawArrays,
cellGcmSetClearSurface, cellGcmSetTextureControl, and cellGcmSetTextureRemap
This commit is contained in:
parent
964aff3773
commit
aed81d2dad
@ -56,6 +56,84 @@ static inline GLuint rglPlatformGetBitsPerPixel (GLenum internalFormat)
|
||||
(thisContext->current)[1] = 0; \
|
||||
(thisContext->current) += 2;
|
||||
|
||||
#define rglGcmSetClearSurface(thisContext, mask) \
|
||||
(thisContext->current)[0] = (((1) << (18)) | ((0x00001d94))); \
|
||||
(thisContext->current)[1] = (mask); \
|
||||
(thisContext->current) += 2; \
|
||||
(thisContext->current)[0] = (((1) << (18)) | ((0x00000100))); \
|
||||
(thisContext->current)[1] = 0; \
|
||||
(thisContext->current) += 2;
|
||||
|
||||
#define rglGcmSetTextureControl(thisContext, index, enable, minlod, maxlod, maxaniso) \
|
||||
(thisContext->current)[0] = (((1) << (18)) | ((0x00001a0c) + 0x20 * ((index)))); \
|
||||
(thisContext->current)[1] = ((((0) << 2) | ((maxaniso)) << 4) | (((maxlod)) << 7) | (((minlod)) << 19) | ((enable) << 31)); \
|
||||
(thisContext->current) += 2;
|
||||
|
||||
#define rglGcmSetTextureRemap(thisContext, index, remap) \
|
||||
(thisContext->current)[0] = (((1) << (18)) | ((0x00001a10) + ((index)) * 32)); \
|
||||
(thisContext->current)[1] = (remap); \
|
||||
(thisContext->current) += 2;
|
||||
|
||||
static inline void rglGcmSetDrawArrays(struct CellGcmContextData *thisContext, uint8_t mode,
|
||||
uint32_t first, uint32_t count)
|
||||
{
|
||||
uint32_t lcount;
|
||||
|
||||
--count;
|
||||
lcount = count & 0xff;
|
||||
count >>= 8;
|
||||
|
||||
uint32_t loop, rest;
|
||||
loop = count / (2047);
|
||||
rest = count % (2047);
|
||||
|
||||
(thisContext->current)[0] = (((3) << (18)) | ((0x00001714)) | (0x40000000));
|
||||
(thisContext->current)[1] = 0;
|
||||
(thisContext->current)[2] = 0;
|
||||
(thisContext->current)[3] = 0; ; (thisContext->current) += 4;
|
||||
|
||||
(thisContext->current)[0] = (((1) << (18)) | ((0x00001808)));
|
||||
(thisContext->current)[1] = ((mode));
|
||||
(thisContext->current) += 2;
|
||||
|
||||
(thisContext->current)[0] = (((1) << (18)) | ((0x00001814)));
|
||||
(thisContext->current)[1] = ((first) | ((lcount)<<24));
|
||||
(thisContext->current) += 2;
|
||||
first += lcount + 1;
|
||||
|
||||
uint32_t i,j;
|
||||
|
||||
for(i=0;i<loop;i++)
|
||||
{
|
||||
thisContext->current[0] = ((((2047)) << (18)) | ((0x00001814)) | (0x40000000));
|
||||
thisContext->current++;
|
||||
|
||||
for(j=0;j<(2047);j++)
|
||||
{
|
||||
thisContext->current[0] = ((first) | ((255U)<<24));
|
||||
thisContext->current++;
|
||||
first += 256;
|
||||
}
|
||||
}
|
||||
|
||||
if(rest)
|
||||
{
|
||||
thisContext->current[0] = (((rest) << (18)) | ((0x00001814)) | (0x40000000));
|
||||
thisContext->current++;
|
||||
|
||||
for(j=0;j<rest;j++)
|
||||
{
|
||||
thisContext->current[0] = ((first) | ((255U)<<24));
|
||||
thisContext->current++;
|
||||
first += 256;
|
||||
}
|
||||
}
|
||||
|
||||
(thisContext->current)[0] = (((1) << (18)) | ((0x00001808)));
|
||||
(thisContext->current)[1] = (0);
|
||||
(thisContext->current) += 2;
|
||||
}
|
||||
|
||||
static inline void rglGcmFifoGlViewport(void *data, GLclampf zNear, GLclampf zFar)
|
||||
{
|
||||
rglGcmViewportState *vp = (rglGcmViewportState*)data;
|
||||
|
@ -1698,6 +1698,7 @@ void rglGcmFifoInit (void *data, void *dmaControl, unsigned long dmaPushBufferOf
|
||||
void rglGcmSetOpenGLState (void *data)
|
||||
{
|
||||
rglGcmState *rglGcmSt = (rglGcmState*)data;
|
||||
CellGcmContextData *thisContext = (CellGcmContextData*)gCellGcmCurrentContext;
|
||||
GLuint i;
|
||||
|
||||
// initialize the default OpenGL state
|
||||
@ -1727,8 +1728,8 @@ void rglGcmSetOpenGLState (void *data)
|
||||
GCM_FUNC( cellGcmSetTextureFilter, i, 0, CELL_GCM_TEXTURE_NEAREST_LINEAR, CELL_GCM_TEXTURE_LINEAR,
|
||||
CELL_GCM_TEXTURE_CONVOLUTION_QUINCUNX );
|
||||
|
||||
// update the texture control to setup antisotropic settings
|
||||
GCM_FUNC( cellGcmSetTextureControl, i, CELL_GCM_TRUE, 0, 12 << 8, CELL_GCM_TEXTURE_MAX_ANISO_1 );
|
||||
// update the texture control to setup anisotropic settings
|
||||
rglGcmSetTextureControl(thisContext, i, CELL_GCM_TRUE, 0, 12 << 8, CELL_GCM_TEXTURE_MAX_ANISO_1 );
|
||||
|
||||
// update border color
|
||||
GCM_FUNC( cellGcmSetTextureBorderColor, i, borderColor );
|
||||
@ -2896,7 +2897,7 @@ int rglPlatformCreateDevice (void *data)
|
||||
rglGcmFifoGlSetRenderTarget( &gcmDevice->rt );
|
||||
|
||||
if (rglGcmState_i.renderTarget.colorFormat)
|
||||
GCM_FUNC( cellGcmSetClearSurface, CELL_GCM_CLEAR_R | CELL_GCM_CLEAR_G |
|
||||
rglGcmSetClearSurface(thisContext, CELL_GCM_CLEAR_R | CELL_GCM_CLEAR_G |
|
||||
CELL_GCM_CLEAR_B | CELL_GCM_CLEAR_A );
|
||||
}
|
||||
// restore parameters
|
||||
@ -2914,7 +2915,7 @@ int rglPlatformCreateDevice (void *data)
|
||||
rglGcmFifoGlSetRenderTarget( &gcmDevice->rt );
|
||||
|
||||
if (rglGcmState_i.renderTarget.colorFormat)
|
||||
GCM_FUNC( cellGcmSetClearSurface, CELL_GCM_CLEAR_R | CELL_GCM_CLEAR_G |
|
||||
rglGcmSetClearSurface(thisContext, CELL_GCM_CLEAR_R | CELL_GCM_CLEAR_G |
|
||||
CELL_GCM_CLEAR_B | CELL_GCM_CLEAR_A );
|
||||
}
|
||||
}
|
||||
|
@ -1351,10 +1351,8 @@ GLAPI void APIENTRY glClear( GLbitfield mask )
|
||||
|
||||
GCM_FUNC( cellGcmSetClearColor, 0 );
|
||||
|
||||
GCM_FUNC( cellGcmSetClearSurface, CELL_GCM_CLEAR_R | CELL_GCM_CLEAR_G |
|
||||
rglGcmSetClearSurface(thisContext, CELL_GCM_CLEAR_R | CELL_GCM_CLEAR_G |
|
||||
CELL_GCM_CLEAR_B | CELL_GCM_CLEAR_A );
|
||||
|
||||
|
||||
rglGcmSetInvalidateVertexCache(thisContext);
|
||||
rglGcmFifoFlush( &rglGcmState_i.fifo );
|
||||
}
|
||||
@ -1676,7 +1674,6 @@ GLAPI void APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count)
|
||||
else
|
||||
{
|
||||
// Validate incomplete texture by remapping
|
||||
//RGL_REPORT_EXTRA( RGL_REPORT_TEXTURE_INCOMPLETE, "Texture %d bound to unit %d(%s) is incomplete.", texture->name, unit, rglGetGLEnumName( texture->target ) );
|
||||
GLuint remap = CELL_GCM_REMAP_MODE(
|
||||
CELL_GCM_TEXTURE_REMAP_ORDER_XYXY,
|
||||
CELL_GCM_TEXTURE_REMAP_FROM_A,
|
||||
@ -1688,10 +1685,8 @@ GLAPI void APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count)
|
||||
CELL_GCM_TEXTURE_REMAP_ZERO,
|
||||
CELL_GCM_TEXTURE_REMAP_ZERO );
|
||||
|
||||
// disable control 0
|
||||
GCM_FUNC( cellGcmSetTextureControl, unit, CELL_GCM_FALSE, 0, 0, 0 );
|
||||
// set texture remap only
|
||||
GCM_FUNC( cellGcmSetTextureRemap, unit, remap );
|
||||
rglGcmSetTextureControl(thisContext, unit, CELL_GCM_FALSE, 0, 0, 0 ); // disable control 0
|
||||
rglGcmSetTextureRemap(thisContext, unit, remap ); // set texture remap only
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2147,7 +2142,7 @@ beginning:
|
||||
break;
|
||||
}
|
||||
|
||||
GCM_FUNC_SAFE( cellGcmSetDrawArrays, gcmMode, dparams->firstVertex, dparams->vertexCount );
|
||||
rglGcmSetDrawArrays(thisContext, gcmMode, dparams->firstVertex, dparams->vertexCount );
|
||||
}
|
||||
|
||||
// must always call this before rglPlatformDraw() to setup rglDrawParams
|
||||
|
Loading…
x
Reference in New Issue
Block a user