(RGL) More cleanups pt. 4

This commit is contained in:
twinaphex 2013-01-04 05:39:31 +01:00
parent 92c6f0aa45
commit e1314a6d32
11 changed files with 145 additions and 143 deletions

View File

@ -2,8 +2,7 @@
#define _cg_internal_h
#ifdef __cplusplus
extern "C"
{
extern "C" {
#endif
//Hardware shader settings
@ -152,7 +151,7 @@ extern "C"
CgProgramHeader;
#ifdef __cplusplus
} // Close scope of 'extern "C"' declaration that encloses file.
}
#endif
#endif

View File

@ -1,29 +1,29 @@
#ifndef _RGLReportInternal_h
#define _RGLReportInternal_h
#ifndef _RGL_REPORT_INTERNAL_H
#define _RGL_REPORT_INTERNAL_H
#include "../export/RGL/rgl.h"
#ifdef __cplusplus
extern "C"
{
extern "C" {
#endif
typedef struct
{
GLenum e;
const char *s;
}RGLenumMap;
typedef struct
{
GLenum e;
const char *s;
} RGLenumMap;
const char *rglMapLookupEnum( const RGLenumMap* map, unsigned int count, GLenum e );
GLenum rglMapLookupString( const RGLenumMap* map, unsigned int count, const char *s );
const char *rglMapLookupEnum( const RGLenumMap* map, unsigned int count, GLenum e );
GLenum rglMapLookupString( const RGLenumMap* map, unsigned int count, const char *s );
#define _RGL_MAP_LOOKUP_ENUM(MAP,ENUM) rglMapLookupEnum(MAP,sizeof(MAP)/sizeof(MAP[0]),ENUM)
#define _RGL_MAP_LOOKUP_STRING(MAP,STRING) rglMapLookupString(MAP,sizeof(MAP)/sizeof(MAP[0]),STRING)
const char *rglGetGLEnumName( GLenum e );
const char *rglGetGLErrorName( GLenum e );
const char *rglGetGLEnumName( GLenum e );
const char *rglGetGLErrorName( GLenum e );
#ifdef __cplusplus
} // Close scope of 'extern "C"' declaration that encloses file.
}
#endif
#endif

View File

@ -1,5 +1,5 @@
#ifndef _RGLTypes_h
#define _RGLTypes_h
#ifndef _RGL_TYPES_H
#define _RGL_TYPES_H
#include <stdlib.h>
#include <float.h>
@ -34,20 +34,14 @@ struct rglFramebuffer
#ifdef __cplusplus
extern "C"
{
extern "C" {
#endif
typedef float RGLFColorComponent;
typedef float RGLCoordinate;
typedef unsigned int rglBitfield;
#define RGLBIT_GET(f,n) ((f) & (1<<(n)))
#define RGLBIT_TRUE(f,n) ((f) |= (1<<(n)))
#define RGLBIT_FALSE(f,n) ((f) &= ~(1<<(n)))
#define RGLBIT_ASSIGN(f,n,val) do { if(val) RGLBIT_TRUE(f,n); else RGLBIT_FALSE(f,n); } while(0)
#define ALIGN16 __attribute__((aligned (16)))
#define _RGL_RESTRICT __restrict
@ -288,9 +282,9 @@ extern "C"
rglAttribute attrib[RGL_MAX_VERTEX_ATTRIBS];
// bitfields corresponding to the attrib[] array elements:
rglBitfield DirtyMask; // 1 == attribute has changed & needs updating
rglBitfield EnabledMask; // 1 == attribute is enabled for drawing
rglBitfield HasVBOMask; // 1 == attribute is in a VBO (ie server-side)
unsigned int DirtyMask; // 1 == attribute has changed & needs updating
unsigned int EnabledMask; // 1 == attribute is enabled for drawing
unsigned int HasVBOMask; // 1 == attribute is in a VBO (ie server-side)
} ALIGN16 rglAttributeState;
struct rglBufferObject
@ -432,8 +426,7 @@ extern "C"
#endif
#ifdef __cplusplus
} // Close scope of 'extern "C"' declaration which encloses file.
}
#endif
#endif // _RGLTypes_h
#endif

View File

@ -14,11 +14,11 @@
extern "C" {
#endif
extern RGL_EXPORT RGLcontext* _CurrentContext;
extern RGLdevice* _CurrentDevice;
extern RGL_EXPORT char* rglVersion;
extern RGL_EXPORT RGLcontext* _CurrentContext;
extern RGLdevice* _CurrentDevice;
extern RGL_EXPORT char* rglVersion;
// only for internal purpose
// only for internal purpose
#define GL_UNSIGNED_BYTE_4_4 0x4A00
#define GL_UNSIGNED_BYTE_4_4_REV 0x4A01
#define GL_UNSIGNED_BYTE_6_2 0x4A02
@ -137,10 +137,8 @@ static inline rglFramebuffer *rglGetFramebufferSafe( RGLcontext *LContext, GLuin
}
void rglFramebufferGetAttachmentTexture( RGLcontext* LContext, const rglFramebufferAttachment* attachment, rglTexture** texture, GLuint* face );
GLenum rglPlatformFramebufferCheckStatus( rglFramebuffer* framebuffer );
GLboolean rglPlatformGenerateMipmap( rglTexture* texture, GLuint face );
GLenum rglPlatformFramebufferCheckStatus (void *data);
void rglPlatformFramebufferGetParameteriv( GLenum pname, GLint* params );
void rglPlatformResolveFramebuffer();
void rglGetFramebufferSize( GLuint* width, GLuint* height );
//----------------------------------------
@ -249,12 +247,11 @@ void rglValidateVertexConstants (void);
//----------------------------------------
int rglPlatformBufferObjectSize (void);
GLboolean rglPlatformCreateBufferObject( rglBufferObject* bufferObject );
void rglPlatformDestroyBufferObject( rglBufferObject* bufferObject );
void rglPlatformBufferObjectSetData( rglBufferObject* bufferObject, GLintptr offset, GLsizeiptr size, const GLvoid *data, GLboolean tryImmediateCopy );
void rglPlatformDestroyBufferObject (void *data);
void rglPlatformBufferObjectSetData (void *buf_data, GLintptr offset, GLsizeiptr size, const GLvoid *data, GLboolean tryImmediateCopy );
GLvoid rglPlatformBufferObjectCopyData (void *dst, void *src);
// map / unmap buffers. Internally refcounted
char *rglPlatformBufferObjectMap( rglBufferObject* bufferObject, GLenum access );
GLboolean rglPlatformBufferObjectUnmap( rglBufferObject* bufferObject );
char *rglPlatformBufferObjectMap (void *data, GLenum access );
GLboolean rglPlatformBufferObjectUnmap (void *data);
void rglPlatformGetBufferParameteriv( rglBufferObject *bufferObject, GLenum pname, int *params );
// this is shared in glBindTexture and cgGL code

View File

@ -1,10 +1,10 @@
void rglGcmFifoFinish (rglGcmFifo *fifo);
GLboolean rglGcmFifoReferenceInUse (rglGcmFifo *fifo, GLuint reference);
GLuint rglGcmFifoPutReference (rglGcmFifo *fifo);
void rglGcmFifoFlush (rglGcmFifo *fifo);
uint32_t * rglGcmFifoWaitForFreeSpace (rglGcmFifo *fifo, GLuint spaceInWords);
void rglGcmGetTileRegionInfo (void* data, GLuint *address, GLuint *size);
GLboolean rglGcmTryResizeTileRegion( GLuint address, GLuint size, void* data );
void rglGcmFifoFinish (void *data);
GLboolean rglGcmFifoReferenceInUse (void *data, GLuint reference);
GLuint rglGcmFifoPutReference (void *data);
void rglGcmFifoFlush (void *data);
uint32_t *rglGcmFifoWaitForFreeSpace (void *data, GLuint spaceInWords);
void rglGcmGetTileRegionInfo (void *data, GLuint *address, GLuint *size);
GLboolean rglGcmTryResizeTileRegion( GLuint address, GLuint size, void *data);
void rglGcmTransferData (GLuint dstId, GLuint dstIdOffset,
GLint dstPitch, GLuint srcId, GLuint srcIdOffset,
@ -14,8 +14,8 @@ int32_t rglOutOfSpaceCallback (struct CellGcmContextData* fifoContext, uint32_t
void rglGcmFifoGlSetRenderTarget (rglGcmRenderTargetEx const * const args);
void rglpFifoGlFinish (void);
void rglCreatePushBuffer (void *data);
void rglSetDefaultValuesFP( _CGprogram *program );
void rglSetDefaultValuesVP( _CGprogram *program );
void rglSetDefaultValuesFP (void *data);
void rglSetDefaultValuesVP (void *data);
void rglGcmSend( unsigned int dstId, unsigned dstOffset, unsigned int pitch, const char *src, unsigned int size );
void rglGcmMemcpy( const GLuint dstId, unsigned dstOffset, unsigned int pitch, const GLuint srcId, GLuint srcOffset, unsigned int size );
void rglPlatformValidateTextureResources (void *data);

View File

@ -6,9 +6,9 @@
// incorrect in the case of NaN.
#define RGLGCM_CLAMPF_01(x) ((x) >= 0.0f ? ((x) > 1.0f ? 1.0f : (x)) : 0.0f)
static inline GLboolean rglIsDrawableColorFormat( GLenum colorFormat )
static inline GLboolean rglIsDrawableColorFormat (GLenum colorFormat)
{
switch ( colorFormat )
switch (colorFormat)
{
case RGLGCM_ARGB8:
case RGLGCM_FLOAT_R32:
@ -18,9 +18,9 @@ static inline GLboolean rglIsDrawableColorFormat( GLenum colorFormat )
}
}
static inline GLuint rglPlatformGetBitsPerPixel( GLenum internalFormat )
static inline GLuint rglPlatformGetBitsPerPixel (GLenum internalFormat)
{
switch ( internalFormat )
switch (internalFormat)
{
case RGLGCM_ALPHA16:
case RGLGCM_HILO8:
@ -485,7 +485,7 @@ static inline void rglGcmMapTextureFormat( GLuint internalFormat, uint8_t *gcmFo
}
// Fast conversion for values between 0.0 and 65535.0
static inline GLuint RGLGCM_QUICK_FLOAT2UINT( const GLfloat f )
static inline GLuint RGLGCM_QUICK_FLOAT2UINT (const GLfloat f)
{
union
{
@ -871,7 +871,7 @@ static inline void rglFifoGlProgramParameterfvVP (const void *data, const CgPara
const _CGprogram *program = (const _CGprogram*)data;
const CgParameterResource *parameterResource = rglGetParameterResource( program, parameterEntry );
if ( parameterResource->resource != ( unsigned short ) - 1 )
if (parameterResource->resource != (unsigned short) - 1)
{
switch ( parameterResource->type )
{
@ -974,6 +974,6 @@ static inline void rglFifoGlProgramParameterfvVP (const void *data, const CgPara
static inline GLuint rglGcmGetBufferObjectOrigin (GLuint buffer)
{
rglBufferObject *bufferObject = (rglBufferObject*)_CurrentContext->bufferObjectNameSpace.data[buffer];
rglGcmBufferObject *gcmBuffer = ( rglGcmBufferObject * ) & bufferObject->platformBufferObject;
rglGcmBufferObject *gcmBuffer = (rglGcmBufferObject *)bufferObject->platformBufferObject;
return gcmBuffer->bufferId;
}

View File

@ -119,7 +119,7 @@ struct rglPlatformFramebuffer: public rglFramebuffer
memset( &rt, 0, sizeof( rt ) );
};
virtual ~rglPlatformFramebuffer() {};
void validate( PSGLcontext *LContext );
void validate (void *data);
};
typedef struct

View File

@ -1601,24 +1601,22 @@ void rglGcmCopySurface(
const uint32_t c_rounded_size_ofrglDrawParams = (sizeof(rglDrawParams)+0x7f)&~0x7f;
void rglGcmFifoFinish( rglGcmFifo *fifo )
void rglGcmFifoFinish (void *data)
{
rglGcmFifo *fifo = (rglGcmFifo*)data;
GLuint ref = rglGcmFifoPutReference( fifo );
rglGcmFifoFlush( fifo );
for ( ;; )
{
if ( !rglGcmFifoReferenceInUse( fifo, ref ) )
break;
sys_timer_usleep( 10 );
}
while (rglGcmFifoReferenceInUse(fifo, ref))
sys_timer_usleep(10);
}
void rglGcmFifoFlush( rglGcmFifo *fifo )
void rglGcmFifoFlush (void *data)
{
rglGcmFifo *fifo = (rglGcmFifo*)data;
unsigned int offsetInBytes = 0;
cellGcmAddressToOffset( fifo->current, ( uint32_t * )&offsetInBytes );
cellGcmFlush();
@ -1629,16 +1627,15 @@ void rglGcmFifoFlush( rglGcmFifo *fifo )
fifo->lastSWReferenceFlushed = fifo->lastSWReferenceWritten;
}
GLuint rglGcmFifoPutReference( rglGcmFifo *fifo )
GLuint rglGcmFifoPutReference (void *data)
{
rglGcmFifo *fifo = (rglGcmFifo*)data;
fifo->lastSWReferenceWritten++;
GCM_FUNC( cellGcmSetReferenceCommand, fifo->lastSWReferenceWritten );
if (( fifo->lastSWReferenceWritten & 0x7fffffff ) == 0 )
{
rglGcmFifoFinish( fifo );
}
return fifo->lastSWReferenceWritten;
}
@ -1650,17 +1647,16 @@ GLuint rglGcmFifoReadReference( rglGcmFifo *fifo )
return ref;
}
GLboolean rglGcmFifoReferenceInUse( rglGcmFifo *fifo, GLuint reference )
GLboolean rglGcmFifoReferenceInUse (void *data, GLuint reference)
{
rglGcmFifo *fifo = (rglGcmFifo*)data;
// compare against cached hw ref value (accounting wrap)
if ( !(( fifo->lastHWReferenceRead - reference ) & 0x80000000 ) )
return GL_FALSE;
// has the reference already been flushed out ?
if (( fifo->lastSWReferenceFlushed - reference ) & 0x80000000 )
{
rglGcmFifoFlush( fifo );
}
// read current hw reference
rglGcmFifoReadReference( fifo );
@ -1675,17 +1671,22 @@ GLboolean rglGcmFifoReferenceInUse( rglGcmFifo *fifo, GLuint reference )
// Wait until the requested space is available.
// If not currently available, will call the out of space callback
uint32_t * rglGcmFifoWaitForFreeSpace( rglGcmFifo *fifo, GLuint spaceInWords )
uint32_t * rglGcmFifoWaitForFreeSpace (void *data, GLuint spaceInWords)
{
rglGcmFifo *fifo = (rglGcmFifo*)data;
if ( fifo->current + spaceInWords + 1024 > fifo->end )
rglOutOfSpaceCallback( fifo, spaceInWords );
return rglGcmState_i.fifo.current;
}
void rglGcmFifoInit( rglGcmFifo *fifo, void *dmaControl, unsigned long dmaPushBufferOffset, uint32_t*dmaPushBuffer,
void rglGcmFifoInit (void *data, void *dmaControl, unsigned long dmaPushBufferOffset, uint32_t*dmaPushBuffer,
GLuint dmaPushBufferSize )
{
rglGcmFifo *fifo = (rglGcmFifo*)data;
// init fifoBlockSize
fifo->fifoBlockSize = DEFAULT_FIFO_BLOCK_SIZE;
@ -1735,9 +1736,9 @@ void rglGcmFifoInit( rglGcmFifo *fifo, void *dmaControl, unsigned long dmaPushBu
GL INITIALIZATION
============================================================ */
void rglGcmSetOpenGLState( rglGcmState *rglGcmSt )
void rglGcmSetOpenGLState (void *data)
{
rglGcmState *rglGcmSt = (rglGcmState*)data;
GLuint i;
// initialize the default OpenGL state
@ -1797,15 +1798,14 @@ GLboolean rglGcmInitFromRM( rglGcmResource *rmResource )
rglGcmFifoFinish( &rglGcmSt->fifo );
// Set the GPU to a known state
rglGcmSetOpenGLState( rglGcmSt );
rglGcmSetOpenGLState(rglGcmSt);
// wait for setup to complete
rglGcmFifoFinish( &rglGcmSt->fifo );
rglGcmFifoFinish(&rglGcmSt->fifo);
return GL_TRUE;
}
void rglGcmDestroy(void)
{
rglGcmState *rglGcmSt = &rglGcmState_i;

View File

@ -170,9 +170,9 @@ int rglGcmGenerateProgram( _CGprogram *program, int profileIndex, const CgProgra
rglCreatePushBuffer( program );
if ( profileIndex == FRAGMENT_PROFILE_INDEX )
rglSetDefaultValuesFP( program ); // modifies the ucode
rglSetDefaultValuesFP(program); // modifies the ucode
else
rglSetDefaultValuesVP( program ); // modifies the push buffer
rglSetDefaultValuesVP(program); // modifies the push buffer
// not loaded yet
program->loadProgramId = GMM_ERROR;

View File

@ -1070,11 +1070,12 @@ void rglCreatePushBuffer(void *data)
//this function sets the embedded constant to their default value in the ucode of a fragment shader
//it's called at setup time right after loading the program. this function could be removed if the
//default values were already in the shader code
void rglSetDefaultValuesVP( _CGprogram *program )
void rglSetDefaultValuesVP (void *data)
{
_CGprogram *program = (_CGprogram*)data;
int count = program->defaultValuesIndexCount;
for ( int i = 0;i < count;i++ )
for (int i = 0; i < count; i++)
{
int index = ( int )program->defaultValuesIndices[i].entryIndex;
CgRuntimeParameter *rtParameter = program->runtimeParameters + index;
@ -1113,9 +1114,11 @@ void rglSetDefaultValuesVP( _CGprogram *program )
}
}
void rglSetDefaultValuesFP( _CGprogram *program )
void rglSetDefaultValuesFP (void *data)
{
_CGprogram *program = (_CGprogram*)data;
int count = program->defaultValuesIndexCount;
for ( int i = 0;i < count;i++ )
{
const void * __restrict pItemDefaultValues = program->defaultValues + program->defaultValuesIndices[i].defaultValueIndex;
@ -1218,10 +1221,14 @@ static void rglpsAllocateBuffer(rglBufferObject* bufferObject)
}
}
int rglpBufferObjectSize(void) { return sizeof(rglGcmBufferObject); }
GLboolean rglpCreateBufferObject( rglBufferObject* bufferObject )
int rglpBufferObjectSize(void)
{
return sizeof(rglGcmBufferObject);
}
GLboolean rglpCreateBufferObject (void *data)
{
rglBufferObject *bufferObject = (rglBufferObject*)data;
rglGcmBufferObject *rglBuffer = ( rglGcmBufferObject * )bufferObject->platformBufferObject;
rglBuffer->pool = RGLGCM_SURFACE_POOL_NONE;
@ -1236,40 +1243,41 @@ GLboolean rglpCreateBufferObject( rglBufferObject* bufferObject )
return rglBuffer->bufferId != GMM_ERROR;
}
void rglPlatformDestroyBufferObject( rglBufferObject* bufferObject )
void rglPlatformDestroyBufferObject (void *data)
{
rglBufferObject *bufferObject = (rglBufferObject*)data;
rglDeallocateBuffer( bufferObject );
}
void rglPlatformBufferObjectSetData( rglBufferObject* bufferObject, GLintptr offset, GLsizeiptr size, const GLvoid *data, GLboolean tryImmediateCopy )
void rglPlatformBufferObjectSetData(void *buf_data, GLintptr offset, GLsizeiptr size, const GLvoid *data, GLboolean tryImmediateCopy)
{
rglBufferObject *bufferObject = (rglBufferObject*)buf_data;
rglGcmDriver *driver = (rglGcmDriver*)_CurrentDevice->rasterDriver;
rglGcmBufferObject *rglBuffer = ( rglGcmBufferObject * )bufferObject->platformBufferObject;
if ( size == bufferObject->size && tryImmediateCopy )
__builtin_memcpy( gmmIdToAddress( rglBuffer->bufferId ) + offset, data, size );
else
if ( size >= bufferObject->size )
{
// reallocate the buffer
// To avoid waiting for the GPU to finish with the buffer, just
// allocate a whole new one.
rglBuffer->bufferSize = rglPad( size, RGL_BUFFER_OBJECT_BLOCK_SIZE );
rglpsAllocateBuffer( bufferObject );
else if ( size >= bufferObject->size )
{
// reallocate the buffer
// To avoid waiting for the GPU to finish with the buffer, just
// allocate a whole new one.
rglBuffer->bufferSize = rglPad( size, RGL_BUFFER_OBJECT_BLOCK_SIZE );
rglpsAllocateBuffer( bufferObject );
// copy directly to newly allocated memory
// TODO: For GPU destination, should we copy to system memory and
// pull from GPU?
switch ( rglBuffer->pool )
{
case RGLGCM_SURFACE_POOL_NONE:
rglSetError( GL_OUT_OF_MEMORY );
return;
default:
__builtin_memcpy( gmmIdToAddress( rglBuffer->bufferId ), data, size );
break;
}
// copy directly to newly allocated memory
// TODO: For GPU destination, should we copy to system memory and
// pull from GPU?
switch ( rglBuffer->pool )
{
case RGLGCM_SURFACE_POOL_NONE:
rglSetError( GL_OUT_OF_MEMORY );
return;
default:
__builtin_memcpy( gmmIdToAddress( rglBuffer->bufferId ), data, size );
break;
}
}
else
{
if ( tryImmediateCopy )
@ -1296,22 +1304,20 @@ GLvoid rglPlatformBufferObjectCopyData(void *bufferObjectDst, void *bufferObject
rglGcmBufferObject* dst = (rglGcmBufferObject*)in_dst->platformBufferObject;
rglGcmBufferObject* src = (rglGcmBufferObject*)in_src->platformBufferObject;
// copy data
// There is currently no requirement to copy from one pool to another.
rglGcmMemcpy( dst->bufferId, 0, dst->pitch, src->bufferId, 0, src->bufferSize );
// be conservative here. Whenever we write to any Buffer Object, invalidate the vertex cache
driver->invalidateVertexCache = GL_TRUE;
}
char *rglPlatformBufferObjectMap( rglBufferObject* bufferObject, GLenum access )
char *rglPlatformBufferObjectMap (void *data, GLenum access)
{
rglGcmBufferObject *rglBuffer = ( rglGcmBufferObject * )bufferObject->platformBufferObject;
rglBufferObject *bufferObject = (rglBufferObject*)data;
rglGcmBufferObject *rglBuffer = (rglGcmBufferObject*)bufferObject->platformBufferObject;
if ( rglBuffer->mapCount++ == 0 )
if (rglBuffer->mapCount++ == 0)
{
if ( access == GL_WRITE_ONLY )
if (access == GL_WRITE_ONLY)
{
// replace entire buffer
// To avoid waiting for the GPU to finish using the buffer,
@ -1344,10 +1350,11 @@ char *rglPlatformBufferObjectMap( rglBufferObject* bufferObject, GLenum access )
return gmmIdToAddress( rglBuffer->bufferId );
}
GLboolean rglPlatformBufferObjectUnmap( rglBufferObject* bufferObject )
GLboolean rglPlatformBufferObjectUnmap (void *data)
{
// can't unmap if not mapped
rglBufferObject *bufferObject = (rglBufferObject*)data;
rglGcmBufferObject *rglBuffer = ( rglGcmBufferObject * )bufferObject->platformBufferObject;
// can't unmap if not mapped
if ( --rglBuffer->mapCount == 0 )
{
@ -1459,7 +1466,7 @@ void rglFBClear( GLbitfield mask )
PLATFORM FRAMEBUFFER
============================================================ */
rglFramebuffer* rglCreateFramebuffer( void )
rglFramebuffer* rglCreateFramebuffer (void)
{
rglFramebuffer* framebuffer = new rglPlatformFramebuffer();
return framebuffer;
@ -1473,8 +1480,9 @@ void rglDestroyFramebuffer (void *data)
delete framebuffer;
}
GLenum rglPlatformFramebufferCheckStatus( rglFramebuffer* framebuffer )
GLenum rglPlatformFramebufferCheckStatus (void *data)
{
rglFramebuffer *framebuffer = (rglFramebuffer*)data;
RGLcontext* LContext = _CurrentContext;
GLuint nBuffers = 0; // number of attached buffers
@ -1595,8 +1603,9 @@ static GLuint rglGetGcmImageOffset (void *data, GLuint face, GLuint level)
return 0;
}
void rglPlatformFramebuffer::validate( RGLcontext *LContext )
void rglPlatformFramebuffer::validate (void *data)
{
RGLcontext *LContext = (RGLcontext*)data;
complete = (rglPlatformFramebufferCheckStatus(this) == GL_FRAMEBUFFER_COMPLETE_OES);
if (!complete)
@ -1746,11 +1755,11 @@ void rglPlatformRasterExit (void *data)
gmmFree( driver->sharedFPConstantsId );
free( driver->sharedVPConstants );
if ( driver )
free( driver );
if (driver)
free(driver);
}
void rglDumpFifo( char * name );
void rglDumpFifo (char *name);
// Fast rendering path called by several glDraw calls:
// glDrawElements, glDrawRangeElements, glDrawArrays
@ -1856,7 +1865,7 @@ void rglPlatformRasterFlush (void)
rglGcmFifoGlFlush();
}
void rglpFifoGlFinish( void )
void rglpFifoGlFinish (void)
{
GCM_FUNC_NO_ARGS( cellGcmSetInvalidateVertexCache );
rglGcmFifoFinish( &rglGcmState_i.fifo );
@ -1889,12 +1898,12 @@ GLuint rglValidateAttributesSlow (void *data, GLboolean *isMain)
// which attributes are known to need updating?
// (due to being dirty or enabled client-side arrays)
rglBitfield needsUpdateMask = ( as->DirtyMask | ( as->EnabledMask & ~as->HasVBOMask ) );
unsigned int needsUpdateMask = (as->DirtyMask | (as->EnabledMask & ~as->HasVBOMask));
// for any remaining attributes that need updating, do it now.
if(needsUpdateMask)
{
for(GLuint i = 0; i < RGL_MAX_VERTEX_ATTRIBS; ++i)
for (GLuint i = 0; i < RGL_MAX_VERTEX_ATTRIBS; ++i)
{
// skip this attribute if not needing update
if (!RGLBIT_GET( needsUpdateMask, i))
@ -1998,14 +2007,15 @@ GLuint rglGetGcmTextureSize (void *data)
// Get size of a texture
int rglPlatformTextureSize()
int rglPlatformTextureSize (void)
{
return sizeof( rglGcmTexture );
return sizeof(rglGcmTexture);
}
// Calculate pitch for a texture
static GLuint _getTexturePitch(const rglTexture * texture)
static GLuint _getTexturePitch (const void *data)
{
const rglTexture *texture = (const rglTexture*)data;
return rglPad( rglGetStorageSize( texture->image->format, texture->image->type, texture->image->width, 1, 1 ), 64 ); // TransferVid2Vid needs 64byte pitch alignment
}
@ -2128,13 +2138,13 @@ static inline GLenum unFilter( GLenum filter )
// Choose a texture layout and store it to newLayout, based on texture's filtering mode, swizzling, and size
void rglPlatformChooseGPUFormatAndLayout(
const rglTexture* texture,
GLboolean forceLinear,
GLuint pitch,
rglGcmTextureLayout* newLayout )
const void *data, GLboolean forceLinear,
GLuint pitch, rglGcmTextureLayout* newLayout )
{
const rglTexture *texture = (const rglTexture*)data;
rglImage *image = texture->image + texture->baseLevel;
#if 0
GLuint levels = rglLog2( MAX( MAX( image->width, image->height ), image->depth ) ) + 1;
levels = MIN( levels, texture->maxLevel + 1 );
@ -2142,6 +2152,9 @@ void rglPlatformChooseGPUFormatAndLayout(
// This is to avoid a big cost when switching from mipmaps to non-mipmaps.
if (( texture->minFilter == GL_LINEAR ) || ( texture->minFilter == GL_NEAREST ) )
levels = 1;
#else
GLuint levels = 1;
#endif
newLayout->levels = levels;
newLayout->faces = texture->faceCount;
@ -2150,7 +2163,7 @@ void rglPlatformChooseGPUFormatAndLayout(
newLayout->baseDepth = image->depth;
newLayout->internalFormat = ( rglGcmEnum )image->internalFormat;
newLayout->pixelBits = rglPlatformGetBitsPerPixel( newLayout->internalFormat );
newLayout->pitch = pitch ? pitch : _getTexturePitch( texture );
newLayout->pitch = pitch ? pitch : _getTexturePitch(texture);
}
// texture strategy actions
@ -2493,7 +2506,7 @@ static inline void rglGcmUpdateGcmTexture (void *data_tex, void *data_layout, vo
}
// map RGL internal types to GCM
void rglGcmUpdateMethods(void *data)
void rglGcmUpdateMethods (void *data)
{
rglTexture *texture = (rglTexture*)data;
rglGcmTexture *platformTexture = ( rglGcmTexture * )texture->platformTexture;

View File

@ -27,8 +27,8 @@ extern void rglpValidateBlending(void);
extern void rglpValidateShaderSRGBRemap(void);
extern int rglpBufferObjectSize(void);
extern GLboolean rglpCreateBufferObject(rglBufferObject* bufferObject);
extern GLboolean rglpCreateBufferObject (void *data);
void rglpFifoGlFinish( void );
void rglpFifoGlFinish (void);
#endif