(RGL PS3) Integrate rglFifoGlVertexAttribPointer into glDrawArrays

This commit is contained in:
twinaphex 2013-03-30 06:36:04 +01:00
parent 58a98e3043
commit 4e86a05225
3 changed files with 57 additions and 71 deletions

View File

@ -84,8 +84,7 @@ extern "C" {
static inline void *rglGetNamedValue(void *data, unsigned int name )
{
struct rglNameSpace *ns = (struct rglNameSpace*)data;
return ns->data[name - 1];
return ((struct rglNameSpace*)data)->data[name - 1];
}
void rglTexNameSpaceInit(void *data, rglTexNameSpaceCreateFunction create, rglTexNameSpaceDestroyFunction destroy );

View File

@ -288,71 +288,6 @@ static inline void rglGcmFifoGlIncFenceRef (GLuint *ref)
*ref = rglGcmFifoPutReference( fifo );
}
static inline void rglGcmFifoGlVertexAttribPointer
(
GLuint index,
GLint size,
rglGcmEnum type,
GLboolean normalized,
GLsizei stride,
GLushort frequency,
GLuint offset
)
{
// syntax check
switch ( size )
{
case 0: // disable
stride = 0;
normalized = 0;
type = RGLGCM_FLOAT;
offset = 0;
break;
case 1:
case 2:
case 3:
case 4:
// valid
break;
default:
break;
}
// mapping to native types
uint8_t gcmType = 0;
switch ( type )
{
case RGLGCM_UNSIGNED_BYTE:
if (normalized)
gcmType = CELL_GCM_VERTEX_UB;
else
gcmType = CELL_GCM_VERTEX_UB256;
break;
case RGLGCM_SHORT:
gcmType = normalized ? CELL_GCM_VERTEX_S1 : CELL_GCM_VERTEX_S32K;
break;
case RGLGCM_FLOAT:
gcmType = CELL_GCM_VERTEX_F;
break;
case RGLGCM_HALF_FLOAT:
gcmType = CELL_GCM_VERTEX_SF;
break;
case RGLGCM_CMP:
size = 1; // required for this format
gcmType = CELL_GCM_VERTEX_CMP;
break;
default:
break;
}
GCM_FUNC( cellGcmSetVertexDataArray, index, frequency, stride, size, gcmType, CELL_GCM_LOCATION_LOCAL, offset );
}
// Look up the memory location of a buffer object (VBO, PBO)
static inline GLuint rglGcmGetBufferObjectOrigin (GLuint buffer)
{

View File

@ -2000,7 +2000,7 @@ beginning:
rglAttribute* attrib = as->attrib + i;
if ( RGLBIT_GET( as->EnabledMask, i ) )
{
const GLsizei stride = attrib->clientStride;
GLsizei stride = attrib->clientStride;
const GLuint freq = attrib->frequency;
if ( RGL_UNLIKELY( dparams->attribXferSize[i] ) )
@ -2027,9 +2027,61 @@ beginning:
+ (( const GLubyte* )attrib->clientData - ( const GLubyte* )NULL );
}
rglGcmFifoGlVertexAttribPointer( i, attrib->clientSize,
( rglGcmEnum )attrib->clientType, attrib->normalized,
stride, freq, gpuOffset );
rglGcmEnum type = (rglGcmEnum)attrib->clientType;
GLint size = attrib->clientSize;
// syntax check
switch ( size )
{
case 0: // disable
stride = 0;
attrib->normalized = 0;
type = RGLGCM_FLOAT;
gpuOffset = 0;
break;
case 1:
case 2:
case 3:
case 4:
// valid
break;
default:
break;
}
// mapping to native types
uint8_t gcmType = 0;
switch ( type )
{
case RGLGCM_UNSIGNED_BYTE:
if (attrib->normalized)
gcmType = CELL_GCM_VERTEX_UB;
else
gcmType = CELL_GCM_VERTEX_UB256;
break;
case RGLGCM_SHORT:
gcmType = attrib->normalized ? CELL_GCM_VERTEX_S1 : CELL_GCM_VERTEX_S32K;
break;
case RGLGCM_FLOAT:
gcmType = CELL_GCM_VERTEX_F;
break;
case RGLGCM_HALF_FLOAT:
gcmType = CELL_GCM_VERTEX_SF;
break;
case RGLGCM_CMP:
size = 1; // required for this format
gcmType = CELL_GCM_VERTEX_CMP;
break;
default:
break;
}
GCM_FUNC( cellGcmSetVertexDataArray, i, freq, stride, size, gcmType, CELL_GCM_LOCATION_LOCAL, gpuOffset );
}
else
{