(RGL PS3) Inline SetVertexProgramParameter blocks for some instances

This commit is contained in:
twinaphex 2013-04-15 19:31:12 +02:00
parent 80a56bedae
commit 9b56355577
3 changed files with 59 additions and 9 deletions

View File

@ -284,6 +284,11 @@ static inline GLuint rglPlatformGetBitsPerPixel (GLenum internalFormat)
(thisContext->current)[1] = ((surface->height - (((surface->height) & 0x1000) >> 12)) | ((origin) << 12) | ((pixelCenter) << 16)); \
(thisContext->current) += 2;
#define rglGcmSetUpdateFragmentProgramParameter(thisContext, offset, location) \
(thisContext->current)[0] = (((1) << (18)) | ((0x000008e4))); \
(thisContext->current)[1] = ((location+1) | (offset)); \
(thisContext->current) += 2;
static inline void rglGcmSetVertexProgramParameterBlock(struct CellGcmContextData *thisContext,
uint32_t baseConst, uint32_t constCount, const float * __restrict value)
{

View File

@ -3126,9 +3126,16 @@ GLAPI void RGL_EXPORT psglSwap (void)
}
rglGcmDriver *driver = (rglGcmDriver*)_CurrentDevice->rasterDriver;
const char * __restrict v = driver->sharedVPConstants;
float * __restrict v = (float*)driver->sharedVPConstants;
thisContext->current[0] = (((33) << (18)) | ((0x00001efc)));
thisContext->current[1] = 0;
__builtin_memcpy(&thisContext->current[2], v, sizeof(float)*16);
__builtin_memcpy(&thisContext->current[18], &v[16], sizeof(float)*16);
thisContext->current += 34;
v += 32;
rglGcmSetVertexProgramParameterBlock(thisContext, 0, 8, ( float* )v );
rglGcmSetDitherEnable(thisContext, RGLGCM_TRUE );
RGLcontext *context = (RGLcontext*)_CurrentContext;

View File

@ -183,7 +183,13 @@ template<int SIZE> static void setVectorTypeSharedvpIndex (void *data, const voi
memcpy(driver->sharedVPConstants + resource * 4 * sizeof( float ),
dst, 4 * sizeof(float));
rglGcmSetVertexProgramParameterBlock(thisContext, resource, 1, dst );
thisContext->current[0] = (((5) << (18)) | ((0x00001efc)));
thisContext->current[1] = resource;
thisContext->current += 2;
__builtin_memcpy(thisContext->current, dst, sizeof(float)*4);
thisContext->current += 4;
dst += 4;
}
template<int SIZE> static void setVectorTypeSharedvpIndexArray (void *data, const void* __restrict v, const int index )
@ -203,7 +209,13 @@ template<int SIZE> static void setVectorTypeSharedvpIndexArray (void *data, cons
memcpy(driver->sharedVPConstants + resource * 4 * sizeof( float ),
dst, 4 * sizeof(float));
rglGcmSetVertexProgramParameterBlock(thisContext, resource, 1, dst );
thisContext->current[0] = (((5) << (18)) | ((0x00001efc)));
thisContext->current[1] = resource;
thisContext->current += 2;
__builtin_memcpy(thisContext->current, dst, sizeof(float)*4);
thisContext->current += 4;
dst += 4;
}
@ -1761,7 +1773,12 @@ GLAPI void APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count)
case CG_FIXED2:
case CG_FIXED3:
case CG_FIXED4:
rglGcmSetVertexProgramParameterBlock(thisContext, parameterResource->resource, 1, value );
thisContext->current[0] = (((5) << (18)) | ((0x00001efc)));
thisContext->current[1] = (parameterResource->resource);
thisContext->current += 2;
__builtin_memcpy(thisContext->current, value, sizeof(float)*4);
thisContext->current += 4;
value += 4;
break;
case CG_FLOAT4x4:
case CG_HALF4x4:
@ -1787,7 +1804,17 @@ GLAPI void APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count)
v2[13] = value[7];
v2[14] = value[11];
v2[15] = value[15];
rglGcmSetVertexProgramParameterBlock(thisContext, parameterResource->resource, 4, v2 );
const float * __restrict v3 = v2;
thisContext->current[0] = (((17) << (18)) | ((0x00001efc)));
thisContext->current[1] = parameterResource->resource;
thisContext->current += 2;
for (i=0; i < 4; ++i)
{
__builtin_memcpy(thisContext->current, v3, sizeof(float)*4);
thisContext->current += 4;
v3 += 4;
}
}
break;
case CG_FLOAT3x3:
@ -1801,7 +1828,18 @@ GLAPI void APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count)
v2[0] = value[0];v2[1] = value[3];v2[2] = value[6];v2[3] = 0;
v2[4] = value[1];v2[5] = value[4];v2[6] = value[7];v2[7] = 0;
v2[8] = value[2];v2[9] = value[5];v2[10] = value[8];v2[11] = 0;
rglGcmSetVertexProgramParameterBlock(thisContext, parameterResource->resource, 3, v2 );
const float * __restrict v3 = v2;
thisContext->current[0] = (((13) << (18)) | ((0x00001efc)));
thisContext->current[1] = parameterResource->resource;
thisContext->current += 2;
for (i=0; i < 3; ++i)
{
__builtin_memcpy(thisContext->current, v3, sizeof(float)*4);
thisContext->current += 4;
v3 += 4;
}
}
break;
}
@ -2093,8 +2131,8 @@ beginning:
rglGcmSetInvalidateVertexCache(thisContext);
}
GCM_FUNC( cellGcmSetUpdateFragmentProgramParameter,
gmmIdToOffset( driver->fpLoadProgramId ) + driver->fpLoadProgramOffset );
uint32_t offset = gmmIdToOffset( driver->fpLoadProgramId ) + driver->fpLoadProgramOffset;
cellGcmSetUpdateFragmentProgramParameterLocationUnsafeInline(thisContext, offset, CELL_GCM_LOCATION_LOCAL);
uint8_t gcmMode = 0;