mirror of
https://github.com/libretro/RetroArch
synced 2025-02-20 06:40:18 +00:00
(RGL PS3) Cleanups
This commit is contained in:
parent
6f5b28cd60
commit
664d6e6e06
@ -76,19 +76,15 @@ unsigned int rglCreateName(void *data, void* object)
|
||||
{
|
||||
rglNameSpace *name = (rglNameSpace*)data;
|
||||
// NULL is reserved for the guard of the linked list.
|
||||
if (name->firstFree == NULL)
|
||||
if (!name->firstFree)
|
||||
{
|
||||
// need to allocate more pointer space
|
||||
int newCapacity = name->capacity + NAME_INCREMENT;
|
||||
|
||||
// realloc the block of pointers
|
||||
void** newData = ( void** )malloc( newCapacity * sizeof( void* ) );
|
||||
if ( newData == NULL )
|
||||
{
|
||||
// XXX what should we generally do here ?
|
||||
rglCgRaiseError( CG_MEMORY_ALLOC_ERROR );
|
||||
if (!newData)
|
||||
return 0;
|
||||
}
|
||||
memcpy( newData, name->data, name->capacity * sizeof( void* ) );
|
||||
|
||||
if (name->data != NULL)
|
||||
@ -292,7 +288,7 @@ static uint32_t gmmInitFixedAllocator(void)
|
||||
|
||||
pGmmFixedAllocData = (GmmFixedAllocData *)malloc(sizeof(GmmFixedAllocData));
|
||||
|
||||
if (pGmmFixedAllocData == NULL)
|
||||
if (!pGmmFixedAllocData)
|
||||
return GMM_ERROR;
|
||||
|
||||
memset(pGmmFixedAllocData, 0, sizeof(GmmFixedAllocData));
|
||||
@ -303,23 +299,23 @@ static uint32_t gmmInitFixedAllocator(void)
|
||||
int blockSize = (i==0) ? sizeof(GmmBlock): sizeof(GmmTileBlock);
|
||||
|
||||
pGmmFixedAllocData->ppBlockList[i] = (char **)malloc(sizeof(char *));
|
||||
if (pGmmFixedAllocData->ppBlockList[i] == NULL)
|
||||
if (!pGmmFixedAllocData->ppBlockList[i])
|
||||
return GMM_ERROR;
|
||||
|
||||
pGmmFixedAllocData->ppBlockList[i][0] = (char *)malloc(blockSize * blockCount);
|
||||
if (pGmmFixedAllocData->ppBlockList[i][0] == NULL)
|
||||
if (!pGmmFixedAllocData->ppBlockList[i][0])
|
||||
return GMM_ERROR;
|
||||
|
||||
pGmmFixedAllocData->ppFreeBlockList[i] = (uint16_t **)malloc(sizeof(uint16_t *));
|
||||
if (pGmmFixedAllocData->ppFreeBlockList[i] == NULL)
|
||||
if (!pGmmFixedAllocData->ppFreeBlockList[i])
|
||||
return GMM_ERROR;
|
||||
|
||||
pGmmFixedAllocData->ppFreeBlockList[i][0] = (uint16_t *)malloc(sizeof(uint16_t) * blockCount);
|
||||
if (pGmmFixedAllocData->ppFreeBlockList[i][0] == NULL)
|
||||
if (!pGmmFixedAllocData->ppFreeBlockList[i][0])
|
||||
return GMM_ERROR;
|
||||
|
||||
pGmmFixedAllocData->pBlocksUsed[i] = (uint16_t *)malloc(sizeof(uint16_t));
|
||||
if (pGmmFixedAllocData->pBlocksUsed[i] == NULL)
|
||||
if (!pGmmFixedAllocData->pBlocksUsed[i])
|
||||
return GMM_ERROR;
|
||||
|
||||
for (int j=0; j<blockCount; j++)
|
||||
@ -352,7 +348,7 @@ static void *gmmAllocFixed(uint8_t isTile)
|
||||
(char **)realloc(pGmmFixedAllocData->ppBlockList[isTile],
|
||||
(listCount + 1) * sizeof(char *));
|
||||
|
||||
if (ppBlockList == NULL)
|
||||
if (!ppBlockList)
|
||||
return NULL;
|
||||
|
||||
pGmmFixedAllocData->ppBlockList[isTile] = ppBlockList;
|
||||
@ -360,14 +356,14 @@ static void *gmmAllocFixed(uint8_t isTile)
|
||||
pGmmFixedAllocData->ppBlockList[isTile][listCount] =
|
||||
(char *)malloc(blockSize * blockCount);
|
||||
|
||||
if (pGmmFixedAllocData->ppBlockList[isTile][listCount] == NULL)
|
||||
if (!pGmmFixedAllocData->ppBlockList[isTile][listCount])
|
||||
return NULL;
|
||||
|
||||
uint16_t **ppFreeBlockList =
|
||||
(uint16_t **)realloc(pGmmFixedAllocData->ppFreeBlockList[isTile],
|
||||
(listCount + 1) * sizeof(uint16_t *));
|
||||
|
||||
if (ppFreeBlockList == NULL)
|
||||
if (!ppFreeBlockList)
|
||||
return NULL;
|
||||
|
||||
pGmmFixedAllocData->ppFreeBlockList[isTile] = ppFreeBlockList;
|
||||
@ -375,14 +371,14 @@ static void *gmmAllocFixed(uint8_t isTile)
|
||||
pGmmFixedAllocData->ppFreeBlockList[isTile][listCount] =
|
||||
(uint16_t *)malloc(sizeof(uint16_t) * blockCount);
|
||||
|
||||
if (pGmmFixedAllocData->ppFreeBlockList[isTile][listCount] == NULL)
|
||||
if (!pGmmFixedAllocData->ppFreeBlockList[isTile][listCount])
|
||||
return NULL;
|
||||
|
||||
uint16_t *pBlocksUsed =
|
||||
(uint16_t *)realloc(pGmmFixedAllocData->pBlocksUsed[isTile],
|
||||
(listCount + 1) * sizeof(uint16_t));
|
||||
|
||||
if (pBlocksUsed == NULL)
|
||||
if (!pBlocksUsed)
|
||||
return NULL;
|
||||
|
||||
pGmmFixedAllocData->pBlocksUsed[isTile] = pBlocksUsed;
|
||||
@ -452,7 +448,7 @@ static uint32_t gmmInit(const void *localMemoryBase, const void *localStartAddre
|
||||
|
||||
pAllocator = (GmmAllocator *)malloc(sizeof(GmmAllocator));
|
||||
|
||||
if (pAllocator == NULL)
|
||||
if (!pAllocator)
|
||||
return GMM_ERROR;
|
||||
|
||||
memset(pAllocator, 0, sizeof(GmmAllocator));
|
||||
@ -539,7 +535,7 @@ static GmmBlock *gmmAllocBlock(
|
||||
address + size <= pAllocator->startAddress + pAllocator->size)
|
||||
{
|
||||
pNewBlock = GMM_ALLOC_FIXED_BLOCK();
|
||||
if (pNewBlock == NULL)
|
||||
if (!pNewBlock)
|
||||
return NULL;
|
||||
|
||||
memset(pNewBlock, 0, sizeof(GmmBlock));
|
||||
@ -594,7 +590,7 @@ static GmmTileBlock *gmmFindFreeTileBlock(
|
||||
if (pBestAfterBlock)
|
||||
{
|
||||
pNewBlock = gmmAllocFixedTileBlock();
|
||||
if (pNewBlock == NULL)
|
||||
if (!pNewBlock)
|
||||
return NULL;
|
||||
|
||||
memset(pNewBlock, 0, sizeof(GmmTileBlock));
|
||||
@ -636,7 +632,7 @@ static GmmTileBlock *gmmCreateTileBlock(
|
||||
pAllocator->tileStartAddress = address;
|
||||
|
||||
pNewBlock = gmmAllocFixedTileBlock();
|
||||
if (pNewBlock == NULL)
|
||||
if (!pNewBlock)
|
||||
return NULL;
|
||||
|
||||
memset(pNewBlock, 0, sizeof(GmmTileBlock));
|
||||
@ -728,7 +724,7 @@ static uint32_t gmmAllocExtendedTileBlock(const uint32_t size, const uint32_t ta
|
||||
(pBlock->pPrev && pBlock->base.address-pBlock->pPrev->base.address-pBlock->pPrev->base.size >= newSize))
|
||||
{
|
||||
GmmTileBlock *pNewBlock = gmmAllocFixedTileBlock();
|
||||
if (pNewBlock == NULL)
|
||||
if (!pNewBlock)
|
||||
break;
|
||||
|
||||
retId = (uint32_t)pNewBlock;
|
||||
@ -820,7 +816,7 @@ static void gmmFreeBlock (void *data)
|
||||
pAllocator->pTail->pNext = NULL;
|
||||
}
|
||||
|
||||
if (pBlock->pPrev == NULL)
|
||||
if (!pBlock->pPrev)
|
||||
pAllocator->pSweepHead = pAllocator->pHead;
|
||||
else if (pBlock->pPrev &&
|
||||
(pAllocator->pSweepHead == NULL ||
|
||||
@ -928,7 +924,7 @@ static void gmmAddFree(
|
||||
while (pInsertBefore && pInsertBefore->base.size < pBlock->base.size)
|
||||
pInsertBefore = pInsertBefore->pNextFree;
|
||||
|
||||
if (pInsertBefore == NULL)
|
||||
if (!pInsertBefore)
|
||||
{
|
||||
pBlock->pNextFree = NULL;
|
||||
pBlock->pPrevFree = pAllocator->pFreeTail[freeIndex];
|
||||
@ -1166,7 +1162,7 @@ static uint8_t gmmInternalSweep(void *data)
|
||||
srcAddress = 0;
|
||||
dstAddress = 0;
|
||||
|
||||
if (pBlock->pPrev == NULL)
|
||||
if (!pBlock->pPrev)
|
||||
availableSize = pBlock->base.address - pAllocator->startAddress;
|
||||
else
|
||||
availableSize = pBlock->base.address - (pBlock->pPrev->base.address + pBlock->pPrev->base.size);
|
||||
@ -1368,7 +1364,7 @@ static uint32_t gmmFindFreeBlock(
|
||||
if (pBlock->base.size != size)
|
||||
{
|
||||
GmmBlock *pNewBlock = GMM_ALLOC_FIXED_BLOCK();
|
||||
if (pNewBlock == NULL)
|
||||
if (!pNewBlock)
|
||||
return GMM_ERROR;
|
||||
|
||||
memset(pNewBlock, 0, sizeof(GmmBlock));
|
||||
|
@ -103,7 +103,7 @@ static int rglGcmGenerateProgram (void *data, int profileIndex, const CgProgramH
|
||||
program->rtParametersCount = parameterHeader->entryCount;
|
||||
program->runtimeParameters = ( CgRuntimeParameter* )memoryBlock;
|
||||
|
||||
if ( parameterEntries == NULL ) // the param entry can be supplied if not right after parameterHeader in memory, it happens when there's a program copy
|
||||
if (!parameterEntries) // the param entry can be supplied if not right after parameterHeader in memory, it happens when there's a program copy
|
||||
parameterEntries = ( CgParameterEntry* )( parameterHeader + 1 );
|
||||
|
||||
program->parametersEntries = parameterEntries;
|
||||
@ -231,11 +231,8 @@ static CGprogramGroup rglCgCreateProgramGroupFromFile( CGcontext ctx, const char
|
||||
// check that file exists
|
||||
FILE* fp = fopen( group_file, "rb" );
|
||||
|
||||
if (fp == NULL)
|
||||
{
|
||||
rglCgRaiseError( CG_FILE_READ_ERROR );
|
||||
if (!fp)
|
||||
return ( CGprogramGroup )NULL;
|
||||
}
|
||||
|
||||
// find the file length
|
||||
size_t file_size = 0;
|
||||
@ -844,7 +841,7 @@ static int rglGetSizeofSubArray( const short *dimensions, int count )
|
||||
|
||||
static _CGparameter *_cgGetNamedParameter( _CGprogram* progPtr, const char* name, CGenum name_space, int *arrayIndex, const CgParameterEntry *_startEntry = NULL, int _entryCount = -1 )
|
||||
{
|
||||
if ( name == NULL )
|
||||
if (!name)
|
||||
return NULL;
|
||||
|
||||
*arrayIndex = -1;
|
||||
@ -875,7 +872,7 @@ static _CGparameter *_cgGetNamedParameter( _CGprogram* progPtr, const char* name
|
||||
while (( !done ) && ( *structureStart ) && ( containerCount != -1 ) )
|
||||
{
|
||||
structureEnd = strpbrk( structureStart, ".[" );
|
||||
if ( structureEnd == NULL )
|
||||
if (!structureEnd)
|
||||
{
|
||||
structureEnd = structureStart + strlen( structureStart );
|
||||
done = 1;
|
||||
@ -1515,7 +1512,7 @@ _CGprogram* rglCgProgramFindPrev( _CGcontext* ctx, _CGprogram* prog )
|
||||
|
||||
_CGprogram* ptr = ctx->programList;
|
||||
|
||||
while ( ptr != NULL && prog != ptr->next )
|
||||
while (ptr && prog != ptr->next )
|
||||
ptr = ptr->next;
|
||||
|
||||
return ptr;
|
||||
@ -1880,7 +1877,7 @@ void AccumulateSizeForParamResource( CgParameterEntry* paramEntry, CgParameterEn
|
||||
defaults = ( float* )consttab->data + defaultIndex->defaultValueIndex;
|
||||
}
|
||||
}
|
||||
if ( defaults )
|
||||
if (defaults)
|
||||
{
|
||||
// defaults are always padded to 4 floats per param
|
||||
unsigned int defaultsCount = ( rowCount ? rowCount : 1 ) * 4;
|
||||
@ -1890,7 +1887,7 @@ void AccumulateSizeForParamResource( CgParameterEntry* paramEntry, CgParameterEn
|
||||
// offsets
|
||||
// fragment programs
|
||||
// do we want this referenced param test???
|
||||
if ( nvParamOffsetsSize != NULL && paramEntry->flags & CGPF_REFERENCED )
|
||||
if (nvParamOffsetsSize && paramEntry->flags & CGPF_REFERENCED )
|
||||
{
|
||||
// non varying params
|
||||
if ( paramEntry->flags & CGPV_CONSTANT || paramEntry->flags & CGPV_UNIFORM )
|
||||
@ -2180,7 +2177,7 @@ void PopulateDataForParamResource( CgParameterEntry* paramEntry, CgParameterEntr
|
||||
}
|
||||
|
||||
// vertex programs
|
||||
if ( nvParamOffsets == NULL )
|
||||
if (!nvParamOffsets)
|
||||
{
|
||||
// element of an array
|
||||
if ( elementResourceIndex >= 0 )
|
||||
@ -2500,7 +2497,7 @@ void PopulateDataForParamArray( CgParameterEntry* paramEntry, CgParameterEntry*
|
||||
// rest of array name for array and index
|
||||
sprintf( *nvParamStrings, "%s[%d]", ( strtab->data + paramEntry->nameOffset ), element );
|
||||
|
||||
if ( prefix == NULL )
|
||||
if (!prefix)
|
||||
prefix = *nvParamStrings;
|
||||
|
||||
*nvParamStrings += strlen( *nvParamStrings );
|
||||
@ -2574,7 +2571,7 @@ void PopulateDataForParamStruct( CgParameterEntry* paramEntry, CgParameterEntry*
|
||||
CgParameterEntry* memberEntry = paramEntry + 1;
|
||||
|
||||
// set the prefix pointer if it is not already set
|
||||
if ( prefix == NULL )
|
||||
if (!prefix)
|
||||
prefix = *nvParamStrings;
|
||||
|
||||
// add prefix of struct name and .
|
||||
@ -2790,7 +2787,7 @@ static bool cgGetElfProgramByName( CGELFBinary *elfBinary, const char *name, CGE
|
||||
{
|
||||
//if no name try to return the first program
|
||||
int res;
|
||||
if ( name == NULL || name[0] == '\0' )
|
||||
if (!name || name[0] == '\0' )
|
||||
res = 0;
|
||||
else
|
||||
res = lookupSymbolValueInPlace( elfBinary->symtab, elfBinary->symbolSize, elfBinary->symbolCount, elfBinary->symbolstrtab, name );
|
||||
@ -3108,7 +3105,7 @@ CG_API CGprogram cgCreateProgramFromFile( CGcontext ctx,
|
||||
if ( groupName && !strcmp( groupName, program_file ) )
|
||||
{
|
||||
int index;
|
||||
if ( entry == NULL )
|
||||
if (!entry)
|
||||
index = 0;
|
||||
else
|
||||
index = rglCgGetProgramIndex( group, entry );
|
||||
@ -3135,11 +3132,8 @@ CG_API CGprogram cgCreateProgramFromFile( CGcontext ctx,
|
||||
// check that file exists
|
||||
fp = fopen( program_file, "rb" );
|
||||
|
||||
if (fp == NULL)
|
||||
{
|
||||
rglCgRaiseError( CG_FILE_READ_ERROR );
|
||||
if (!fp)
|
||||
return ( CGprogram )NULL;
|
||||
}
|
||||
|
||||
unsigned int filetag = 0;
|
||||
int res = fread( &filetag, sizeof( filetag ), 1, fp );
|
||||
@ -3159,7 +3153,7 @@ CG_API CGprogram cgCreateProgramFromFile( CGcontext ctx,
|
||||
{
|
||||
_CGprogramGroup *_group = ( _CGprogramGroup * )group;
|
||||
_group->userCreated = false;
|
||||
if ( entry == NULL )
|
||||
if (!entry)
|
||||
{
|
||||
if ( group->programCount == 1 )
|
||||
{
|
||||
@ -3188,11 +3182,8 @@ CG_API CGprogram cgCreateProgramFromFile( CGcontext ctx,
|
||||
if ( !fp )
|
||||
{
|
||||
fp = fopen( program_file, "rb" );
|
||||
if (fp == NULL)
|
||||
{
|
||||
rglCgRaiseError( CG_FILE_READ_ERROR );
|
||||
if (!fp)
|
||||
return ( CGprogram )NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// find the file length
|
||||
@ -3203,11 +3194,10 @@ CG_API CGprogram cgCreateProgramFromFile( CGcontext ctx,
|
||||
|
||||
// alloc memory for the file
|
||||
char* ptr = ( char* )malloc( file_size + 1 );
|
||||
if (ptr == NULL)
|
||||
if (!ptr)
|
||||
{
|
||||
rglCgRaiseError( CG_MEMORY_ALLOC_ERROR );
|
||||
fclose( fp );
|
||||
return ( CGprogram )NULL;
|
||||
fclose(fp);
|
||||
return (CGprogram)NULL;
|
||||
}
|
||||
|
||||
// read the entire file into memory then close the file
|
||||
@ -3234,16 +3224,11 @@ CG_API CGprogram cgCopyProgram( CGprogram program )
|
||||
// check input parameter
|
||||
|
||||
if ( !CG_IS_PROGRAM( program ) )
|
||||
{
|
||||
rglCgRaiseError( CG_INVALID_PROGRAM_HANDLE_ERROR );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
_CGprogram* prog = _cgGetProgPtr( program );
|
||||
if (prog == NULL)
|
||||
{
|
||||
rglCgRaiseError( CG_INVALID_PROGRAM_HANDLE_ERROR );
|
||||
if (!prog)
|
||||
return ( CGprogram )NULL;
|
||||
}
|
||||
|
||||
_CGprogram* newprog;
|
||||
size_t paddedProgramSize = 0;
|
||||
@ -3647,10 +3632,14 @@ CGGL_API void cgGLSetTextureParameter( CGparameter param, GLuint texobj )
|
||||
CGGL_API GLuint cgGLGetTextureParameter( CGparameter param )
|
||||
{
|
||||
CgRuntimeParameter* ptr = _cgGLTestTextureParameter( param );
|
||||
if ( ptr == NULL ) return 0;
|
||||
if ( !( ptr->parameterEntry->flags & CGPF_REFERENCED ) ) { rglCgRaiseError( CG_INVALID_PARAMETER_ERROR ); return 0; }
|
||||
if (!ptr)
|
||||
return 0;
|
||||
if (!(ptr->parameterEntry->flags & CGPF_REFERENCED))
|
||||
{
|
||||
rglCgRaiseError( CG_INVALID_PARAMETER_ERROR );
|
||||
return 0;
|
||||
}
|
||||
return *( GLuint* )ptr->pushBufferPointer;
|
||||
return 0;
|
||||
}
|
||||
|
||||
CGGL_API void cgGLEnableTextureParameter( CGparameter param )
|
||||
@ -4044,7 +4033,7 @@ int convertNvToElfFromMemory(const void *sourceData, size_t size, int endianness
|
||||
}
|
||||
|
||||
// test if we are done finding structural information
|
||||
if (structureEnd == NULL)
|
||||
if (!structureEnd)
|
||||
{
|
||||
//set structureEnd correctly so that the rest of the function performs correctly
|
||||
structureEnd = structureStart + strlen(structureStart);
|
||||
|
@ -76,29 +76,26 @@ static void setAttribConstantIndex (void *data, const void* __restrict v, const
|
||||
}
|
||||
|
||||
//here ec has been advanced and is already on top of the embedded constant count
|
||||
template<int SIZE> inline static void swapandsetfp( int ucodeSize, unsigned int loadProgramId, unsigned int loadProgramOffset, unsigned short *ec, const unsigned int * __restrict v )
|
||||
{
|
||||
CellGcmContextData *thisContext = (CellGcmContextData*)gCellGcmCurrentContext;
|
||||
rglGcmSetTransferLocation(thisContext, CELL_GCM_LOCATION_LOCAL );
|
||||
unsigned short count = *( ec++ );
|
||||
for ( unsigned long offsetIndex = 0; offsetIndex < count; ++offsetIndex )
|
||||
{
|
||||
void *pointer=NULL;
|
||||
const int paddedSIZE = (SIZE + 1) & ~1; // even width only
|
||||
uint32_t var = gmmIdToOffset( loadProgramId ) + loadProgramOffset + *( ec++ );
|
||||
rglGcmSetInlineTransferPointer(thisContext, var, paddedSIZE, pointer);
|
||||
float *fp = (float*)pointer;
|
||||
float *src = (float*)v;
|
||||
for (uint32_t j=0; j<SIZE;j++)
|
||||
{
|
||||
rglGcmSwap16Float32(fp, src);
|
||||
fp++;
|
||||
src++;
|
||||
}
|
||||
#define swapandsetfp(SIZE, ucodeSize, loadProgramId, loadProgramOffset, ec, v) \
|
||||
CellGcmContextData *thisContext = (CellGcmContextData*)gCellGcmCurrentContext; \
|
||||
rglGcmSetTransferLocation(thisContext, CELL_GCM_LOCATION_LOCAL ); \
|
||||
unsigned short count = *( ec++ ); \
|
||||
for ( unsigned long offsetIndex = 0; offsetIndex < count; ++offsetIndex ) \
|
||||
{ \
|
||||
void *pointer=NULL; \
|
||||
const int paddedSIZE = (SIZE + 1) & ~1; /* even width only */ \
|
||||
uint32_t var = gmmIdToOffset( loadProgramId ) + loadProgramOffset + *( ec++ ); \
|
||||
rglGcmSetInlineTransferPointer(thisContext, var, paddedSIZE, pointer); \
|
||||
float *fp = (float*)pointer; \
|
||||
float *src = (float*)v; \
|
||||
for (uint32_t j=0; j<SIZE;j++) \
|
||||
{ \
|
||||
rglGcmSwap16Float32(fp, src); \
|
||||
fp++; \
|
||||
src++; \
|
||||
} \
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
template<int SIZE> static void setVectorTypefp( void *dat, const void* __restrict v )
|
||||
{
|
||||
CgRuntimeParameter *ptr = (CgRuntimeParameter*)dat;
|
||||
@ -113,7 +110,7 @@ template<int SIZE> static void setVectorTypefp( void *dat, const void* __restric
|
||||
unsigned short *ec = ( unsigned short * )( ptr->program->resources ) + resource + 1;//+1 to skip the register
|
||||
if ( RGL_LIKELY( *ec ) )
|
||||
{
|
||||
swapandsetfp<SIZE>( program->header.instructionCount*16, program->loadProgramId, program->loadProgramOffset, ec, ( unsigned int * )data );
|
||||
swapandsetfp(SIZE, (program->header.instructionCount*16), program->loadProgramId, program->loadProgramOffset, ec, data);
|
||||
}
|
||||
}
|
||||
|
||||
@ -164,7 +161,9 @@ template<int SIZE, bool isIndex> static void setVectorTypefpIndex (void *dat, co
|
||||
}
|
||||
}
|
||||
if ( RGL_LIKELY( *ec ) )
|
||||
swapandsetfp<SIZE>( program->header.instructionCount*16, program->loadProgramId, program->loadProgramOffset, ec, ( unsigned int * )data );
|
||||
{
|
||||
swapandsetfp(SIZE, (program->header.instructionCount*16), program->loadProgramId, program->loadProgramOffset, ec, data);
|
||||
}
|
||||
}
|
||||
|
||||
//matrices
|
||||
@ -212,7 +211,8 @@ template <int ROWS, int COLS, int ORDER> static void setMatrixfpIndex (void *dat
|
||||
int count = *ec;
|
||||
if ( RGL_LIKELY( count ) )
|
||||
{
|
||||
swapandsetfp<COLS>( program->header.instructionCount*16, program->loadProgramId, program->loadProgramOffset, ec, ( unsigned int * )dst + row * 4 );
|
||||
const unsigned int * __restrict v = ( unsigned int * )dst + row * 4;
|
||||
swapandsetfp(COLS, (program->header.instructionCount*16), program->loadProgramId, program->loadProgramOffset, ec, v);
|
||||
}
|
||||
ec += count + 2; //+1 for the register, +1 for the count, + count for the number of embedded consts
|
||||
}
|
||||
@ -241,7 +241,8 @@ template <int ROWS, int COLS, int ORDER> static void setMatrixfpIndexArray (void
|
||||
int count = *ec;
|
||||
if ( RGL_LIKELY( count ) )
|
||||
{
|
||||
swapandsetfp<COLS>( program->header.instructionCount*16, program->loadProgramId, program->loadProgramOffset, ec, ( unsigned int * )dst + row * 4 );
|
||||
const unsigned int * __restrict v = ( unsigned int * )dst + row * 4;
|
||||
swapandsetfp(COLS, (program->header.instructionCount*16), program->loadProgramId, program->loadProgramOffset, ec, v);
|
||||
}
|
||||
ec += count + 2;//+1 for the register, +1 for the count, +count for the number of embedded consts
|
||||
}
|
||||
@ -473,7 +474,6 @@ void rglCreatePushBuffer(void *data)
|
||||
program->constantPushBufferWordSize = bufferSize;
|
||||
GLuint *currentStorage = ( GLuint * )( rglGcmCurrent + bufferSize );
|
||||
|
||||
int outOfMemory = 0;
|
||||
//second pass to fill the buffer
|
||||
arrayCount = 1;
|
||||
const CgParameterEntry *containerEntry = NULL;
|
||||
@ -494,10 +494,7 @@ void rglCreatePushBuffer(void *data)
|
||||
|
||||
CGparameter id = ( CGparameter )rglCreateName( &_CurrentContext->cgParameterNameSpace, ( void* )rtParameter );
|
||||
if ( !id )
|
||||
{
|
||||
outOfMemory = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
rtParameter->id = id;
|
||||
rtParameter->parameterEntry = parameterEntry;
|
||||
@ -749,7 +746,7 @@ void rglCreatePushBuffer(void *data)
|
||||
}
|
||||
|
||||
//add padding
|
||||
if ( bufferSize > 0 )
|
||||
if (bufferSize)
|
||||
{
|
||||
CellGcmContextData gcmContext, *thisContext;
|
||||
int i, nopCount;
|
||||
@ -1955,7 +1952,19 @@ void rglPlatformCreateTexture (void *data)
|
||||
}
|
||||
|
||||
|
||||
void rglPlatformFreeGcmTexture (void *data);
|
||||
// Free memory pooled by a GCM texture
|
||||
static void rglPlatformFreeGcmTexture (void *data)
|
||||
{
|
||||
rglTexture *texture = (rglTexture*)data;
|
||||
rglGcmTexture *gcmTexture = ( rglGcmTexture * )texture->platformTexture;
|
||||
|
||||
if ( gcmTexture->pool == RGLGCM_SURFACE_POOL_LINEAR)
|
||||
gmmFree( gcmTexture->gpuAddressId );
|
||||
|
||||
gcmTexture->gpuAddressId = GMM_ERROR;
|
||||
gcmTexture->gpuAddressIdOffset = 0;
|
||||
gcmTexture->gpuSize = 0;
|
||||
}
|
||||
|
||||
// Destroy a texture by freeing a gcm texture and an associated PBO
|
||||
void rglPlatformDestroyTexture (void *data)
|
||||
@ -1985,20 +1994,6 @@ void rglPlatformDropTexture (void *data)
|
||||
rglTextureTouchFBOs( texture );
|
||||
}
|
||||
|
||||
// Free memory pooled by a GCM texture
|
||||
void rglPlatformFreeGcmTexture (void *data)
|
||||
{
|
||||
rglTexture *texture = (rglTexture*)data;
|
||||
rglGcmTexture *gcmTexture = ( rglGcmTexture * )texture->platformTexture;
|
||||
|
||||
if ( gcmTexture->pool == RGLGCM_SURFACE_POOL_LINEAR)
|
||||
gmmFree( gcmTexture->gpuAddressId );
|
||||
|
||||
gcmTexture->gpuAddressId = GMM_ERROR;
|
||||
gcmTexture->gpuAddressIdOffset = 0;
|
||||
gcmTexture->gpuSize = 0;
|
||||
}
|
||||
|
||||
// Validate texture resources
|
||||
static void rglPlatformValidateTextureResources (void *data)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user