(RGL PS3) Cleanup unused stuff

This commit is contained in:
twinaphex 2013-11-01 23:12:15 +01:00
parent 933d993130
commit a6df31479a
3 changed files with 118 additions and 1445 deletions

View File

@ -1534,7 +1534,7 @@ uint32_t gmmAlloc(void *data,
uint32_t retId;
uint32_t newSize;
if (__builtin_expect((size == 0),0))
if (size == 0)
return GMM_ERROR;
pAllocator = pGmmLocalAllocator;
@ -3133,8 +3133,8 @@ GLAPI void RGL_EXPORT psglSwap (void)
thisContext->current[0] = (((33) << (18)) | CELL_GCM_NV4097_SET_TRANSFORM_CONSTANT_LOAD);
thisContext->current[1] = 0;
__builtin_memcpy(&thisContext->current[2], v, sizeof(float)*16);
__builtin_memcpy(&thisContext->current[18], &v[16], sizeof(float)*16);
memcpy(&thisContext->current[2], v, sizeof(float)*16);
memcpy(&thisContext->current[18], &v[16], sizeof(float)*16);
thisContext->current += 34;
v += 32;
@ -3283,7 +3283,7 @@ GLAPI GLboolean APIENTRY glUnmapBuffer( GLenum target )
GLAPI void APIENTRY glDeleteBuffers( GLsizei n, const GLuint *buffers )
{
RGLcontext *LContext = _CurrentContext;
RGLcontext *LContext = (RGLcontext*)_CurrentContext;
for (int i = 0; i < n; ++i)
{
if(!rglTexNameSpaceIsName(&LContext->bufferObjectNameSpace, buffers[i]))
@ -3312,13 +3312,13 @@ GLAPI void APIENTRY glDeleteBuffers( GLsizei n, const GLuint *buffers )
GLAPI void APIENTRY glGenBuffers( GLsizei n, GLuint *buffers )
{
RGLcontext *LContext = _CurrentContext;
RGLcontext *LContext = (RGLcontext*)_CurrentContext;
rglTexNameSpaceGenNames( &LContext->bufferObjectNameSpace, n, buffers );
}
GLAPI void APIENTRY glBufferData( GLenum target, GLsizeiptr size, const GLvoid * data, GLenum usage )
{
RGLcontext *LContext = _CurrentContext;
RGLcontext *LContext = (RGLcontext*)_CurrentContext;
GLuint name = 0;
@ -3355,14 +3355,14 @@ GLAPI void APIENTRY glBufferData( GLenum target, GLsizeiptr size, const GLvoid *
bufferObject->height = 0;
bufferObject->internalFormat = GL_NONE;
if ( size > 0 )
if (size)
{
GLboolean created = rglpCreateBufferObject(bufferObject);
if ( !created )
if (!rglpCreateBufferObject(bufferObject))
{
rglSetError( GL_OUT_OF_MEMORY );
return;
}
if (data)
rglPlatformBufferObjectSetData( bufferObject, 0, size, data, GL_TRUE );
}
@ -3378,18 +3378,18 @@ GLAPI void APIENTRY glClearColor( GLclampf red, GLclampf green, GLclampf blue, G
GLAPI void APIENTRY glBlendColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha )
{
RGLcontext* LContext = _CurrentContext;
LContext->BlendColor.R = rglClampf( red );
LContext->BlendColor.G = rglClampf( green );
LContext->BlendColor.B = rglClampf( blue );
LContext->BlendColor.A = rglClampf( alpha );
RGLcontext* LContext = (RGLcontext*)_CurrentContext;
LContext->BlendColor.R = rglClampf(red);
LContext->BlendColor.G = rglClampf(green);
LContext->BlendColor.B = rglClampf(blue);
LContext->BlendColor.A = rglClampf(alpha);
LContext->needValidate |= RGL_VALIDATE_BLENDING;
}
GLAPI void APIENTRY glBlendFunc( GLenum sfactor, GLenum dfactor )
{
RGLcontext* LContext = _CurrentContext;
RGLcontext* LContext = (RGLcontext*)_CurrentContext;
LContext->BlendFactorSrcRGB = sfactor;
LContext->BlendFactorSrcAlpha = sfactor;
@ -4007,9 +4007,8 @@ static void rglResetContext (void *data)
static rglTexture *rglAllocateTexture(void)
{
GLuint size = sizeof(rglTexture) + sizeof(rglGcmTexture);
rglTexture *texture = (rglTexture*)malloc(size);
memset( texture, 0, size );
rglTexture *texture = (rglTexture*)malloc(sizeof(rglTexture) + sizeof(rglGcmTexture));
memset( texture, 0, sizeof(rglTexture) + sizeof(rglGcmTexture));
texture->target = 0;
texture->minFilter = GL_NEAREST_MIPMAP_LINEAR;
texture->magFilter = GL_LINEAR;
@ -4283,8 +4282,7 @@ GLAPI const GLubyte* APIENTRY glGetString( GLenum name )
void psglInit (void *data)
{
RGLinitOptions *options = (RGLinitOptions*)data;
rglPsglPlatformInit(options);
rglPsglPlatformInit((RGLinitOptions*)data);
}
void psglExit(void)
@ -4346,7 +4344,7 @@ rglTexture *rglGetCurrentTexture (const void *data, GLenum target)
static void rglGetImage( GLenum target, GLint level, rglTexture **texture, rglImage **image, GLsizei reallocateSize )
{
RGLcontext* LContext = _CurrentContext;
rglTextureImageUnit *unit = LContext->CurrentImageUnit;
rglTextureImageUnit *unit = (rglTextureImageUnit*)LContext->CurrentImageUnit;
GLenum expectedTarget = GL_TEXTURE_2D;

File diff suppressed because it is too large Load Diff

View File

@ -192,7 +192,7 @@ template<int SIZE> static void setVectorTypeSharedvpIndex (void *data, const voi
thisContext->current[1] = resource;
thisContext->current += 2;
__builtin_memcpy(thisContext->current, dst, sizeof(float)*4);
memcpy(thisContext->current, dst, sizeof(float)*4);
thisContext->current += 4;
dst += 4;
}
@ -218,7 +218,7 @@ template<int SIZE> static void setVectorTypeSharedvpIndexArray (void *data, cons
thisContext->current[1] = resource;
thisContext->current += 2;
__builtin_memcpy(thisContext->current, dst, sizeof(float)*4);
memcpy(thisContext->current, dst, sizeof(float)*4);
thisContext->current += 4;
dst += 4;
}
@ -603,7 +603,7 @@ void rglCreatePushBuffer(void *data)
int extraStorageInWords = 0;
int offsetCount = 0;
int samplerCount = 0;
int profileIndex = ( program->header.profile == CG_PROFILE_SCE_FP_TYPEB || //program->header.profile==CG_PROFILE_SCE_FP_TYPEC ||
int profileIndex = ( program->header.profile == CG_PROFILE_SCE_FP_TYPEB ||
program->header.profile == CG_PROFILE_SCE_FP_RSX ) ? FRAGMENT_PROFILE_INDEX : VERTEX_PROFILE_INDEX;
bool hasSharedParams = false;
@ -667,9 +667,7 @@ void rglCreatePushBuffer(void *data)
{
hasSharedParams = true;
if ( !( parameterEntry->flags & CGP_CONTIGUOUS ) )
{
programPushBufferPointersSize += arrayCount;
}
}
}
else //profileIndex == FRAGMENT_PROFILE_INDEX
@ -1145,7 +1143,7 @@ void rglPlatformBufferObjectSetData(void *buf_data, GLintptr offset, GLsizeiptr
rglGcmBufferObject *rglBuffer = ( rglGcmBufferObject * )bufferObject->platformBufferObject;
if ( size == bufferObject->size && tryImmediateCopy )
__builtin_memcpy( gmmIdToAddress( rglBuffer->bufferId ) + offset, data, size );
memcpy( gmmIdToAddress( rglBuffer->bufferId ) + offset, data, size );
else if ( size >= bufferObject->size )
{
// reallocate the buffer
@ -1157,12 +1155,12 @@ void rglPlatformBufferObjectSetData(void *buf_data, GLintptr offset, GLsizeiptr
// copy directly to newly allocated memory
// TODO: For GPU destination, should we copy to system memory and
// pull from GPU?
__builtin_memcpy( gmmIdToAddress( rglBuffer->bufferId ), data, size );
memcpy( gmmIdToAddress( rglBuffer->bufferId ), data, size );
}
else
{
if ( tryImmediateCopy )
__builtin_memcpy( gmmIdToAddress( rglBuffer->bufferId ) + offset, data, size );
if (tryImmediateCopy)
memcpy( gmmIdToAddress( rglBuffer->bufferId ) + offset, data, size );
else
{
// partial buffer write
@ -1175,7 +1173,7 @@ void rglPlatformBufferObjectSetData(void *buf_data, GLintptr offset, GLsizeiptr
GLAPI void APIENTRY glBufferSubData( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data )
{
RGLcontext *LContext = _CurrentContext;
RGLcontext *LContext = (RGLcontext*)_CurrentContext;
GLuint name = 0;
switch ( target )
@ -1358,8 +1356,7 @@ GLAPI void APIENTRY glClear( GLbitfield mask )
rglFramebuffer* rglCreateFramebuffer (void)
{
rglFramebuffer* framebuffer = new rglPlatformFramebuffer();
return framebuffer;
return new rglPlatformFramebuffer();
}
void rglDestroyFramebuffer (void *data)
@ -1373,7 +1370,7 @@ void rglDestroyFramebuffer (void *data)
GLenum rglPlatformFramebufferCheckStatus (void *data)
{
rglFramebuffer *framebuffer = (rglFramebuffer*)data;
RGLcontext* LContext = _CurrentContext;
RGLcontext* LContext = (RGLcontext*)_CurrentContext;
GLuint nBuffers = 0; // number of attached buffers
int width = 0;
@ -2025,9 +2022,8 @@ beginning:
// don't transfer data that is not going to be used, from 0 to first*stride
GLuint offset = ( dparams->firstVertex / freq ) * stride;
char * b = ( char * )xferBuffer + dparams->attribXferOffset[i];
__builtin_memcpy(b + offset,
( char*)attrib->clientData + offset,
char * b = (char*)xferBuffer + dparams->attribXferOffset[i];
memcpy(b + offset, (char*)attrib->clientData + offset,
dparams->attribXferSize[i] - offset);
// draw directly from bounce buffer
@ -2417,8 +2413,7 @@ source: RGLGCM_SURFACE_SOURCE_TEXTURE,
src.dataIdOffset = 0;
// NPOT DXT
__builtin_memcpy( gmmIdToAddress( src.dataId ),
image->data, image->storageSize );
memcpy( gmmIdToAddress( src.dataId ), image->data, image->storageSize );
}
// use surface copy functions