(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 #define _cg_internal_h
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C" {
{
#endif #endif
//Hardware shader settings //Hardware shader settings
@ -152,7 +151,7 @@ extern "C"
CgProgramHeader; CgProgramHeader;
#ifdef __cplusplus #ifdef __cplusplus
} // Close scope of 'extern "C"' declaration that encloses file. }
#endif #endif
#endif #endif

View File

@ -1,11 +1,10 @@
#ifndef _RGLReportInternal_h #ifndef _RGL_REPORT_INTERNAL_H
#define _RGLReportInternal_h #define _RGL_REPORT_INTERNAL_H
#include "../export/RGL/rgl.h" #include "../export/RGL/rgl.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C" {
{
#endif #endif
typedef struct typedef struct
@ -16,6 +15,7 @@ extern "C"
const char *rglMapLookupEnum( const RGLenumMap* map, unsigned int count, GLenum e ); const char *rglMapLookupEnum( const RGLenumMap* map, unsigned int count, GLenum e );
GLenum rglMapLookupString( const RGLenumMap* map, unsigned int count, const char *s ); 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_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) #define _RGL_MAP_LOOKUP_STRING(MAP,STRING) rglMapLookupString(MAP,sizeof(MAP)/sizeof(MAP[0]),STRING)
@ -23,7 +23,7 @@ extern "C"
const char *rglGetGLErrorName( GLenum e ); const char *rglGetGLErrorName( GLenum e );
#ifdef __cplusplus #ifdef __cplusplus
} // Close scope of 'extern "C"' declaration that encloses file. }
#endif #endif
#endif #endif

View File

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

View File

@ -137,10 +137,8 @@ static inline rglFramebuffer *rglGetFramebufferSafe( RGLcontext *LContext, GLuin
} }
void rglFramebufferGetAttachmentTexture( RGLcontext* LContext, const rglFramebufferAttachment* attachment, rglTexture** texture, GLuint* face ); void rglFramebufferGetAttachmentTexture( RGLcontext* LContext, const rglFramebufferAttachment* attachment, rglTexture** texture, GLuint* face );
GLenum rglPlatformFramebufferCheckStatus( rglFramebuffer* framebuffer ); GLenum rglPlatformFramebufferCheckStatus (void *data);
GLboolean rglPlatformGenerateMipmap( rglTexture* texture, GLuint face );
void rglPlatformFramebufferGetParameteriv( GLenum pname, GLint* params ); void rglPlatformFramebufferGetParameteriv( GLenum pname, GLint* params );
void rglPlatformResolveFramebuffer();
void rglGetFramebufferSize( GLuint* width, GLuint* height ); void rglGetFramebufferSize( GLuint* width, GLuint* height );
//---------------------------------------- //----------------------------------------
@ -249,12 +247,11 @@ void rglValidateVertexConstants (void);
//---------------------------------------- //----------------------------------------
int rglPlatformBufferObjectSize (void); int rglPlatformBufferObjectSize (void);
GLboolean rglPlatformCreateBufferObject( rglBufferObject* bufferObject ); GLboolean rglPlatformCreateBufferObject( rglBufferObject* bufferObject );
void rglPlatformDestroyBufferObject( rglBufferObject* bufferObject ); void rglPlatformDestroyBufferObject (void *data);
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 );
GLvoid rglPlatformBufferObjectCopyData (void *dst, void *src); GLvoid rglPlatformBufferObjectCopyData (void *dst, void *src);
// map / unmap buffers. Internally refcounted char *rglPlatformBufferObjectMap (void *data, GLenum access );
char *rglPlatformBufferObjectMap( rglBufferObject* bufferObject, GLenum access ); GLboolean rglPlatformBufferObjectUnmap (void *data);
GLboolean rglPlatformBufferObjectUnmap( rglBufferObject* bufferObject );
void rglPlatformGetBufferParameteriv( rglBufferObject *bufferObject, GLenum pname, int *params ); void rglPlatformGetBufferParameteriv( rglBufferObject *bufferObject, GLenum pname, int *params );
// this is shared in glBindTexture and cgGL code // this is shared in glBindTexture and cgGL code

View File

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

View File

@ -974,6 +974,6 @@ static inline void rglFifoGlProgramParameterfvVP (const void *data, const CgPara
static inline GLuint rglGcmGetBufferObjectOrigin (GLuint buffer) static inline GLuint rglGcmGetBufferObjectOrigin (GLuint buffer)
{ {
rglBufferObject *bufferObject = (rglBufferObject*)_CurrentContext->bufferObjectNameSpace.data[buffer]; rglBufferObject *bufferObject = (rglBufferObject*)_CurrentContext->bufferObjectNameSpace.data[buffer];
rglGcmBufferObject *gcmBuffer = ( rglGcmBufferObject * ) & bufferObject->platformBufferObject; rglGcmBufferObject *gcmBuffer = (rglGcmBufferObject *)bufferObject->platformBufferObject;
return gcmBuffer->bufferId; return gcmBuffer->bufferId;
} }

View File

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

View File

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

View File

@ -1070,10 +1070,11 @@ void rglCreatePushBuffer(void *data)
//this function sets the embedded constant to their default value in the ucode of a fragment shader //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 //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 //default values were already in the shader code
void rglSetDefaultValuesVP( _CGprogram *program ) void rglSetDefaultValuesVP (void *data)
{ {
_CGprogram *program = (_CGprogram*)data;
int count = program->defaultValuesIndexCount; 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; int index = ( int )program->defaultValuesIndices[i].entryIndex;
@ -1113,9 +1114,11 @@ void rglSetDefaultValuesVP( _CGprogram *program )
} }
} }
void rglSetDefaultValuesFP( _CGprogram *program ) void rglSetDefaultValuesFP (void *data)
{ {
_CGprogram *program = (_CGprogram*)data;
int count = program->defaultValuesIndexCount; int count = program->defaultValuesIndexCount;
for ( int i = 0;i < count;i++ ) for ( int i = 0;i < count;i++ )
{ {
const void * __restrict pItemDefaultValues = program->defaultValues + program->defaultValuesIndices[i].defaultValueIndex; 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); } int rglpBufferObjectSize(void)
GLboolean rglpCreateBufferObject( rglBufferObject* bufferObject )
{ {
return sizeof(rglGcmBufferObject);
}
GLboolean rglpCreateBufferObject (void *data)
{
rglBufferObject *bufferObject = (rglBufferObject*)data;
rglGcmBufferObject *rglBuffer = ( rglGcmBufferObject * )bufferObject->platformBufferObject; rglGcmBufferObject *rglBuffer = ( rglGcmBufferObject * )bufferObject->platformBufferObject;
rglBuffer->pool = RGLGCM_SURFACE_POOL_NONE; rglBuffer->pool = RGLGCM_SURFACE_POOL_NONE;
@ -1236,20 +1243,21 @@ GLboolean rglpCreateBufferObject( rglBufferObject* bufferObject )
return rglBuffer->bufferId != GMM_ERROR; return rglBuffer->bufferId != GMM_ERROR;
} }
void rglPlatformDestroyBufferObject( rglBufferObject* bufferObject ) void rglPlatformDestroyBufferObject (void *data)
{ {
rglBufferObject *bufferObject = (rglBufferObject*)data;
rglDeallocateBuffer( bufferObject ); 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; rglGcmDriver *driver = (rglGcmDriver*)_CurrentDevice->rasterDriver;
rglGcmBufferObject *rglBuffer = ( rglGcmBufferObject * )bufferObject->platformBufferObject; rglGcmBufferObject *rglBuffer = ( rglGcmBufferObject * )bufferObject->platformBufferObject;
if ( size == bufferObject->size && tryImmediateCopy ) if ( size == bufferObject->size && tryImmediateCopy )
__builtin_memcpy( gmmIdToAddress( rglBuffer->bufferId ) + offset, data, size ); __builtin_memcpy( gmmIdToAddress( rglBuffer->bufferId ) + offset, data, size );
else else if ( size >= bufferObject->size )
if ( size >= bufferObject->size )
{ {
// reallocate the buffer // reallocate the buffer
// To avoid waiting for the GPU to finish with the buffer, just // To avoid waiting for the GPU to finish with the buffer, just
@ -1296,17 +1304,15 @@ GLvoid rglPlatformBufferObjectCopyData(void *bufferObjectDst, void *bufferObject
rglGcmBufferObject* dst = (rglGcmBufferObject*)in_dst->platformBufferObject; rglGcmBufferObject* dst = (rglGcmBufferObject*)in_dst->platformBufferObject;
rglGcmBufferObject* src = (rglGcmBufferObject*)in_src->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 ); 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 // be conservative here. Whenever we write to any Buffer Object, invalidate the vertex cache
driver->invalidateVertexCache = GL_TRUE; driver->invalidateVertexCache = GL_TRUE;
} }
char *rglPlatformBufferObjectMap( rglBufferObject* bufferObject, GLenum access ) char *rglPlatformBufferObjectMap (void *data, GLenum access)
{ {
rglBufferObject *bufferObject = (rglBufferObject*)data;
rglGcmBufferObject *rglBuffer = (rglGcmBufferObject*)bufferObject->platformBufferObject; rglGcmBufferObject *rglBuffer = (rglGcmBufferObject*)bufferObject->platformBufferObject;
if (rglBuffer->mapCount++ == 0) if (rglBuffer->mapCount++ == 0)
@ -1344,10 +1350,11 @@ char *rglPlatformBufferObjectMap( rglBufferObject* bufferObject, GLenum access )
return gmmIdToAddress( rglBuffer->bufferId ); 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; rglGcmBufferObject *rglBuffer = ( rglGcmBufferObject * )bufferObject->platformBufferObject;
// can't unmap if not mapped
if ( --rglBuffer->mapCount == 0 ) if ( --rglBuffer->mapCount == 0 )
{ {
@ -1473,8 +1480,9 @@ void rglDestroyFramebuffer (void *data)
delete framebuffer; delete framebuffer;
} }
GLenum rglPlatformFramebufferCheckStatus( rglFramebuffer* framebuffer ) GLenum rglPlatformFramebufferCheckStatus (void *data)
{ {
rglFramebuffer *framebuffer = (rglFramebuffer*)data;
RGLcontext* LContext = _CurrentContext; RGLcontext* LContext = _CurrentContext;
GLuint nBuffers = 0; // number of attached buffers GLuint nBuffers = 0; // number of attached buffers
@ -1595,8 +1603,9 @@ static GLuint rglGetGcmImageOffset (void *data, GLuint face, GLuint level)
return 0; return 0;
} }
void rglPlatformFramebuffer::validate( RGLcontext *LContext ) void rglPlatformFramebuffer::validate (void *data)
{ {
RGLcontext *LContext = (RGLcontext*)data;
complete = (rglPlatformFramebufferCheckStatus(this) == GL_FRAMEBUFFER_COMPLETE_OES); complete = (rglPlatformFramebufferCheckStatus(this) == GL_FRAMEBUFFER_COMPLETE_OES);
if (!complete) if (!complete)
@ -1889,7 +1898,7 @@ GLuint rglValidateAttributesSlow (void *data, GLboolean *isMain)
// which attributes are known to need updating? // which attributes are known to need updating?
// (due to being dirty or enabled client-side arrays) // (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. // for any remaining attributes that need updating, do it now.
if(needsUpdateMask) if(needsUpdateMask)
@ -1998,14 +2007,15 @@ GLuint rglGetGcmTextureSize (void *data)
// Get size of a texture // Get size of a texture
int rglPlatformTextureSize() int rglPlatformTextureSize (void)
{ {
return sizeof(rglGcmTexture); return sizeof(rglGcmTexture);
} }
// Calculate pitch for a texture // 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 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 // Choose a texture layout and store it to newLayout, based on texture's filtering mode, swizzling, and size
void rglPlatformChooseGPUFormatAndLayout( void rglPlatformChooseGPUFormatAndLayout(
const rglTexture* texture, const void *data, GLboolean forceLinear,
GLboolean forceLinear, GLuint pitch, rglGcmTextureLayout* newLayout )
GLuint pitch,
rglGcmTextureLayout* newLayout )
{ {
const rglTexture *texture = (const rglTexture*)data;
rglImage *image = texture->image + texture->baseLevel; rglImage *image = texture->image + texture->baseLevel;
#if 0
GLuint levels = rglLog2( MAX( MAX( image->width, image->height ), image->depth ) ) + 1; GLuint levels = rglLog2( MAX( MAX( image->width, image->height ), image->depth ) ) + 1;
levels = MIN( levels, texture->maxLevel + 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. // This is to avoid a big cost when switching from mipmaps to non-mipmaps.
if (( texture->minFilter == GL_LINEAR ) || ( texture->minFilter == GL_NEAREST ) ) if (( texture->minFilter == GL_LINEAR ) || ( texture->minFilter == GL_NEAREST ) )
levels = 1; levels = 1;
#else
GLuint levels = 1;
#endif
newLayout->levels = levels; newLayout->levels = levels;
newLayout->faces = texture->faceCount; newLayout->faces = texture->faceCount;

View File

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