mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-23 11:18:25 +00:00
(RGL) Cleanups
This commit is contained in:
parent
538797d4fd
commit
150f38f884
@ -350,8 +350,6 @@ extern "C" {
|
||||
GLclampf DepthNear;
|
||||
GLclampf DepthFar;
|
||||
|
||||
GLenum PerspectiveCorrectHint;
|
||||
|
||||
rglAttributeState defaultAttribs0; // a default rglAttributeState, for bind = 0
|
||||
rglAttributeState *attribs; // ptr to current rglAttributeState
|
||||
|
||||
@ -404,7 +402,6 @@ extern "C" {
|
||||
struct _CGprogram* BoundFragmentProgram;
|
||||
unsigned int LastFPConstantModification;
|
||||
|
||||
GLboolean AllowTXPDemotion;
|
||||
GLboolean VSync;
|
||||
GLboolean SkipFirstVSync;
|
||||
|
||||
|
@ -39,8 +39,6 @@ extern void rglContextFree( RGLcontext* LContext );
|
||||
extern void rglSetError( GLenum error );
|
||||
void rglAttachContext( RGLdevice *device, RGLcontext* context );
|
||||
void rglDetachContext( RGLdevice *device, RGLcontext* context );
|
||||
void rglInvalidateAllStates (void *data);
|
||||
void rglResetAttributeState(void *data);
|
||||
void rglSetFlipHandler(void (*handler)(const GLuint head), RGLdevice *device);
|
||||
void rglSetVBlankHandler(void (*handler)(const GLuint head), RGLdevice *device);
|
||||
|
||||
|
@ -3197,7 +3197,10 @@ GLAPI void RGL_EXPORT psglSwap (void)
|
||||
GCM_FUNC( cellGcmSetVertexProgramParameterBlock, 0, 8, ( float* )v ); // GCM_PORT_UNTESTED [KHOFF]
|
||||
|
||||
rglGcmFifoGlEnable( RGLGCM_DITHER );
|
||||
rglInvalidateAllStates( _CurrentContext );
|
||||
|
||||
RGLcontext *context = (RGLcontext*)_CurrentContext;
|
||||
context->needValidate = RGL_VALIDATE_ALL;
|
||||
context->attribs->DirtyMask = ( 1 << RGL_MAX_VERTEX_ATTRIBS ) - 1;
|
||||
|
||||
rglGcmFifoGlFlush();
|
||||
|
||||
@ -3227,26 +3230,6 @@ GLAPI void RGL_EXPORT psglSwap (void)
|
||||
}
|
||||
}
|
||||
|
||||
void rglpValidateBlending(void)
|
||||
{
|
||||
RGLcontext* LContext = _CurrentContext;
|
||||
|
||||
if ((LContext->Blending))
|
||||
{
|
||||
GCM_FUNC( cellGcmSetBlendEnable, LContext->Blending );
|
||||
|
||||
rglGcmFifoGlBlendColor(
|
||||
LContext->BlendColor.R,
|
||||
LContext->BlendColor.G,
|
||||
LContext->BlendColor.B,
|
||||
LContext->BlendColor.A);
|
||||
rglGcmFifoGlBlendEquation(
|
||||
(rglGcmEnum)LContext->BlendEquationRGB,
|
||||
(rglGcmEnum)LContext->BlendEquationAlpha);
|
||||
rglGcmFifoGlBlendFunc((rglGcmEnum)LContext->BlendFactorSrcRGB,(rglGcmEnum)LContext->BlendFactorDestRGB,(rglGcmEnum)LContext->BlendFactorSrcAlpha,(rglGcmEnum)LContext->BlendFactorDestAlpha);
|
||||
}
|
||||
}
|
||||
|
||||
/*============================================================
|
||||
BUFFERS
|
||||
============================================================ */
|
||||
@ -3721,25 +3704,10 @@ DECLARE_C_TYPES
|
||||
typedef GLfloat type_GL_FLOAT;
|
||||
typedef GLhalfARB type_GL_HALF_FLOAT_ARB;
|
||||
|
||||
static inline type_GL_FLOAT rglFloatTo_GL_FLOAT(float v)
|
||||
{
|
||||
return v;
|
||||
}
|
||||
|
||||
static inline float rglFloatFrom_GL_FLOAT(type_GL_FLOAT v)
|
||||
{
|
||||
return v;
|
||||
}
|
||||
|
||||
static inline type_GL_HALF_FLOAT_ARB rglFloatTo_GL_HALF_FLOAT_ARB(float x)
|
||||
{
|
||||
return rglFloatToHalf(x);
|
||||
}
|
||||
|
||||
static inline float rglFloatFrom_GL_HALF_FLOAT_ARB(type_GL_HALF_FLOAT_ARB x)
|
||||
{
|
||||
return rglHalfToFloat(x);
|
||||
}
|
||||
#define rglFloatTo_GL_FLOAT(v) (v)
|
||||
#define rglFloatFrom_GL_FLOAT(v) (v)
|
||||
#define rglFloatTo_GL_HALF_FLOAT_ARB(x) (rglFloatToHalf(x))
|
||||
#define rglFloatFrom_GL_HALF_FLOAT_ARB(x) (rglHalfToFloat(x))
|
||||
|
||||
#define DECLARE_PACKED_TYPE_AND_REV_2(REALTYPE,S1,S2) \
|
||||
DECLARE_PACKED_TYPE(GL_##REALTYPE,GL_##REALTYPE##_##S1##_##S2,2,S1,S2,0,0,) \
|
||||
@ -4014,25 +3982,12 @@ GLAPI GLenum APIENTRY glGetError(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void rglGetTextureIntegerv( GLenum pname, GLint* params )
|
||||
{
|
||||
switch ( pname )
|
||||
{
|
||||
case GL_MAX_TEXTURE_SIZE:
|
||||
params[0] = RGLP_MAX_TEXTURE_SIZE;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "rglGetTextureIntegerv: enum not supported.\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
GLAPI void APIENTRY glGetIntegerv(GLenum pname, GLint* params)
|
||||
{
|
||||
switch (pname)
|
||||
{
|
||||
case GL_MAX_TEXTURE_SIZE:
|
||||
rglGetTextureIntegerv(pname, params);
|
||||
params[0] = RGLP_MAX_TEXTURE_SIZE;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "glGetIntegerv: enum not supported.\n");
|
||||
@ -4040,47 +3995,6 @@ GLAPI void APIENTRY glGetIntegerv(GLenum pname, GLint* params)
|
||||
}
|
||||
}
|
||||
|
||||
void rglResetAttributeState(void *data)
|
||||
{
|
||||
rglAttributeState *as = (rglAttributeState*)data;
|
||||
|
||||
for ( int i = 0; i < RGL_MAX_VERTEX_ATTRIBS; ++i )
|
||||
{
|
||||
as->attrib[i].clientSize = 4;
|
||||
as->attrib[i].clientType = GL_FLOAT;
|
||||
as->attrib[i].clientStride = 16;
|
||||
as->attrib[i].clientData = NULL;
|
||||
|
||||
as->attrib[i].value[0] = 0.0f;
|
||||
as->attrib[i].value[1] = 0.0f;
|
||||
as->attrib[i].value[2] = 0.0f;
|
||||
as->attrib[i].value[3] = 1.0f;
|
||||
|
||||
as->attrib[i].normalized = GL_FALSE;
|
||||
as->attrib[i].frequency = 1;
|
||||
|
||||
as->attrib[i].arrayBuffer = 0;
|
||||
}
|
||||
|
||||
as->attrib[RGL_ATTRIB_PRIMARY_COLOR_INDEX].value[0] = 1.0f;
|
||||
as->attrib[RGL_ATTRIB_PRIMARY_COLOR_INDEX].value[1] = 1.0f;
|
||||
as->attrib[RGL_ATTRIB_PRIMARY_COLOR_INDEX].value[2] = 1.0f;
|
||||
as->attrib[RGL_ATTRIB_PRIMARY_COLOR_INDEX].value[3] = 1.0f;
|
||||
|
||||
as->attrib[RGL_ATTRIB_SECONDARY_COLOR_INDEX].value[0] = 1.0f;
|
||||
as->attrib[RGL_ATTRIB_SECONDARY_COLOR_INDEX].value[1] = 1.0f;
|
||||
as->attrib[RGL_ATTRIB_SECONDARY_COLOR_INDEX].value[2] = 1.0f;
|
||||
as->attrib[RGL_ATTRIB_SECONDARY_COLOR_INDEX].value[3] = 1.0f;
|
||||
|
||||
as->attrib[RGL_ATTRIB_NORMAL_INDEX].value[0] = 0.f;
|
||||
as->attrib[RGL_ATTRIB_NORMAL_INDEX].value[1] = 0.f;
|
||||
as->attrib[RGL_ATTRIB_NORMAL_INDEX].value[2] = 1.f;
|
||||
|
||||
as->DirtyMask = ( 1 << RGL_MAX_VERTEX_ATTRIBS ) - 1;
|
||||
as->EnabledMask = 0;
|
||||
as->HasVBOMask = 0;
|
||||
}
|
||||
|
||||
static void rglResetContext (void *data)
|
||||
{
|
||||
RGLcontext *LContext = (RGLcontext*)data;
|
||||
@ -4095,8 +4009,6 @@ static void rglResetContext (void *data)
|
||||
LContext->ViewPort.XSize = 0;
|
||||
LContext->ViewPort.YSize = 0;
|
||||
|
||||
LContext->PerspectiveCorrectHint = GL_DONT_CARE;
|
||||
|
||||
LContext->DepthNear = 0.f;
|
||||
LContext->DepthFar = 1.f;
|
||||
|
||||
@ -4141,7 +4053,44 @@ static void rglResetContext (void *data)
|
||||
LContext->packAlignment = 4;
|
||||
LContext->unpackAlignment = 4;
|
||||
|
||||
rglResetAttributeState( &LContext->defaultAttribs0 );
|
||||
rglAttributeState *as = (rglAttributeState*)&LContext->defaultAttribs0;
|
||||
|
||||
for ( int i = 0; i < RGL_MAX_VERTEX_ATTRIBS; ++i )
|
||||
{
|
||||
as->attrib[i].clientSize = 4;
|
||||
as->attrib[i].clientType = GL_FLOAT;
|
||||
as->attrib[i].clientStride = 16;
|
||||
as->attrib[i].clientData = NULL;
|
||||
|
||||
as->attrib[i].value[0] = 0.0f;
|
||||
as->attrib[i].value[1] = 0.0f;
|
||||
as->attrib[i].value[2] = 0.0f;
|
||||
as->attrib[i].value[3] = 1.0f;
|
||||
|
||||
as->attrib[i].normalized = GL_FALSE;
|
||||
as->attrib[i].frequency = 1;
|
||||
|
||||
as->attrib[i].arrayBuffer = 0;
|
||||
}
|
||||
|
||||
as->attrib[RGL_ATTRIB_PRIMARY_COLOR_INDEX].value[0] = 1.0f;
|
||||
as->attrib[RGL_ATTRIB_PRIMARY_COLOR_INDEX].value[1] = 1.0f;
|
||||
as->attrib[RGL_ATTRIB_PRIMARY_COLOR_INDEX].value[2] = 1.0f;
|
||||
as->attrib[RGL_ATTRIB_PRIMARY_COLOR_INDEX].value[3] = 1.0f;
|
||||
|
||||
as->attrib[RGL_ATTRIB_SECONDARY_COLOR_INDEX].value[0] = 1.0f;
|
||||
as->attrib[RGL_ATTRIB_SECONDARY_COLOR_INDEX].value[1] = 1.0f;
|
||||
as->attrib[RGL_ATTRIB_SECONDARY_COLOR_INDEX].value[2] = 1.0f;
|
||||
as->attrib[RGL_ATTRIB_SECONDARY_COLOR_INDEX].value[3] = 1.0f;
|
||||
|
||||
as->attrib[RGL_ATTRIB_NORMAL_INDEX].value[0] = 0.f;
|
||||
as->attrib[RGL_ATTRIB_NORMAL_INDEX].value[1] = 0.f;
|
||||
as->attrib[RGL_ATTRIB_NORMAL_INDEX].value[2] = 1.f;
|
||||
|
||||
as->DirtyMask = ( 1 << RGL_MAX_VERTEX_ATTRIBS ) - 1;
|
||||
as->EnabledMask = 0;
|
||||
as->HasVBOMask = 0;
|
||||
|
||||
LContext->attribs = &LContext->defaultAttribs0;
|
||||
|
||||
LContext->framebuffer = 0;
|
||||
@ -4157,9 +4106,6 @@ static void rglResetContext (void *data)
|
||||
LContext->TextureBuffer = 0;
|
||||
|
||||
LContext->VSync = GL_FALSE;
|
||||
|
||||
LContext->AllowTXPDemotion = GL_FALSE;
|
||||
|
||||
}
|
||||
|
||||
RGLcontext* psglCreateContext(void)
|
||||
@ -4261,13 +4207,6 @@ void RGL_EXPORT psglDestroyContext (void *data)
|
||||
free( LContext );
|
||||
}
|
||||
|
||||
void rglInvalidateAllStates (void *data)
|
||||
{
|
||||
RGLcontext *context = (RGLcontext*)data;
|
||||
context->needValidate = RGL_VALIDATE_ALL;
|
||||
context->attribs->DirtyMask = ( 1 << RGL_MAX_VERTEX_ATTRIBS ) - 1;
|
||||
}
|
||||
|
||||
void rglAttachContext (RGLdevice *device, RGLcontext* context)
|
||||
{
|
||||
if (!context->everAttached)
|
||||
@ -4277,7 +4216,9 @@ void rglAttachContext (RGLdevice *device, RGLcontext* context)
|
||||
context->needValidate |= RGL_VALIDATE_VIEWPORT | RGL_VALIDATE_SCISSOR_BOX;
|
||||
context->everAttached = GL_TRUE;
|
||||
}
|
||||
rglInvalidateAllStates( context );
|
||||
|
||||
context->needValidate = RGL_VALIDATE_ALL;
|
||||
context->attribs->DirtyMask = ( 1 << RGL_MAX_VERTEX_ATTRIBS ) - 1;
|
||||
}
|
||||
|
||||
GLAPI void APIENTRY glEnable( GLenum cap )
|
||||
|
@ -2015,9 +2015,9 @@ static GLuint rglValidateStates (GLuint mask)
|
||||
conf.fragmentControl = fragmentControl;
|
||||
conf.registerCount = program->header.fragmentProgram.registerCount < 2 ? 2 : program->header.fragmentProgram.registerCount;
|
||||
|
||||
uint32_t controlTxp = _CurrentContext->AllowTXPDemotion;
|
||||
conf.fragmentControl &= ~CELL_GCM_MASK_SET_SHADER_CONTROL_CONTROL_TXP;
|
||||
conf.fragmentControl |= controlTxp << CELL_GCM_SHIFT_SET_SHADER_CONTROL_CONTROL_TXP;
|
||||
/* TODO - look into this */
|
||||
conf.fragmentControl |= 0 << CELL_GCM_SHIFT_SET_SHADER_CONTROL_CONTROL_TXP;
|
||||
|
||||
GCM_FUNC( cellGcmSetFragmentProgramLoad, &conf );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user