(RGL PS3) Get rid of GCM_FUNC macros and useless constants

This commit is contained in:
twinaphex 2013-11-18 11:46:11 +01:00
parent c4da45783e
commit 7e619fa758
4 changed files with 22 additions and 82 deletions

View File

@ -10,39 +10,8 @@
#endif
#define FRAGMENT_PROFILE_INDEX 1
#define RGLP_MAX_TEXTURE_SIZE 4096
// GCM RESERVE and no RGLGCM post fifo SKID Check
#define GCM_RESERVE_NO_SKID
#ifdef GCM_RESERVE_NO_SKID
#define GCM_FUNC_RESERVE( count )\
CELL_GCM_RESERVE(count);
#define GCM_FUNC_SAFE( GCM_FUNCTION, ...) \
{ \
GCM_FUNCTION( (CellGcmContextData*)&rglGcmState_i.fifo, __VA_ARGS__ ); \
}
#define GCM_FUNC_SAFE_NO_ARGS( GCM_FUNCTION, ...) \
{ \
GCM_FUNCTION( (CellGcmContextData*)&rglGcmState_i.fifo ); \
}
#define GCM_FUNC( GCM_FUNCTION, ...) \
{ \
GCM_FUNCTION ## Inline( (CellGcmContextData*)&rglGcmState_i.fifo, __VA_ARGS__ ); \
}
#define GCM_FUNC_NO_ARGS( GCM_FUNCTION ) \
{ \
GCM_FUNCTION ## Inline( (CellGcmContextData*)&rglGcmState_i.fifo ); \
}
#endif
typedef enum rglGcmEnum
{
// gleSetRenderTarget
@ -264,12 +233,8 @@ typedef enum rglGcmEnum
// for the corresponding RGLGCM routines, using a semaphore instead of the
// fence mechanism (so IncFence uses the 3D class).
#define RGLGCM_FALSE 0
#define RGLGCM_MAX_COLOR_SURFACES 4
#define RGLGCM_TRUE 1
// allocation unit for buffer objects
// Each buffer object is allocated to a multiple of this block size. This
// must be at least 64 so that nv_glTransferDataVidToVid() can be used to
@ -336,15 +301,9 @@ enum
};
// For quick float->int conversions
#define RGLGCM_F0_DOT_0 12582912.0f
#define RGLGCM_F0_DOT_0 12582912.0f
// some other useful push buf defines/commands
#define RGLGCM_NON_INCREMENT (0x40000000)
#define RGLGCM_NOP() (0x00000000)
#define RGLGCM_JUMP(addr) (0x20000000 | (addr))
#define RGLGCM_CALL(addr) (0x00000002 | (addr))
#define RGLGCM_RETURN() (0x00020000)
#define RGLGCM_MAX_METHOD_COUNT (2047)
#define RGLGCM_COUNT_SHIFT (18)
#define RGLGCM_SUBCHANNEL_SHIFT (13)
#define RGLGCM_METHOD_SHIFT (0)
@ -382,15 +341,6 @@ enum {
#define RGLGCM_DEVICE_SYNC_FENCE 1
#define RGLGCM_DEVICE_SYNC_COND 2
// max surface/scissor/viewport dimension
#define RGLGCM_MAX_RT_DIMENSION (CELL_GCM_MAX_RT_DIMENSION)
// a few texture consts
#define RGLGCM_MAX_SHADER_TEXCOORD_COUNT (CELL_GCM_MAX_SHADER_TEXCOORD_COUNT)
#define RGLGCM_MAX_TEXIMAGE_COUNT (CELL_GCM_MAX_TEXIMAGE_COUNT)
#define RGLGCM_MAX_LOD_COUNT (CELL_GCM_MAX_LOD_COUNT)
#define RGLGCM_MAX_TEX_DIMENSION (CELL_GCM_MAX_TEX_DIMENSION)
// max attrib count
#define RGLGCM_ATTRIB_COUNT 16
@ -433,17 +383,10 @@ enum {
#define RGLGCM_SUBPIXEL_ADJUST (0.5/(1<<12))
#define RGLGCM_VIEWPORT_EPSILON 0.0f
// max vertex program constant slots
#define RGLGCM_VTXPRG_MAX_CONST (CELL_GCM_VTXPRG_MAX_CONST)
#define RGLGCM_VTXPRG_MAX_INST (CELL_GCM_VTXPRG_MAX_INST)
#define RGLGCM_HAS_INVALIDATE_TILE
#define RGLGCM_TILED_BUFFER_ALIGNMENT 0x10000 // 64KB
#define RGLGCM_TILED_BUFFER_HEIGHT_ALIGNMENT 64
#define RGLGCM_MAX_TILED_REGIONS 15
#define RGLP_BUFFER_OBJECT_SIZE() (sizeof(rglGcmBufferObject))
#endif

View File

@ -712,11 +712,11 @@ static inline void rglGcmFifoGlViewport(void *data, GLclampf zNear, GLclampf zFa
if (clipY0 < 0)
clipY0 = 0;
if (clipX1 >= RGLGCM_MAX_RT_DIMENSION)
clipX1 = RGLGCM_MAX_RT_DIMENSION;
if (clipX1 >= CELL_GCM_MAX_RT_DIMENSION)
clipX1 = CELL_GCM_MAX_RT_DIMENSION;
if (clipY1 >= RGLGCM_MAX_RT_DIMENSION)
clipY1 = RGLGCM_MAX_RT_DIMENSION;
if (clipY1 >= CELL_GCM_MAX_RT_DIMENSION)
clipY1 = CELL_GCM_MAX_RT_DIMENSION;
if ((clipX1 <= clipX0) || (clipY1 <= clipY0))
clipX0 = clipY0 = clipX1 = clipY1 = 0;

View File

@ -1557,17 +1557,17 @@ GLboolean rglGcmInitFromRM( rglGcmResource *rmResource )
rglGcmSetBlendEquation(gCellGcmCurrentContext, RGLGCM_FUNC_ADD, RGLGCM_FUNC_ADD );
rglGcmSetBlendFunc(gCellGcmCurrentContext, RGLGCM_ONE, RGLGCM_ZERO, RGLGCM_ONE, RGLGCM_ZERO );
rglGcmSetClearColor(gCellGcmCurrentContext, 0 );
rglGcmSetBlendEnable(gCellGcmCurrentContext, RGLGCM_FALSE );
rglGcmSetBlendEnableMrt(gCellGcmCurrentContext, RGLGCM_FALSE, RGLGCM_FALSE, RGLGCM_FALSE );
rglGcmSetBlendEnable(gCellGcmCurrentContext, false );
rglGcmSetBlendEnableMrt(gCellGcmCurrentContext, false, false, false );
for ( i = 0; i < RGLGCM_ATTRIB_COUNT; i++ )
{
rglGcmSetVertexDataArray(gCellGcmCurrentContext, i, 0, 0, 0, CELL_GCM_VERTEX_F, CELL_GCM_LOCATION_LOCAL, 0);
}
rglGcmSetDitherEnable(gCellGcmCurrentContext, RGLGCM_TRUE );
rglGcmSetDitherEnable(gCellGcmCurrentContext, true );
for ( i = 0; i < RGLGCM_MAX_TEXIMAGE_COUNT; i++ )
for ( i = 0; i < CELL_GCM_MAX_TEXIMAGE_COUNT; i++ )
{
static const GLuint borderColor = 0;
@ -1589,8 +1589,8 @@ GLboolean rglGcmInitFromRM( rglGcmResource *rmResource )
rglGcmViewportState *v = &rglGcmState_i.state.viewport;
v->x = 0;
v->y = 0;
v->w = RGLGCM_MAX_RT_DIMENSION;
v->h = RGLGCM_MAX_RT_DIMENSION;
v->w = CELL_GCM_MAX_RT_DIMENSION;
v->h = CELL_GCM_MAX_RT_DIMENSION;
rglGcmFifoGlViewport(v, 0.0f, 1.0f );
// wait for setup to complete
@ -2473,7 +2473,7 @@ static void rescInit( const RGLdeviceParameters* params, rglGcmDevice *gcmDevice
GLuint colorBuffersPitch;
uint32_t numColorBuffers = cellRescGetNumColorBuffers( dstBufferMode, ( CellRescPalTemporalMode )conf.palTemporalMode, 0 );
result = rglGcmAllocateColorSurface(params->width, params->height * numColorBuffers,
4*8, RGLGCM_TRUE, 1, &(gcmDevice->RescColorBuffersId), &colorBuffersPitch, &size );
4*8, true, 1, &(gcmDevice->RescColorBuffersId), &colorBuffersPitch, &size );
// set the destination buffer format and pitch
CellRescDsts dsts = { CELL_RESC_SURFACE_A8R8G8B8, colorBuffersPitch, 1 };
@ -2670,7 +2670,7 @@ int rglPlatformCreateDevice (void *data)
result = rglGcmAllocateColorSurface(
width, height, // dimensions
gcmDevice->color[i].bpp*8, // bits per sample
RGLGCM_TRUE, // scan out enable
true, // scan out enable
antiAliasingMode, // antiAliasing
&gcmDevice->color[i].dataId, // returned buffer
&gcmDevice->color[i].pitch,
@ -2963,7 +2963,7 @@ GLAPI void RGL_EXPORT psglSwap (void)
thisContext->current[0] = (((33) << (18)) | CELL_GCM_NV4097_SET_TRANSFORM_CONSTANT_LOAD);
thisContext->current[1] = 0;
rglGcmSetDitherEnable(thisContext, RGLGCM_TRUE );
rglGcmSetDitherEnable(thisContext, true );
RGLcontext *context = (RGLcontext*)_CurrentContext;
context->needValidate = RGL_VALIDATE_ALL;
@ -3708,13 +3708,10 @@ GLAPI GLenum APIENTRY glGetError(void)
{
if (!_CurrentContext )
return GL_INVALID_OPERATION;
else
{
GLenum error = _CurrentContext->error;
_CurrentContext->error = GL_NO_ERROR;
return error;
}
GLenum error = _CurrentContext->error;
_CurrentContext->error = GL_NO_ERROR;
return error;
}
GLAPI void APIENTRY glGetIntegerv(GLenum pname, GLint* params)

View File

@ -1177,8 +1177,8 @@ void rglPlatformFramebuffer::validate (void *data)
if (!complete)
return;
GLuint width = RGLGCM_MAX_RT_DIMENSION;
GLuint height = RGLGCM_MAX_RT_DIMENSION;
GLuint width = CELL_GCM_MAX_RT_DIMENSION;
GLuint height = CELL_GCM_MAX_RT_DIMENSION;
// color
rt.colorBufferCount = 0;
@ -1239,7 +1239,7 @@ void rglPlatformFramebuffer::validate (void *data)
rt.width = width;
rt.height = height;
rt.yInverted = RGLGCM_FALSE;
rt.yInverted = false;
rt.xOffset = 0;
rt.yOffset = 0;
needValidate = GL_FALSE;
@ -1271,7 +1271,7 @@ void *rglPlatformRasterInit (void)
rglGcmDriver *driver = (rglGcmDriver*)malloc(sizeof(rglGcmDriver));
memset(driver, 0, sizeof(rglGcmDriver));
driver->rt.yInverted = RGLGCM_TRUE;
driver->rt.yInverted = true;
driver->invalidateVertexCache = GL_FALSE;
driver->flushBufferCount = 0;
@ -1620,7 +1620,7 @@ GLAPI void APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count)
rglGcmSetFragmentProgramLoad(thisContext, &conf, CELL_GCM_LOCATION_LOCAL);
rglGcmSetZMinMaxControl(thisContext, ( program->header.fragmentProgram.flags & CGF_DEPTHREPLACE ) ? RGLGCM_FALSE : RGLGCM_TRUE, RGLGCM_FALSE, RGLGCM_FALSE );
rglGcmSetZMinMaxControl(thisContext, ( program->header.fragmentProgram.flags & CGF_DEPTHREPLACE ) ? false : true, false, false );
driver->fpLoadProgramId = program->loadProgramId;
driver->fpLoadProgramOffset = program->loadProgramOffset;