mirror of
https://github.com/libretro/RetroArch
synced 2025-02-02 23:54:06 +00:00
(RGL) Cleanups
This commit is contained in:
parent
7ee8e1e524
commit
f04e079d77
@ -419,20 +419,6 @@ static inline const CgParameterResource *_RGLGetParameterResource( const _CGprog
|
|||||||
return ( CgParameterResource * )( program->parameterResources + entry->typeIndex );
|
return ( CgParameterResource * )( program->parameterResources + entry->typeIndex );
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline CGtype _RGLGetParameterCGtype( const _CGprogram *program, const CgParameterEntry *entry )
|
|
||||||
{
|
|
||||||
if ( entry->flags & CGP_RTCREATED )
|
|
||||||
return ( CGtype )entry->typeIndex;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const CgParameterResource *parameterResource = _RGLGetParameterResource( program, entry );
|
|
||||||
if ( parameterResource )
|
|
||||||
return ( CGtype )parameterResource->type;
|
|
||||||
}
|
|
||||||
|
|
||||||
return CG_UNKNOWN_TYPE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline const CgParameterArray *_RGLGetParameterArray( const _CGprogram *program, const CgParameterEntry *entry )
|
static inline const CgParameterArray *_RGLGetParameterArray( const _CGprogram *program, const CgParameterEntry *entry )
|
||||||
{
|
{
|
||||||
return ( CgParameterArray* )( program->parameterResources + entry->typeIndex );
|
return ( CgParameterArray* )( program->parameterResources + entry->typeIndex );
|
||||||
|
@ -104,9 +104,62 @@ static bool bIsVertexProgram = true;
|
|||||||
|
|
||||||
static int getStride(CgBaseType *type);
|
static int getStride(CgBaseType *type);
|
||||||
static int getSizeofSubArray(_CGNVCONTAINERS &containers, int dimensionIndex, int dimensionCount, int endianness);
|
static int getSizeofSubArray(_CGNVCONTAINERS &containers, int dimensionIndex, int dimensionCount, int endianness);
|
||||||
static unsigned int stringTableFind( std::vector<char> &stringTable, const char* str);
|
|
||||||
static unsigned int stringTableAdd( std::vector<char> &stringTable, const char* str );
|
static unsigned int stringTableFind( std::vector<char> &stringTable, const char* str )
|
||||||
static unsigned int stringTableAddUnique( std::vector<char> &stringTable, const char* str );
|
{
|
||||||
|
const char* data = &stringTable[0];
|
||||||
|
size_t size = stringTable.size();
|
||||||
|
const char *end = data + size;
|
||||||
|
|
||||||
|
size_t length = strlen(str);
|
||||||
|
|
||||||
|
if (length+1 > size)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
data += length;
|
||||||
|
|
||||||
|
const char *p = (char*)memchr(data,'\0',end-data);
|
||||||
|
while (p && (end-data)>0)
|
||||||
|
{
|
||||||
|
if (!memcmp(p - length, str, length))
|
||||||
|
return (unsigned int)(p - length - &stringTable[0]);
|
||||||
|
|
||||||
|
data = p+1;
|
||||||
|
p = (char*)memchr(data,'\0',end-data);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static unsigned int stringTableAdd( std::vector<char> &stringTable, const char* str )
|
||||||
|
{
|
||||||
|
unsigned int ret = (unsigned int)stringTable.size();
|
||||||
|
|
||||||
|
if ( ret == 0 )
|
||||||
|
{
|
||||||
|
stringTable.push_back('\0');
|
||||||
|
ret = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t stringLength = strlen(str) + 1;
|
||||||
|
stringTable.resize(ret + stringLength);
|
||||||
|
memcpy(&stringTable[0] + ret,str,stringLength);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static unsigned int stringTableAddUnique( std::vector<char> &stringTable, const char* str )
|
||||||
|
{
|
||||||
|
if ( stringTable.size() == 0 )
|
||||||
|
stringTable.push_back('\0');
|
||||||
|
|
||||||
|
unsigned int ret = stringTableFind(stringTable, str);
|
||||||
|
|
||||||
|
if (ret == 0 && str[0] != '\0')
|
||||||
|
ret = stringTableAdd(stringTable, str);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
template<class Type> static size_t array_size(std::vector<Type> &array);
|
template<class Type> static size_t array_size(std::vector<Type> &array);
|
||||||
template<class Type> static void array_push(char* ¶meterOffset, std::vector<Type> &array);
|
template<class Type> static void array_push(char* ¶meterOffset, std::vector<Type> &array);
|
||||||
inline static unsigned int swap16(const unsigned int v);
|
inline static unsigned int swap16(const unsigned int v);
|
||||||
|
@ -14,61 +14,6 @@
|
|||||||
#define CNV2END(val) convert_endianness((val), elfEndianness)
|
#define CNV2END(val) convert_endianness((val), elfEndianness)
|
||||||
#define ENDSWAP(val) convert_endianness((val), (host_endianness() == 1) ? 2 : 1)
|
#define ENDSWAP(val) convert_endianness((val), (host_endianness() == 1) ? 2 : 1)
|
||||||
|
|
||||||
static unsigned int stringTableAdd( std::vector<char> &stringTable, const char* str )
|
|
||||||
{
|
|
||||||
unsigned int ret = (unsigned int)stringTable.size();
|
|
||||||
|
|
||||||
if ( ret == 0 )
|
|
||||||
{
|
|
||||||
stringTable.push_back('\0');
|
|
||||||
ret = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t stringLength = strlen(str) + 1;
|
|
||||||
stringTable.resize(ret + stringLength);
|
|
||||||
memcpy(&stringTable[0] + ret,str,stringLength);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static unsigned int stringTableFind( std::vector<char> &stringTable, const char* str )
|
|
||||||
{
|
|
||||||
const char* data = &stringTable[0];
|
|
||||||
size_t size = stringTable.size();
|
|
||||||
const char *end = data + size;
|
|
||||||
|
|
||||||
size_t length = strlen(str);
|
|
||||||
|
|
||||||
if (length+1 > size)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
data += length;
|
|
||||||
|
|
||||||
const char *p = (char*)memchr(data,'\0',end-data);
|
|
||||||
while (p && (end-data)>0)
|
|
||||||
{
|
|
||||||
if (!memcmp(p - length, str, length))
|
|
||||||
return (unsigned int)(p - length - &stringTable[0]);
|
|
||||||
|
|
||||||
data = p+1;
|
|
||||||
p = (char*)memchr(data,'\0',end-data);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static unsigned int stringTableAddUnique( std::vector<char> &stringTable, const char* str )
|
|
||||||
{
|
|
||||||
if ( stringTable.size() == 0 )
|
|
||||||
stringTable.push_back('\0');
|
|
||||||
|
|
||||||
unsigned int ret = stringTableFind(stringTable, str);
|
|
||||||
|
|
||||||
if (ret == 0 && str[0] != '\0')
|
|
||||||
ret = stringTableAdd(stringTable, str);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
int convertNvToElfFromFile(const char *sourceFile, int endianness, int constTableOffset, void **binaryShader, int *size, std::vector<char> &stringTable, std::vector<float> &defaultValues);
|
int convertNvToElfFromFile(const char *sourceFile, int endianness, int constTableOffset, void **binaryShader, int *size, std::vector<char> &stringTable, std::vector<float> &defaultValues);
|
||||||
int convertNvToElfFromMemory(const void *sourceData, size_t size, int endianness, int constTableOffset, void **binaryShader, int *binarySize, std::vector<char> &stringTable, std::vector<float> &defaultValues);
|
int convertNvToElfFromMemory(const void *sourceData, size_t size, int endianness, int constTableOffset, void **binaryShader, int *binarySize, std::vector<char> &stringTable, std::vector<float> &defaultValues);
|
||||||
|
|
||||||
|
@ -260,10 +260,6 @@ jsTexture;
|
|||||||
|
|
||||||
#define MAX_TEXTURE_UNITS 4
|
#define MAX_TEXTURE_UNITS 4
|
||||||
|
|
||||||
#define _RGL_MAX_MODELVIEW_STACK_DEPTH 16
|
|
||||||
#define _RGL_MAX_PROJECTION_STACK_DEPTH 2
|
|
||||||
#define MAX_TEXTURE_STACK_DEPTH 2
|
|
||||||
|
|
||||||
#define MAX_VERTEX_ATTRIBS 16
|
#define MAX_VERTEX_ATTRIBS 16
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@ -451,8 +447,6 @@ struct jsBufferObject
|
|||||||
void *platformBufferObject[];
|
void *platformBufferObject[];
|
||||||
};
|
};
|
||||||
|
|
||||||
#define ELEMENTS_IN_MATRIX 16
|
|
||||||
|
|
||||||
typedef struct jsNameSpace
|
typedef struct jsNameSpace
|
||||||
{
|
{
|
||||||
void** data;
|
void** data;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user