(RGL PS3) Slim down Cg implementation

This commit is contained in:
twinaphex 2013-03-27 19:18:48 +01:00
parent 949e2c3cae
commit a3692f8854
3 changed files with 16 additions and 2031 deletions

View File

@ -83,8 +83,6 @@ struct _CGprogram
unsigned int * samplerIndices; unsigned int * samplerIndices;
unsigned int * samplerUnits; unsigned int * samplerUnits;
unsigned int controlFlowBools;
//binary format additions //binary format additions
//info previously contained in platformProgram ( loadAddress + nvBinary ) //info previously contained in platformProgram ( loadAddress + nvBinary )
CgProgramHeader header; CgProgramHeader header;
@ -150,9 +148,6 @@ typedef struct _CGcontext
CGenum compileType; // compile manual, immediate or lazy (unused so far) CGenum compileType; // compile manual, immediate or lazy (unused so far)
unsigned int controlFlowBoolsSharedMask;
unsigned int controlFlowBoolsShared;
// default program, fake owner of the context parameters // default program, fake owner of the context parameters
_CGprogram defaultProgram; _CGprogram defaultProgram;
@ -170,16 +165,13 @@ RGL_EXPORT void rglCgRaiseError( CGerror error );
// interface between object types // interface between object types
extern void rglCgProgramDestroyAll( _CGcontext* c ); extern void rglCgProgramDestroyAll( _CGcontext* c );
extern void rglCgDestroyContextParam( CgRuntimeParameter* p ); extern void rglCgDestroyContextParam( CgRuntimeParameter* p );
RGL_EXPORT CgRuntimeParameter*rglCgCreateParameterInternal( _CGprogram *program, const char* name, CGtype type );
RGL_EXPORT void rglCgProgramErase( _CGprogram* prog ); RGL_EXPORT void rglCgProgramErase( _CGprogram* prog );
// default setters // default setters
void _cgRaiseInvalidParam( void *data, const void*v ); void _cgRaiseInvalidParam( void *data, const void*v );
void _cgRaiseNotMatrixParam( void *data, const void*v ); void _cgRaiseNotMatrixParam( void *data, const void*v );
void _cgIgnoreSetParam( void *dat, const void*v ); void _cgIgnoreSetParam( void *dat, const void*v );
void _cgRaiseInvalidParamIndex( void *dat, const void*v, const int index ); void _cgIgnoreParamIndex( void *dat, const void*v, const int index );
void _cgRaiseNotMatrixParamIndex( void *dat, const void*v, const int index );
void _cgIgnoreSetParamIndex( void *dat, const void*v, const int index );
// cg helpers // cg helpers
@ -212,7 +204,6 @@ static inline bool isSampler (CGtype type)
unsigned int rglCountFloatsInCgType( CGtype type ); unsigned int rglCountFloatsInCgType( CGtype type );
CGbool _cgMatrixDimensions( CGtype type, unsigned int* nrows, unsigned int* ncols );
unsigned int rglGetTypeRowCount( CGtype parameterType ); unsigned int rglGetTypeRowCount( CGtype parameterType );
unsigned int rglGetTypeColCount( CGtype parameterType ); unsigned int rglGetTypeColCount( CGtype parameterType );
@ -314,9 +305,8 @@ void rglPlatformSetFragmentRegisterBlock (unsigned int reg, unsigned int count,
void rglPlatformSetBoolVertexRegisters (unsigned int values ); void rglPlatformSetBoolVertexRegisters (unsigned int values );
// names API // names API
RGL_EXPORT unsigned int _cgHashString (const char *str);
inline static void _pullConnectedParameterValues (void *data) static inline void _pullConnectedParameterValues (void *data)
{ {
_CGprogram *ptr = (_CGprogram*)data; _CGprogram *ptr = (_CGprogram*)data;
// we now use a pull method to get the data into the children parameters // we now use a pull method to get the data into the children parameters

File diff suppressed because it is too large Load Diff

View File

@ -770,15 +770,12 @@ void rglCreatePushBuffer(void *data)
if ( containerEntry == NULL ) if ( containerEntry == NULL )
containerEntry = parameterEntry; containerEntry = parameterEntry;
//rtParameter->setter = _cgRaiseInvalidParam; rtParameter->samplerSetter = _cgIgnoreParamIndex;
//rtParameter->setterr = _cgRaiseNotMatrixParam;
//rtParameter->setterc = _cgRaiseNotMatrixParam;
rtParameter->samplerSetter = _cgRaiseInvalidParamIndex;
//tentative //tentative
rtParameter->setterIndex = _cgRaiseInvalidParamIndex; rtParameter->setterIndex = _cgIgnoreParamIndex;
rtParameter->setterrIndex = _cgRaiseNotMatrixParamIndex; rtParameter->setterrIndex = _cgIgnoreParamIndex;
rtParameter->settercIndex = _cgRaiseNotMatrixParamIndex; rtParameter->settercIndex = _cgIgnoreParamIndex;
CGparameter id = ( CGparameter )rglCreateName( &_CurrentContext->cgParameterNameSpace, ( void* )rtParameter ); CGparameter id = ( CGparameter )rglCreateName( &_CurrentContext->cgParameterNameSpace, ( void* )rtParameter );
if ( !id ) if ( !id )
@ -833,7 +830,7 @@ void rglCreatePushBuffer(void *data)
// the parameters should have a "validate" function instead // the parameters should have a "validate" function instead
if ( profileIndex == VERTEX_PROFILE_INDEX ) if ( profileIndex == VERTEX_PROFILE_INDEX )
{ {
rtParameter->setterIndex = _cgIgnoreSetParamIndex; rtParameter->setterIndex = _cgIgnoreParamIndex;
rtParameter->samplerSetter = setSamplervp; rtParameter->samplerSetter = setSamplervp;
} }
else else
@ -1001,17 +998,17 @@ void rglCreatePushBuffer(void *data)
{ {
case CG_FLOAT: case CG_FLOAT:
case CG_FLOAT1: case CG_FLOAT2: case CG_FLOAT3: case CG_FLOAT4: case CG_FLOAT1: case CG_FLOAT2: case CG_FLOAT3: case CG_FLOAT4:
rtParameter->setterIndex = _cgIgnoreSetParamIndex; rtParameter->setterIndex = _cgIgnoreParamIndex;
break; break;
case CG_FLOAT1x1: case CG_FLOAT1x2: case CG_FLOAT1x3: case CG_FLOAT1x4: case CG_FLOAT1x1: case CG_FLOAT1x2: case CG_FLOAT1x3: case CG_FLOAT1x4:
case CG_FLOAT2x1: case CG_FLOAT2x2: case CG_FLOAT2x3: case CG_FLOAT2x4: case CG_FLOAT2x1: case CG_FLOAT2x2: case CG_FLOAT2x3: case CG_FLOAT2x4:
case CG_FLOAT3x1: case CG_FLOAT3x2: case CG_FLOAT3x3: case CG_FLOAT3x4: case CG_FLOAT3x1: case CG_FLOAT3x2: case CG_FLOAT3x3: case CG_FLOAT3x4:
case CG_FLOAT4x1: case CG_FLOAT4x2: case CG_FLOAT4x3: case CG_FLOAT4x4: case CG_FLOAT4x1: case CG_FLOAT4x2: case CG_FLOAT4x3: case CG_FLOAT4x4:
rtParameter->setterrIndex = _cgIgnoreSetParamIndex; rtParameter->setterrIndex = _cgIgnoreParamIndex;
rtParameter->settercIndex = _cgIgnoreSetParamIndex; rtParameter->settercIndex = _cgIgnoreParamIndex;
break; break;
case CG_SAMPLER1D: case CG_SAMPLER2D: case CG_SAMPLER3D: case CG_SAMPLERRECT: case CG_SAMPLERCUBE: case CG_SAMPLER1D: case CG_SAMPLER2D: case CG_SAMPLER3D: case CG_SAMPLERRECT: case CG_SAMPLERCUBE:
rtParameter->samplerSetter = _cgIgnoreSetParamIndex; rtParameter->samplerSetter = _cgIgnoreParamIndex;
break; break;
case CGP_SCF_BOOL: case CGP_SCF_BOOL:
break; break;
@ -1023,7 +1020,7 @@ void rglCreatePushBuffer(void *data)
case CG_BOOL1: case CG_BOOL2: case CG_BOOL3: case CG_BOOL4: case CG_BOOL1: case CG_BOOL2: case CG_BOOL3: case CG_BOOL4:
case CG_FIXED: case CG_FIXED:
case CG_FIXED1: case CG_FIXED2: case CG_FIXED3: case CG_FIXED4: case CG_FIXED1: case CG_FIXED2: case CG_FIXED3: case CG_FIXED4:
rtParameter->setterIndex = _cgIgnoreSetParamIndex; rtParameter->setterIndex = _cgIgnoreParamIndex;
break; break;
case CG_HALF1x1: case CG_HALF1x2: case CG_HALF1x3: case CG_HALF1x4: case CG_HALF1x1: case CG_HALF1x2: case CG_HALF1x3: case CG_HALF1x4:
case CG_HALF2x1: case CG_HALF2x2: case CG_HALF2x3: case CG_HALF2x4: case CG_HALF2x1: case CG_HALF2x2: case CG_HALF2x3: case CG_HALF2x4:
@ -1041,8 +1038,8 @@ void rglCreatePushBuffer(void *data)
case CG_FIXED2x1: case CG_FIXED2x2: case CG_FIXED2x3: case CG_FIXED2x4: case CG_FIXED2x1: case CG_FIXED2x2: case CG_FIXED2x3: case CG_FIXED2x4:
case CG_FIXED3x1: case CG_FIXED3x2: case CG_FIXED3x3: case CG_FIXED3x4: case CG_FIXED3x1: case CG_FIXED3x2: case CG_FIXED3x3: case CG_FIXED3x4:
case CG_FIXED4x1: case CG_FIXED4x2: case CG_FIXED4x3: case CG_FIXED4x4: case CG_FIXED4x1: case CG_FIXED4x2: case CG_FIXED4x3: case CG_FIXED4x4:
rtParameter->setterrIndex = _cgIgnoreSetParamIndex; rtParameter->setterrIndex = _cgIgnoreParamIndex;
rtParameter->settercIndex = _cgIgnoreSetParamIndex; rtParameter->settercIndex = _cgIgnoreParamIndex;
break; break;
// addition to be compatible with cgc 2.0 // addition to be compatible with cgc 2.0
case CG_STRING: case CG_STRING: