1
0
mirror of https://github.com/libretro/RetroArch synced 2024-07-08 20:25:47 +00:00

(RGL) Cleanups

This commit is contained in:
Twinaphex 2012-07-23 14:14:38 +02:00
parent 2b0bbb9fa1
commit ec827d862b
11 changed files with 1191 additions and 1324 deletions

View File

@ -26,7 +26,7 @@ LIBS := -lretro_psl1ght -laudio -lEGL -lGL -lio -lm -ljpgdec -lpngdec -lsysutil
OBJ = console/griffin/griffin.o console/rzlib/rzlib.o
#OBJ += console/rgl/ps3/device_ctx.o console/rgl/ps3/rgl.o console/rgl/ps3/cgbio.o console/rgl/ps3/cgnv2rt.o
OBJ += console/rgl/ps3/device_ctx.o console/rgl/ps3/rgl.o console/rgl/ps3/cgbio.o console/rgl/ps3/cgnv2rt.o
ifeq ($(HAVE_LOGGER), 1)
CFLAGS += -DHAVE_LOGGER

View File

@ -14,16 +14,17 @@
typedef size_t ptrdiff_t;
typedef size_t ptrdiff_t;
typedef struct _Elf32_cgParameter {
unsigned int cgp_name;
unsigned int cgp_semantic;
unsigned short cgp_default;
unsigned short cgp_reloc;
unsigned short cgp_resource;
unsigned short cgp_resource_index;
unsigned char cgp_type;
unsigned short cgp_info;
unsigned char unused;
typedef struct _Elf32_cgParameter
{
unsigned int cgp_name;
unsigned int cgp_semantic;
unsigned short cgp_default;
unsigned short cgp_reloc;
unsigned short cgp_resource;
unsigned short cgp_resource_index;
unsigned char cgp_type;
unsigned short cgp_info;
unsigned char unused;
} Elf32_cgParameter;
#define ET_NONE 0
@ -173,21 +174,22 @@ typedef struct _Elf32_cgParameter {
#define R_RSX_NONE 0
#define R_RSX_FLOAT4 1
struct Elf32_Ehdr {
unsigned char e_ident[EI_NIDENT];
unsigned short e_type;
unsigned short e_machine;
unsigned int e_version;
unsigned int e_entry;
unsigned int e_phoff;
unsigned int e_shoff;
unsigned int e_flags;
unsigned short e_ehsize;
unsigned short e_phentsize;
unsigned short e_phnum;
unsigned short e_shentsize;
unsigned short e_shnum;
unsigned short e_shstrndx;
struct Elf32_Ehdr
{
unsigned char e_ident[EI_NIDENT];
unsigned short e_type;
unsigned short e_machine;
unsigned int e_version;
unsigned int e_entry;
unsigned int e_phoff;
unsigned int e_shoff;
unsigned int e_flags;
unsigned short e_ehsize;
unsigned short e_phentsize;
unsigned short e_phnum;
unsigned short e_shentsize;
unsigned short e_shnum;
unsigned short e_shstrndx;
};
struct Elf32_Shdr {
@ -223,30 +225,31 @@ struct Elf32_Sym {
unsigned short st_shndx;
};
struct Elf32_Note {
unsigned int n_namesz; /* Name size */
unsigned int n_descsz; /* Content size */
unsigned int n_type; /* Content type */
struct Elf32_Note
{
unsigned int n_namesz; /* Name size */
unsigned int n_descsz; /* Content size */
unsigned int n_type; /* Content type */
};
struct Elf32_Rel {
unsigned int r_offset;
unsigned int r_info;
unsigned int r_offset;
unsigned int r_info;
};
struct Elf32_Rela {
unsigned int r_offset;
unsigned int r_info;
signed int r_addend;
unsigned int r_offset;
unsigned int r_info;
signed int r_addend;
};
struct Elf32_Dyn {
signed int d_tag;
union {
unsigned int d_val;
unsigned int d_ptr;
} d_un;
signed int d_tag;
union {
unsigned int d_val;
unsigned int d_ptr;
} d_un;
};
using std::istream;
@ -255,21 +258,21 @@ namespace cgc {
namespace bio {
enum CGBIO_ERROR {
CGBIO_ERROR_NO_ERROR,
CGBIO_ERROR_LOADED,
CGBIO_ERROR_FILEIO,
CGBIO_ERROR_FORMAT,
CGBIO_ERROR_INDEX,
CGBIO_ERROR_MEMORY,
CGBIO_ERROR_RELOC,
CGBIO_ERROR_SYMBOL,
CGBIO_ERROR_UNKNOWN_TYPE
CGBIO_ERROR_NO_ERROR,
CGBIO_ERROR_LOADED,
CGBIO_ERROR_FILEIO,
CGBIO_ERROR_FORMAT,
CGBIO_ERROR_INDEX,
CGBIO_ERROR_MEMORY,
CGBIO_ERROR_RELOC,
CGBIO_ERROR_SYMBOL,
CGBIO_ERROR_UNKNOWN_TYPE
};
typedef enum {
CGBIODATANONE = ELFDATANONE,
CGBIODATALSB = ELFDATA2LSB,
CGBIODATAMSB = ELFDATA2MSB
CGBIODATANONE = ELFDATANONE,
CGBIODATALSB = ELFDATA2LSB,
CGBIODATAMSB = ELFDATA2MSB
} HOST_ENDIANNESS;
class elf_reader

View File

@ -20,59 +20,61 @@
static unsigned int stringTableAdd( STL_NAMESPACE vector<char> &stringTable, const char* str )
{
unsigned int ret = (unsigned int)stringTable.size();
unsigned int ret = (unsigned int)stringTable.size();
if ( ret == 0 )
{
stringTable.push_back('\0');
ret = 1;
}
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);
size_t stringLength = strlen(str) + 1;
stringTable.resize(ret + stringLength);
memcpy(&stringTable[0] + ret,str,stringLength);
return ret;
return ret;
}
static unsigned int stringTableFind( STL_NAMESPACE vector<char> &stringTable, const char* str )
{
const char* data = &stringTable[0];
size_t size = stringTable.size();
const char *end = data + size;
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;
size_t length = strlen(str);
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;
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( STL_NAMESPACE 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;
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,
STL_NAMESPACE vector<char> &stringTable, STL_NAMESPACE vector<float> &defaultValues);
int convertNvToElfFromMemory(const void *sourceData, size_t size, int endianness, int constTableOffset, void **binaryShader, int *binarySize,
STL_NAMESPACE vector<char> &stringTable, STL_NAMESPACE vector<float> &defaultValues);
int convertNvToElfFromFile(const char *sourceFile, int endianness, int constTableOffset, void **binaryShader, int *size, STL_NAMESPACE vector<char> &stringTable, STL_NAMESPACE vector<float> &defaultValues);
int convertNvToElfFromMemory(const void *sourceData, size_t size, int endianness, int constTableOffset, void **binaryShader, int *binarySize, STL_NAMESPACE vector<char> &stringTable, STL_NAMESPACE vector<float> &defaultValues);
int convertNvToElfFreeBinaryShader(void *binaryShader);

View File

@ -477,9 +477,8 @@ static unsigned int findValidPitch( unsigned int pitch )
else
{
for ( GLuint i = 0;i < validPitchCount - 1;++i )
{
if (( pitch > validPitch[i] ) && ( pitch <= validPitch[i+1] ) ) return validPitch[i+1];
}
return validPitch[validPitchCount-1];
}
}

View File

@ -57,22 +57,22 @@ extern "C"
#define GLAPI extern
#endif
typedef unsigned int GLenum;
typedef unsigned char GLboolean;
typedef unsigned int GLbitfield;
typedef signed char GLbyte;
typedef short GLshort;
typedef int GLint;
typedef int GLsizei;
typedef unsigned char GLubyte;
typedef unsigned short GLushort;
typedef unsigned int GLuint;
typedef float GLfloat;
typedef float GLclampf;
typedef void GLvoid;
typedef int GLfixed;
typedef int GLclampx;
typedef void( *_GLfuncptr )();
typedef unsigned int GLenum;
typedef unsigned char GLboolean;
typedef unsigned int GLbitfield;
typedef signed char GLbyte;
typedef short GLshort;
typedef int GLint;
typedef int GLsizei;
typedef unsigned char GLubyte;
typedef unsigned short GLushort;
typedef unsigned int GLuint;
typedef float GLfloat;
typedef float GLclampf;
typedef void GLvoid;
typedef int GLfixed;
typedef int GLclampx;
typedef void( *_GLfuncptr )();
#define GL_OES_VERSION_1_0 1
#define GL_OES_read_format 1
@ -290,35 +290,35 @@ extern "C"
#define GL_REPEAT 0x2901
#define GL_CLAMP_TO_EDGE 0x812F
GLAPI void APIENTRY glActiveTexture( GLenum texture );
GLAPI void APIENTRY glBindTexture( GLenum target, GLuint texture );
GLAPI void APIENTRY glBlendFunc( GLenum sfactor, GLenum dfactor );
GLAPI void APIENTRY glClear( GLbitfield mask );
GLAPI void APIENTRY glClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha );
GLAPI void APIENTRY glClearColorx( GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha );
GLAPI void APIENTRY glClientActiveTexture( GLenum texture );
GLAPI void APIENTRY glColorPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer );
GLAPI void APIENTRY glCopyTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height );
GLAPI void APIENTRY glDeleteTextures( GLsizei n, const GLuint *textures );
GLAPI void APIENTRY glDisable( GLenum cap );
GLAPI void APIENTRY glDisableClientState( GLenum array );
GLAPI void APIENTRY glDrawArrays( GLenum mode, GLint first, GLsizei count );
GLAPI void APIENTRY glEnable( GLenum cap );
GLAPI void APIENTRY glEnableClientState( GLenum array );
GLAPI void APIENTRY glFinish( void );
GLAPI void APIENTRY glFlush( void );
GLAPI void APIENTRY glGenTextures( GLsizei n, GLuint *textures );
GLAPI GLenum APIENTRY glGetError( void );
GLAPI const GLubyte * APIENTRY glGetString( GLenum name );
GLAPI void APIENTRY glLoadIdentity( void );
GLAPI void APIENTRY glMatrixMode( GLenum mode );
GLAPI void APIENTRY glOrthof( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar );
GLAPI void APIENTRY glRotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z );
GLAPI void APIENTRY glPixelStorei( GLenum pname, GLint param );
GLAPI void APIENTRY glTexCoordPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer );
GLAPI void APIENTRY glTexImage2D( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels );
GLAPI void APIENTRY glVertexPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer );
GLAPI void APIENTRY glViewport( GLint x, GLint y, GLsizei width, GLsizei height );
GLAPI void APIENTRY glActiveTexture( GLenum texture );
GLAPI void APIENTRY glBindTexture( GLenum target, GLuint texture );
GLAPI void APIENTRY glBlendFunc( GLenum sfactor, GLenum dfactor );
GLAPI void APIENTRY glClear( GLbitfield mask );
GLAPI void APIENTRY glClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha );
GLAPI void APIENTRY glClearColorx( GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha );
GLAPI void APIENTRY glClientActiveTexture( GLenum texture );
GLAPI void APIENTRY glColorPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer );
GLAPI void APIENTRY glCopyTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height );
GLAPI void APIENTRY glDeleteTextures( GLsizei n, const GLuint *textures );
GLAPI void APIENTRY glDisable( GLenum cap );
GLAPI void APIENTRY glDisableClientState( GLenum array );
GLAPI void APIENTRY glDrawArrays( GLenum mode, GLint first, GLsizei count );
GLAPI void APIENTRY glEnable( GLenum cap );
GLAPI void APIENTRY glEnableClientState( GLenum array );
GLAPI void APIENTRY glFinish( void );
GLAPI void APIENTRY glFlush( void );
GLAPI void APIENTRY glGenTextures( GLsizei n, GLuint *textures );
GLAPI GLenum APIENTRY glGetError( void );
GLAPI const GLubyte * APIENTRY glGetString( GLenum name );
GLAPI void APIENTRY glLoadIdentity( void );
GLAPI void APIENTRY glMatrixMode( GLenum mode );
GLAPI void APIENTRY glOrthof( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar );
GLAPI void APIENTRY glRotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z );
GLAPI void APIENTRY glPixelStorei( GLenum pname, GLint param );
GLAPI void APIENTRY glTexCoordPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer );
GLAPI void APIENTRY glTexImage2D( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels );
GLAPI void APIENTRY glVertexPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer );
GLAPI void APIENTRY glViewport( GLint x, GLint y, GLsizei width, GLsizei height );
#ifdef __cplusplus
}

View File

@ -12,9 +12,9 @@ extern "C"
{
#endif
typedef intptr_t GLintptr;
typedef intptr_t GLsizeiptr;
typedef unsigned short GLhalfARB;
typedef intptr_t GLintptr;
typedef intptr_t GLsizeiptr;
typedef unsigned short GLhalfARB;
#define GL_QUADS 0x0007
#define GL_QUAD_STRIP 0x0008
@ -248,24 +248,24 @@ extern "C"
#define GL_BUFFER_SIZE 0x8764
#define GL_BUFFER_PITCH_SCE 0x6041
GLAPI void APIENTRY glBlendEquation( GLenum mode );
GLAPI void APIENTRY glBlendColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha );
GLAPI void APIENTRY glGetFloatv( GLenum pname, GLfloat* params );
GLAPI void APIENTRY glTexParameteri( GLenum target, GLenum pname, GLint param );
GLAPI void APIENTRY glBlendEquation( GLenum mode );
GLAPI void APIENTRY glBlendColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha );
GLAPI void APIENTRY glGetFloatv( GLenum pname, GLfloat* params );
GLAPI void APIENTRY glTexParameteri( GLenum target, GLenum pname, GLint param );
GLAPI void APIENTRY glBindBuffer( GLenum target, GLuint name );
GLAPI void APIENTRY glDeleteBuffers( GLsizei n, const GLuint *buffers );
GLAPI void APIENTRY glGenBuffers( GLsizei n, GLuint *buffers );
GLAPI void APIENTRY glBufferData( GLenum target, GLsizeiptr size, const GLvoid * data, GLenum usage );
GLAPI void APIENTRY glBufferSubData( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data );
GLAPI void APIENTRY glBindBuffer( GLenum target, GLuint name );
GLAPI void APIENTRY glDeleteBuffers( GLsizei n, const GLuint *buffers );
GLAPI void APIENTRY glGenBuffers( GLsizei n, GLuint *buffers );
GLAPI void APIENTRY glBufferData( GLenum target, GLsizeiptr size, const GLvoid * data, GLenum usage );
GLAPI void APIENTRY glBufferSubData( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data );
GLAPI void APIENTRY glBindFramebufferOES( GLenum, GLuint );
GLAPI void APIENTRY glDeleteFramebuffersOES( GLsizei, const GLuint * );
GLAPI void APIENTRY glGenFramebuffersOES( GLsizei, GLuint * );
GLAPI GLenum APIENTRY glCheckFramebufferStatusOES( GLenum );
GLAPI void APIENTRY glFramebufferTexture2DOES( GLenum, GLenum, GLenum, GLuint, GLint );
GLAPI void APIENTRY glBindFramebufferOES( GLenum, GLuint );
GLAPI void APIENTRY glDeleteFramebuffersOES( GLsizei, const GLuint * );
GLAPI void APIENTRY glGenFramebuffersOES( GLsizei, GLuint * );
GLAPI GLenum APIENTRY glCheckFramebufferStatusOES( GLenum );
GLAPI void APIENTRY glFramebufferTexture2DOES( GLenum, GLenum, GLenum, GLuint, GLint );
GLAPI void APIENTRY glTextureReferenceSCE( GLenum target, GLuint levels, GLuint baseWidth, GLuint baseHeight, GLuint baseDepth, GLenum internalFormat, GLuint pitch, GLintptr offset );
GLAPI void APIENTRY glTextureReferenceSCE( GLenum target, GLuint levels, GLuint baseWidth, GLuint baseHeight, GLuint baseDepth, GLenum internalFormat, GLuint pitch, GLintptr offset );
#ifdef __cplusplus
}

View File

@ -12,7 +12,6 @@ extern "C"
{
#endif
#ifdef __cplusplus
#define _RGL_EXTERN_C extern "C"
#else
@ -52,8 +51,8 @@ extern PSGLdevice *_CurrentDevice;
typedef union
{
unsigned int i;
float f;
unsigned int i;
float f;
} jsIntAndFloat;
static const jsIntAndFloat _RGLNan = {i: 0x7fc00000U};
@ -63,39 +62,36 @@ static const jsIntAndFloat _RGLInfinity = {i: 0x7f800000U};
typedef struct RGLRenderTargetEx RGLRenderTargetEx;
struct RGLRenderTargetEx
{
RGLEnum colorFormat;
GLuint colorBufferCount;
GLuint colorId[RGL_SETRENDERTARGET_MAXCOUNT];
GLuint colorIdOffset[RGL_SETRENDERTARGET_MAXCOUNT];
GLuint colorPitch[RGL_SETRENDERTARGET_MAXCOUNT];
GLboolean yInverted;
GLuint xOffset;
GLuint yOffset;
GLuint width;
GLuint height;
RGLEnum colorFormat;
GLuint colorBufferCount;
GLuint colorId[RGL_SETRENDERTARGET_MAXCOUNT];
GLuint colorIdOffset[RGL_SETRENDERTARGET_MAXCOUNT];
GLuint colorPitch[RGL_SETRENDERTARGET_MAXCOUNT];
GLboolean yInverted;
GLuint xOffset;
GLuint yOffset;
GLuint width;
GLuint height;
};
struct jsPlatformFramebuffer: public jsFramebuffer
{
RGLRenderTargetEx rt;
GLuint colorBufferMask;
GLboolean complete;
jsPlatformFramebuffer(): jsFramebuffer()
{
memset( &rt, 0, sizeof( rt ) );
};
virtual ~jsPlatformFramebuffer() {};
RGLRenderTargetEx rt;
GLuint colorBufferMask;
GLboolean complete;
jsPlatformFramebuffer(): jsFramebuffer() { memset( &rt, 0, sizeof( rt ) ); };
virtual ~jsPlatformFramebuffer() {};
};
typedef struct _RGLDriver_
{
RGLRenderTargetEx rt;
GLuint colorBufferMask;
GLboolean rtValid;
GLboolean invalidateVertexCache;
GLuint flushBufferCount;
GLuint fpLoadProgramId;
GLuint fpLoadProgramOffset;
RGLRenderTargetEx rt;
GLuint colorBufferMask;
GLboolean rtValid;
GLboolean invalidateVertexCache;
GLuint flushBufferCount;
GLuint fpLoadProgramId;
GLuint fpLoadProgramOffset;
}
RGLDriver;
@ -142,99 +138,99 @@ typedef struct
typedef struct
{
GLenum pool;
RGLTextureMethodParams gcmMethods;
CellGcmTexture gcmTexture;
GLuint gpuAddressId;
GLuint gpuAddressIdOffset;
GLuint gpuSize;
RGLTextureLayout gpuLayout;
jsBufferObject* pbo;
GLenum pool;
RGLTextureMethodParams gcmMethods;
CellGcmTexture gcmTexture;
GLuint gpuAddressId;
GLuint gpuAddressIdOffset;
GLuint gpuSize;
RGLTextureLayout gpuLayout;
jsBufferObject* pbo;
} RGLTexture;
typedef struct _tagMODESTRUC
{
GLushort wHorizVisible;
GLushort wVertVisible;
GLushort wInterlacedMode;
GLushort wRefresh;
GLushort wHorizTotal;
GLushort wHorizBlankStart;
GLushort wHorizSyncStart;
GLushort wHorizSyncEnd;
GLushort wHorizBlankEnd;
GLushort wVertTotal;
GLushort wVertBlankStart;
GLushort wVertSyncStart;
GLushort wVertSyncEnd;
GLushort wVertBlankEnd;
GLuint dwDotClock;
GLushort wHSyncPolarity;
GLushort wVSyncPolarity;
GLushort wHorizVisible;
GLushort wVertVisible;
GLushort wInterlacedMode;
GLushort wRefresh;
GLushort wHorizTotal;
GLushort wHorizBlankStart;
GLushort wHorizSyncStart;
GLushort wHorizSyncEnd;
GLushort wHorizBlankEnd;
GLushort wVertTotal;
GLushort wVertBlankStart;
GLushort wVertSyncStart;
GLushort wVertSyncEnd;
GLushort wVertBlankEnd;
GLuint dwDotClock;
GLushort wHSyncPolarity;
GLushort wVSyncPolarity;
}
MODESTRUC;
enum {
_RGL_SURFACE_SOURCE_TEMPORARY,
_RGL_SURFACE_SOURCE_DEVICE,
_RGL_SURFACE_SOURCE_TEXTURE,
_RGL_SURFACE_SOURCE_PBO,
_RGL_SURFACE_SOURCE_TEMPORARY,
_RGL_SURFACE_SOURCE_DEVICE,
_RGL_SURFACE_SOURCE_TEXTURE,
_RGL_SURFACE_SOURCE_PBO,
};
enum {
_RGL_SURFACE_POOL_NONE,
_RGL_SURFACE_POOL_LINEAR,
_RGL_SURFACE_POOL_SYSTEM,
_RGL_SURFACE_POOL_NONE,
_RGL_SURFACE_POOL_LINEAR,
_RGL_SURFACE_POOL_SYSTEM,
};
typedef struct
{
GLenum source;
GLuint width, height;
GLuint bpp;
GLuint pitch;
RGLEnum format;
GLenum pool;
char* ppuData;
GLuint dataId;
GLuint dataIdOffset;
GLenum source;
GLuint width, height;
GLuint bpp;
GLuint pitch;
RGLEnum format;
GLenum pool;
char* ppuData;
GLuint dataId;
GLuint dataIdOffset;
} RGLSurface;
typedef struct
{
RGLRenderTargetEx rt;
RGLSurface color[3];
GLuint drawBuffer;
GLuint scanBuffer;
GLuint RescColorBuffersId;
GLuint RescVertexArrayId;
GLuint RescFragmentShaderId;
RGLRenderTargetEx rt;
RGLSurface color[3];
GLuint drawBuffer;
GLuint scanBuffer;
GLuint RescColorBuffersId;
GLuint RescVertexArrayId;
GLuint RescFragmentShaderId;
const MODESTRUC *ms;
GLboolean vsync;
GLenum deviceType;
GLenum TVStandard;
GLenum TVFormat;
GLuint swapFifoRef;
GLuint swapFifoRef2;
GLboolean setOffset;
GLboolean signal;
GLuint semaValue;
unsigned int syncMethod;
const MODESTRUC *ms;
GLboolean vsync;
GLenum deviceType;
GLenum TVStandard;
GLenum TVFormat;
GLuint swapFifoRef;
GLuint swapFifoRef2;
GLboolean setOffset;
GLboolean signal;
GLuint semaValue;
unsigned int syncMethod;
} RGLDevice;
int32_t _RGLOutOfSpaceCallback( struct CellGcmContextData *con, uint32_t space );
typedef struct _RGLShader_
{
GLuint loadAddressId;
CgBinaryProgram __attribute__(( aligned( 16 ) ) ) program;
GLuint loadAddressId;
CgBinaryProgram __attribute__(( aligned( 16 ) ) ) program;
} RGLShader;
void _RGLFifoFinish( RGLFifo *fifo );
void _RGLFifoFinish( RGLFifo *fifo );
#define _RGLFifoFlush(fifo) \
{ \
@ -249,17 +245,16 @@ void _RGLFifoFinish( RGLFifo *fifo );
#define RGL_PAGE_SIZE 0x1000
#define RGL_LM_MAX_TOTAL_QUERIES 800
typedef struct RGLTextureState RGLTextureState;
struct RGLTextureState
{
GLuint hwTexAddress;
GLuint hwTexFilter;
GLuint hwTexControl0;
GLuint hwTexAddress;
GLuint hwTexFilter;
GLuint hwTexControl0;
};
void _RGLDestroy( void );
void _RGLDestroy( void );
typedef void( * RGLcontextHookFunction )( PSGLcontext *context );
extern RGLcontextHookFunction _RGLContextCreateHook;
@ -283,22 +278,23 @@ extern void _RGLDeviceExit (void);
static inline GLuint RGL_QUICK_FLOAT2UINT( const GLfloat f )
{
union
{
GLfloat f;
GLuint ui;
} t;
t.f = f + RGL_F0_DOT_0;
return t.ui & 0xffff;
union
{
GLfloat f;
GLuint ui;
} t;
t.f = f + RGL_F0_DOT_0;
return t.ui & 0xffff;
}
static inline void RGL_CALC_COLOR_LE_ARGB8( GLuint *color0, const GLfloat r, const GLfloat g, const GLfloat b, const GLfloat a )
static inline void RGL_CALC_COLOR_LE_ARGB8( GLuint *color0, const GLfloat r,
const GLfloat g, const GLfloat b, const GLfloat a )
{
GLuint r2 = RGL_QUICK_FLOAT2UINT( r * 255.0f );
GLuint g2 = RGL_QUICK_FLOAT2UINT( g * 255.0f );
GLuint b2 = RGL_QUICK_FLOAT2UINT( b * 255.0f );
GLuint a2 = RGL_QUICK_FLOAT2UINT( a * 255.0f );
*color0 = ( a2 << 24 ) | ( r2 << 16 ) | ( g2 << 8 ) | ( b2 << 0 );
GLuint r2 = RGL_QUICK_FLOAT2UINT( r * 255.0f );
GLuint g2 = RGL_QUICK_FLOAT2UINT( g * 255.0f );
GLuint b2 = RGL_QUICK_FLOAT2UINT( b * 255.0f );
GLuint a2 = RGL_QUICK_FLOAT2UINT( a * 255.0f );
*color0 = ( a2 << 24 ) | ( r2 << 16 ) | ( g2 << 8 ) | ( b2 << 0 );
}
static inline GLuint _RGLMapMinTextureFilter( GLenum filter )
@ -323,14 +319,14 @@ static inline GLuint _RGLMapMinTextureFilter( GLenum filter )
static inline GLuint _RGLMapMagTextureFilter( GLenum filter )
{
switch ( filter )
{
case GL_NEAREST:
return CELL_GCM_TEXTURE_NEAREST;
case GL_LINEAR:
return CELL_GCM_TEXTURE_LINEAR;
}
return filter;
switch ( filter )
{
case GL_NEAREST:
return CELL_GCM_TEXTURE_NEAREST;
case GL_LINEAR:
return CELL_GCM_TEXTURE_LINEAR;
}
return filter;
}
static inline void _RGLMapTextureFormat( GLuint internalFormat, uint8_t & gcmFormat, uint32_t & remap )
@ -339,71 +335,58 @@ static inline void _RGLMapTextureFormat( GLuint internalFormat, uint8_t & gcmFor
switch ( internalFormat )
{
case RGL_ALPHA8: // in_rgba = xxAx, out_rgba = 000A
{
gcmFormat = CELL_GCM_TEXTURE_B8;
remap = CELL_GCM_REMAP_MODE(
CELL_GCM_TEXTURE_REMAP_ORDER_XYXY,
CELL_GCM_TEXTURE_REMAP_FROM_B,
CELL_GCM_TEXTURE_REMAP_FROM_R,
CELL_GCM_TEXTURE_REMAP_FROM_B,
CELL_GCM_TEXTURE_REMAP_FROM_B,
CELL_GCM_TEXTURE_REMAP_REMAP,
CELL_GCM_TEXTURE_REMAP_ZERO,
CELL_GCM_TEXTURE_REMAP_ZERO,
CELL_GCM_TEXTURE_REMAP_ZERO );
case RGL_ALPHA8: // in_rgba = xxAx, out_rgba = 000A
gcmFormat = CELL_GCM_TEXTURE_B8;
remap = CELL_GCM_REMAP_MODE(
CELL_GCM_TEXTURE_REMAP_ORDER_XYXY,
CELL_GCM_TEXTURE_REMAP_FROM_B,
CELL_GCM_TEXTURE_REMAP_FROM_R,
CELL_GCM_TEXTURE_REMAP_FROM_B,
CELL_GCM_TEXTURE_REMAP_FROM_B,
CELL_GCM_TEXTURE_REMAP_REMAP,
CELL_GCM_TEXTURE_REMAP_ZERO,
CELL_GCM_TEXTURE_REMAP_ZERO,
CELL_GCM_TEXTURE_REMAP_ZERO );
}
break;
case RGL_ARGB8: // in_rgba = RGBA, out_rgba = RGBA
{
gcmFormat = CELL_GCM_TEXTURE_A8R8G8B8;
remap = CELL_GCM_REMAP_MODE(
CELL_GCM_TEXTURE_REMAP_ORDER_XYXY,
CELL_GCM_TEXTURE_REMAP_FROM_A,
CELL_GCM_TEXTURE_REMAP_FROM_R,
CELL_GCM_TEXTURE_REMAP_FROM_G,
CELL_GCM_TEXTURE_REMAP_FROM_B,
CELL_GCM_TEXTURE_REMAP_REMAP,
CELL_GCM_TEXTURE_REMAP_REMAP,
CELL_GCM_TEXTURE_REMAP_REMAP,
CELL_GCM_TEXTURE_REMAP_REMAP );
}
case RGL_ARGB8: // in_rgba = RGBA, out_rgba = RGBA
gcmFormat = CELL_GCM_TEXTURE_A8R8G8B8;
remap = CELL_GCM_REMAP_MODE(
CELL_GCM_TEXTURE_REMAP_ORDER_XYXY,
CELL_GCM_TEXTURE_REMAP_FROM_A,
CELL_GCM_TEXTURE_REMAP_FROM_R,
CELL_GCM_TEXTURE_REMAP_FROM_G,
CELL_GCM_TEXTURE_REMAP_FROM_B,
CELL_GCM_TEXTURE_REMAP_REMAP,
CELL_GCM_TEXTURE_REMAP_REMAP,
CELL_GCM_TEXTURE_REMAP_REMAP,
CELL_GCM_TEXTURE_REMAP_REMAP );
break;
case RGL_RGB5_A1_SCE: // in_rgba = RGBA, out_rgba = RGBA
{
gcmFormat = CELL_GCM_TEXTURE_A1R5G5B5;
remap = CELL_GCM_REMAP_MODE(
CELL_GCM_TEXTURE_REMAP_ORDER_XXXY,
CELL_GCM_TEXTURE_REMAP_FROM_A,
CELL_GCM_TEXTURE_REMAP_FROM_R,
CELL_GCM_TEXTURE_REMAP_FROM_G,
CELL_GCM_TEXTURE_REMAP_FROM_B,
CELL_GCM_TEXTURE_REMAP_REMAP,
CELL_GCM_TEXTURE_REMAP_REMAP,
CELL_GCM_TEXTURE_REMAP_REMAP,
CELL_GCM_TEXTURE_REMAP_REMAP );
}
case RGL_RGB5_A1_SCE: // in_rgba = RGBA, out_rgba = RGBA
gcmFormat = CELL_GCM_TEXTURE_A1R5G5B5;
remap = CELL_GCM_REMAP_MODE(
CELL_GCM_TEXTURE_REMAP_ORDER_XXXY,
CELL_GCM_TEXTURE_REMAP_FROM_A,
CELL_GCM_TEXTURE_REMAP_FROM_R,
CELL_GCM_TEXTURE_REMAP_FROM_G,
CELL_GCM_TEXTURE_REMAP_FROM_B,
CELL_GCM_TEXTURE_REMAP_REMAP,
CELL_GCM_TEXTURE_REMAP_REMAP,
CELL_GCM_TEXTURE_REMAP_REMAP,
CELL_GCM_TEXTURE_REMAP_REMAP );
break;
case RGL_RGB565_SCE: // in_rgba = RGBA, out_rgba = RGBA
{
gcmFormat = CELL_GCM_TEXTURE_R5G6B5;
remap = CELL_GCM_REMAP_MODE(
CELL_GCM_TEXTURE_REMAP_ORDER_XXXY,
CELL_GCM_TEXTURE_REMAP_FROM_A,
CELL_GCM_TEXTURE_REMAP_FROM_R,
CELL_GCM_TEXTURE_REMAP_FROM_G,
CELL_GCM_TEXTURE_REMAP_FROM_B,
CELL_GCM_TEXTURE_REMAP_ONE,
CELL_GCM_TEXTURE_REMAP_REMAP,
CELL_GCM_TEXTURE_REMAP_REMAP,
CELL_GCM_TEXTURE_REMAP_REMAP );
}
break;
default:
case RGL_RGB565_SCE: // in_rgba = RGBA, out_rgba = RGBA
gcmFormat = CELL_GCM_TEXTURE_R5G6B5;
remap = CELL_GCM_REMAP_MODE(
CELL_GCM_TEXTURE_REMAP_ORDER_XXXY,
CELL_GCM_TEXTURE_REMAP_FROM_A,
CELL_GCM_TEXTURE_REMAP_FROM_R,
CELL_GCM_TEXTURE_REMAP_FROM_G,
CELL_GCM_TEXTURE_REMAP_FROM_B,
CELL_GCM_TEXTURE_REMAP_ONE,
CELL_GCM_TEXTURE_REMAP_REMAP,
CELL_GCM_TEXTURE_REMAP_REMAP,
CELL_GCM_TEXTURE_REMAP_REMAP );
break;
};

View File

@ -9,61 +9,61 @@ extern "C" {
typedef struct _ELF_section_t
{
Elf32_Shdr header;
const char* name;
char* data;
Elf32_Shdr header;
const char *name;
char *data;
} ELF_section_t;
typedef struct _ELF_segment_t
{
Elf32_Phdr header;
unsigned char* pointer;
unsigned char* data;
Elf32_Phdr header;
unsigned char *pointer;
unsigned char *data;
} ELF_segment_t;
typedef struct
{
const char* name;
unsigned int vma;
unsigned int size;
int section;
unsigned char resolved;
unsigned char foreign;
const char *name;
unsigned int vma;
unsigned int size;
int section;
unsigned char resolved;
unsigned char foreign;
} ELF_symbol_t;
typedef struct _ELF_t
{
unsigned int endian;
unsigned int relocatable;
unsigned int sectionCount;
unsigned int segmentCount;
unsigned int symbolCount;
unsigned int entrypoint;
ELF_section_t* sections;
ELF_segment_t* segments;
ELF_symbol_t* symbols;
unsigned int symbolsSection;
unsigned int symbolNamesSection;
unsigned int paramSection;
unsigned int endian;
unsigned int relocatable;
unsigned int sectionCount;
unsigned int segmentCount;
unsigned int symbolCount;
unsigned int entrypoint;
ELF_section_t *sections;
ELF_segment_t *segments;
ELF_symbol_t *symbols;
unsigned int symbolsSection;
unsigned int symbolNamesSection;
unsigned int paramSection;
} ELF_t;
typedef struct
{
unsigned int relative;
unsigned int shift;
unsigned int size;
unsigned int position;
unsigned int mask;
unsigned int relative;
unsigned int shift;
unsigned int size;
unsigned int position;
unsigned int mask;
} ELF_rel_type_t;
ELF_section_t* findSection(const ELF_t* elf,const char* name);
int lookupSymbol(const ELF_t* elf,const char* name);
const Elf32_Sym* getSymbolByIndex(const ELF_t* elf,int idx);
ELF_section_t *findSection(const ELF_t *elf, const char *name);
int lookupSymbol(const ELF_t *elf, const char *name);
const Elf32_Sym *getSymbolByIndex(const ELF_t *elf, int idx);
const char *findSectionInPlace(const char* memory,unsigned int size,const char *name,size_t *sectionSize);
const char *findSymbolSectionInPlace(const char *memory, unsigned int size, size_t *symbolSize, size_t *symbolCount, const char **symbolstrtab);
int lookupSymbolValueInPlace(const char* symbolSection, size_t symbolSize, size_t symbolCount, const char *symbolstrtab, const char *name);
const char *getSymbolByIndexInPlace(const char* symbolSection, size_t symbolSize, size_t symbolCount, const char *symbolstrtab, int index);
int lookupSymbolValueInPlace(const char *symbolSection, size_t symbolSize, size_t symbolCount, const char *symbolstrtab, const char *name);
const char *getSymbolByIndexInPlace(const char *symbolSection, size_t symbolSize, size_t symbolCount, const char *symbolstrtab, int index);
#ifdef __cplusplus
}

View File

@ -133,9 +133,9 @@ typedef GLhalfARB type_GL_HALF_FLOAT_ARB;
static const char *_getStringTable(const Elf32_Ehdr *ehdr)
{
const char *sectionHeaderStart = (const char*)ehdr + ehdr->e_shoff;
const Elf32_Shdr *shstrtabHeader = (const Elf32_Shdr*)sectionHeaderStart + ehdr->e_shstrndx;
return (const char*)ehdr + shstrtabHeader->sh_offset;
const char *sectionHeaderStart = (const char*)ehdr + ehdr->e_shoff;
const Elf32_Shdr *shstrtabHeader = (const Elf32_Shdr*)sectionHeaderStart + ehdr->e_shstrndx;
return (const char*)ehdr + shstrtabHeader->sh_offset;
}
const char *findSectionInPlace(const char* memory,unsigned int /*size*/,const char *name, size_t *sectionSize)
@ -205,14 +205,14 @@ const char *getSymbolByIndexInPlace(const char* symbolSection, size_t symbolSize
static inline type_GL_HALF_FLOAT_ARB _RGLFloatTo_GL_HALF_FLOAT_ARB( float x )
{
jsIntAndFloat V = {f: x};
unsigned int S = ( V.i >> 31 ) & 1;
int E = (( V.i >> 23 ) & 0xff ) - 0x7f;
unsigned int M = V.i & 0x007fffff;
if (( E == 0x80 ) && ( M ) ) return 0x7fff;
else if ( E >= 15 ) return( S << 15 ) | 0x7c00;
else if ( E <= -14 ) return( S << 15 ) | (( 0x800000 + M ) >> ( -14 - E ) );
else return( S << 15 ) | ((( E + 15 )&0x1f ) << 10 ) | ( M >> 13 );
jsIntAndFloat V = {f: x};
unsigned int S = ( V.i >> 31 ) & 1;
int E = (( V.i >> 23 ) & 0xff ) - 0x7f;
unsigned int M = V.i & 0x007fffff;
if (( E == 0x80 ) && ( M ) ) return 0x7fff;
else if ( E >= 15 ) return( S << 15 ) | 0x7c00;
else if ( E <= -14 ) return( S << 15 ) | (( 0x800000 + M ) >> ( -14 - E ) );
else return( S << 15 ) | ((( E + 15 )&0x1f ) << 10 ) | ( M >> 13 );
}
static inline float _RGLFloatFrom_GL_HALF_FLOAT_ARB( type_GL_HALF_FLOAT_ARB x )
@ -1912,7 +1912,7 @@ void _RGLFreeNameSpace( jsNameSpace * ns )
jsName _RGLCreateName( jsNameSpace * ns, void* object )
{
if ( NULL == ns->firstFree )
if ( ns->firstFree == NULL )
{
int newCapacity = ns->capacity + NAME_INCREMENT;
@ -1946,7 +1946,7 @@ jsName _RGLCreateName( jsNameSpace * ns, void* object )
unsigned int _RGLIsName( jsNameSpace* ns, jsName name )
{
if ( RGL_UNLIKELY( 0 == name ) )
if ( RGL_UNLIKELY( name == 0 ) )
return 0;
--name;
@ -1956,7 +1956,7 @@ unsigned int _RGLIsName( jsNameSpace* ns, jsName name )
void** value = ( void** )ns->data[name];
if ( RGL_UNLIKELY( NULL == value ||
if ( RGL_UNLIKELY( value == NULL ||
( value >= ns->data && value < ns->data + ns->capacity ) ) )
return 0;
@ -2060,7 +2060,7 @@ void _RGLTexNameSpaceDeleteNames( jsTexNameSpace *ns, GLsizei n, const GLuint *n
static inline unsigned int endianSwapWordByHalf( unsigned int v )
{
return ( v&0xffff ) << 16 | v >> 16;
return ( v&0xffff ) << 16 | v >> 16;
}
static uint32_t gmmInitFixedAllocator (void)
@ -2132,97 +2132,52 @@ static uint8_t gmmSizeToFreeIndex(
)
{
if (size >= GMM_FREE_BIN_0 && size < GMM_FREE_BIN_1)
{
return 0;
}
else if (size >= GMM_FREE_BIN_1 && size < GMM_FREE_BIN_2)
{
return 1;
}
else if (size >= GMM_FREE_BIN_2 && size < GMM_FREE_BIN_3)
{
return 2;
}
else if (size >= GMM_FREE_BIN_3 && size < GMM_FREE_BIN_4)
{
return 3;
}
else if (size >= GMM_FREE_BIN_4 && size < GMM_FREE_BIN_5)
{
return 4;
}
else if (size >= GMM_FREE_BIN_5 && size < GMM_FREE_BIN_6)
{
return 5;
}
else if (size >= GMM_FREE_BIN_6 && size < GMM_FREE_BIN_7)
{
return 6;
}
else if (size >= GMM_FREE_BIN_7 && size < GMM_FREE_BIN_8)
{
return 7;
}
else if (size >= GMM_FREE_BIN_8 && size < GMM_FREE_BIN_9)
{
return 8;
}
else if (size >= GMM_FREE_BIN_9 && size < GMM_FREE_BIN_10)
{
return 9;
}
else if (size >= GMM_FREE_BIN_10 && size < GMM_FREE_BIN_11)
{
return 10;
}
else if (size >= GMM_FREE_BIN_11 && size < GMM_FREE_BIN_12)
{
return 11;
}
else if (size >= GMM_FREE_BIN_12 && size < GMM_FREE_BIN_13)
{
return 12;
}
else if (size >= GMM_FREE_BIN_13 && size < GMM_FREE_BIN_14)
{
return 13;
}
else if (size >= GMM_FREE_BIN_14 && size < GMM_FREE_BIN_15)
{
return 14;
}
else if (size >= GMM_FREE_BIN_15 && size < GMM_FREE_BIN_16)
{
return 15;
}
else if (size >= GMM_FREE_BIN_16 && size < GMM_FREE_BIN_17)
{
return 16;
}
else if (size >= GMM_FREE_BIN_17 && size < GMM_FREE_BIN_18)
{
return 17;
}
else if (size >= GMM_FREE_BIN_18 && size < GMM_FREE_BIN_19)
{
return 18;
}
else if (size >= GMM_FREE_BIN_19 && size < GMM_FREE_BIN_20)
{
return 19;
}
else if (size >= GMM_FREE_BIN_20 && size < GMM_FREE_BIN_21)
{
return 20;
}
else
return 21;
}
static void gmmAddFree(
GmmAllocator *pAllocator,
GmmBlock *pBlock
)
static void gmmAddFree(GmmAllocator *pAllocator, GmmBlock *pBlock)
{
uint8_t freeIndex = gmmSizeToFreeIndex(pBlock->base.size);
@ -2432,22 +2387,18 @@ uint32_t gmmInit(
return gmmInitFixedAllocator();
}
void gmmSetTileAttrib(
const uint32_t id,
const uint32_t tag,
void *pData
)
void gmmSetTileAttrib(const uint32_t id, const uint32_t tag, void *pData)
{
GmmTileBlock *pTileBlock = (GmmTileBlock *)id;
GmmTileBlock *pTileBlock = (GmmTileBlock *)id;
pTileBlock->tileTag = tag;
pTileBlock->pData = pData;
pTileBlock->tileTag = tag;
pTileBlock->pData = pData;
}
uint32_t gmmIdToOffset(const uint32_t id)
{
GmmBaseBlock *pBaseBlock = (GmmBaseBlock *)id;
return gmmAddressToOffset(pBaseBlock->address, pBaseBlock->isMain);
GmmBaseBlock *pBaseBlock = (GmmBaseBlock *)id;
return gmmAddressToOffset(pBaseBlock->address, pBaseBlock->isMain);
}
char *gmmIdToAddress(const uint32_t id)
@ -2577,9 +2528,7 @@ static GmmTileBlock *gmmCreateTileBlock(
if (pAllocator->pTail &&
pAllocator->pTail->base.address + pAllocator->pTail->base.size > address)
{
return NULL;
}
pAllocator->size = address - pAllocator->startAddress;
pAllocator->tileSize = pAllocator->tileStartAddress + pAllocator->tileSize - address;
@ -2587,9 +2536,7 @@ static GmmTileBlock *gmmCreateTileBlock(
pNewBlock = (GmmTileBlock *)gmmAllocFixed(1);
if (pNewBlock == NULL)
{
return NULL;
}
memset(pNewBlock, 0, sizeof(GmmTileBlock));
@ -2600,15 +2547,11 @@ static GmmTileBlock *gmmCreateTileBlock(
pNewBlock->pNext = pAllocator->pTileHead;
if (pAllocator->pTileHead)
{
pAllocator->pTileHead->pPrev = pNewBlock;
pAllocator->pTileHead = pNewBlock;
}
else
{
pAllocator->pTileHead = pNewBlock;
pAllocator->pTileTail = pNewBlock;
}
pAllocator->pTileHead = pNewBlock;
return pNewBlock;
}
@ -2764,9 +2707,7 @@ static GmmTileBlock *gmmAllocTileBlock(
return pBlock;
}
static void gmmFreeBlock(
GmmBlock *pBlock
)
static void gmmFreeBlock (GmmBlock *pBlock)
{
GmmAllocator *pAllocator;
@ -2852,7 +2793,6 @@ uint32_t gmmFree(const uint32_t freeId)
{
GmmBaseBlock *pBaseBlock = (GmmBaseBlock *)freeId;
if (pBaseBlock->isTile)
{
GmmTileBlock *pTileBlock = (GmmTileBlock *)pBaseBlock;
@ -2966,18 +2906,16 @@ static inline void gmmLocalMemcpy(
static inline void gmmMemcpy(const uint32_t dstOffset, const uint32_t srcOffset, const uint32_t moveSize)
{
if (dstOffset + moveSize <= srcOffset)
{
gmmLocalMemcpy(dstOffset, srcOffset, moveSize);
}
else
{
uint32_t moveBlockSize = srcOffset-dstOffset;
uint32_t iterations = (moveSize+moveBlockSize-1)/moveBlockSize;
if (dstOffset + moveSize <= srcOffset)
gmmLocalMemcpy(dstOffset, srcOffset, moveSize);
else
{
uint32_t moveBlockSize = srcOffset-dstOffset;
uint32_t iterations = (moveSize+moveBlockSize-1)/moveBlockSize;
for (uint32_t i=0; i<iterations; i++)
gmmLocalMemcpy(dstOffset+(i*moveBlockSize), srcOffset+(i*moveBlockSize), moveBlockSize);
}
for (uint32_t i = 0; i < iterations; i++)
gmmLocalMemcpy(dstOffset+(i*moveBlockSize), srcOffset+(i*moveBlockSize), moveBlockSize);
}
}
static uint8_t gmmInternalSweep (void)
@ -3228,9 +3166,7 @@ static uint32_t gmmFindFreeBlock(
pBlock = pBlock->pNextFree;
}
else if (++freeIndex < GMM_NUM_FREE_BINS)
{
pBlock = pAllocator->pFreeHead[freeIndex];
}
}
if (found)
@ -3248,10 +3184,10 @@ static uint32_t gmmFindFreeBlock(
pNewBlock->base.size = pBlock->base.size - size;
pNewBlock->pNext = pBlock->pNext;
pNewBlock->pPrev = pBlock;
if (pBlock->pNext)
{
pBlock->pNext->pPrev = pNewBlock;
}
pBlock->pNext = pNewBlock;
if (pBlock == pAllocator->pTail)
@ -3376,22 +3312,10 @@ RGLparamUID getParamUIDByIndex( const RGLparamUIDTable* st, int index )
return st->uids[index];
}
void _RGLPlatformSetVertexRegister4fv( unsigned int reg, const float * __restrict v )
{
}
void _RGLPlatformSetVertexRegisterBlock( unsigned int reg, unsigned int count, const float * __restrict v )
{
}
void _RGLPlatformSetFragmentRegister4fv( unsigned int reg, const float * __restrict v )
{
}
void _RGLPlatformSetFragmentRegisterBlock( unsigned int reg, unsigned int count, const float * __restrict v )
{
}
void _RGLPlatformSetVertexRegister4fv( unsigned int reg, const float * __restrict v ) {}
void _RGLPlatformSetVertexRegisterBlock( unsigned int reg, unsigned int count, const float * __restrict v ) {}
void _RGLPlatformSetFragmentRegister4fv( unsigned int reg, const float * __restrict v ) {}
void _RGLPlatformSetFragmentRegisterBlock( unsigned int reg, unsigned int count, const float * __restrict v ) {}
template<int SIZE> inline static void swapandsetfp( int ucodeSize, unsigned int loadProgramId, unsigned int loadProgramOffset, unsigned short *ec, const unsigned int * __restrict v )
{
@ -3431,13 +3355,10 @@ template<int SIZE> static void setVectorTypefp( CgRuntimeParameter* __restrict p
}
}
template<int SIZE> static void setVectorTypeSharedfpIndex( CgRuntimeParameter* __restrict ptr, const void* __restrict v, const int )
{
}
template<int SIZE> static void setVectorTypeSharedfpIndex( CgRuntimeParameter* __restrict ptr, const void* __restrict v, const int ) {}
template<int SIZE> static void setVectorTypeSharedfpIndexArray( CgRuntimeParameter* __restrict ptr, const void* __restrict v, const int index ) {}
template<int SIZE> static void setVectorTypeSharedfpIndexArray( CgRuntimeParameter* __restrict ptr, const void* __restrict v, const int index )
{
}
template<int SIZE> static void setVectorTypeSharedvpIndex( CgRuntimeParameter* __restrict ptr, const void* __restrict v, const int )
{
const float * __restrict f = ( const float * __restrict )v;
@ -4479,11 +4400,6 @@ int _RGLPlatformCopyProgram( _CGprogram* source, _CGprogram* destination )
return _RGLGenerateProgram( destination, profileIndex, &source->header, source->ucode, &parameterHeader, source->parametersEntries, source->stringTable, source->defaultValues );
}
static char *_RGLPlatformBufferObjectMap( jsBufferObject* bufferObject, GLenum access )
{
RGLBufferObject *jsBuffer = ( RGLBufferObject * )bufferObject->platformBufferObject;
@ -4712,21 +4628,21 @@ static void _RGLPlatformExpandInternalFormat( GLenum internalFormat, GLenum *for
static GLenum _RGLPlatformChooseInternalStorage( jsImage* image, GLenum internalFormat )
{
image->storageSize = 0;
image->storageSize = 0;
GLenum platformInternalFormat = _RGLPlatformChooseInternalFormat( internalFormat );
GLenum platformInternalFormat = _RGLPlatformChooseInternalFormat( internalFormat );
if ( platformInternalFormat == GL_INVALID_ENUM )
return GL_INVALID_ENUM;
if ( platformInternalFormat == GL_INVALID_ENUM )
return GL_INVALID_ENUM;
image->internalFormat = platformInternalFormat;
_RGLPlatformExpandInternalFormat( platformInternalFormat, &image->format, &image->type );
image->internalFormat = platformInternalFormat;
_RGLPlatformExpandInternalFormat( platformInternalFormat, &image->format, &image->type );
image->storageSize = _RGLGetStorageSize(
image->format, image->type,
image->width, image->height, 1 );
image->storageSize = _RGLGetStorageSize(
image->format, image->type,
image->width, image->height, 1 );
return GL_NO_ERROR;
return GL_NO_ERROR;
}
static inline GLuint _RGLGetBufferObjectOrigin( GLuint buffer )
@ -4884,7 +4800,7 @@ static GLboolean _RGLPlatformTexturePBOImage(
const GLuint bytesPerPixel = newLayout.pixelBits / 8;
RGLSurface src =
{
source: _RGL_SURFACE_SOURCE_PBO,
source: _RGL_SURFACE_SOURCE_PBO,
width: image->width,
height: image->height,
bpp: bytesPerPixel,
@ -4901,7 +4817,7 @@ source: _RGL_SURFACE_SOURCE_PBO,
RGLSurface dst =
{
source: _RGL_SURFACE_SOURCE_TEXTURE,
source: _RGL_SURFACE_SOURCE_TEXTURE,
width: image->width,
height: image->height,
bpp: bytesPerPixel,
@ -5064,9 +4980,7 @@ void _RGLFifoGlSetRenderTarget( RGLRenderTargetEx const * const args )
cellGcmSetDepthTestEnableInline( &_RGLState.fifo, CELL_GCM_FALSE);
}
void _RGLSetError( GLenum error )
{
}
void _RGLSetError( GLenum error ) {}
GLAPI GLenum APIENTRY glGetError()
{
@ -5367,17 +5281,17 @@ PSGLcontext *psglGetCurrentContext()
const GLfloat _RGLIdentityMatrixf[ELEMENTS_IN_MATRIX] =
{
1.f, 0.f, 0.f, 0.f,
0.f, 1.f, 0.f, 0.f,
0.f, 0.f, 1.f, 0.f,
0.f, 0.f, 0.f, 1.f
1.f, 0.f, 0.f, 0.f,
0.f, 1.f, 0.f, 0.f,
0.f, 0.f, 1.f, 0.f,
0.f, 0.f, 0.f, 1.f
};
static void _RGLMatrixStackReset( jsMatrixStack* LMatrixStack )
{
LMatrixStack->MatrixStackPtr = 0;
memcpy( LMatrixStack->MatrixStackf, _RGLIdentityMatrixf, jsMATRIX_SIZEf );
LMatrixStack->dirty = GL_TRUE;
LMatrixStack->MatrixStackPtr = 0;
memcpy( LMatrixStack->MatrixStackf, _RGLIdentityMatrixf, jsMATRIX_SIZEf );
LMatrixStack->dirty = GL_TRUE;
}
static void _RGLResetContext( PSGLcontext *LContext )
@ -5601,7 +5515,8 @@ PSGLcontext* psglCreateContext (void)
_RGLResetContext( LContext );
if ( _RGLContextCreateHook ) _RGLContextCreateHook( LContext );
if ( _RGLContextCreateHook )
_RGLContextCreateHook( LContext );
return( LContext );
}
@ -5960,19 +5875,19 @@ void psglExit (void)
GLAPI void APIENTRY glLoadIdentity()
{
PSGLcontext* LContext = _CurrentContext;
jsMatrixStack* LMatrixStack = NULL;
PSGLcontext* LContext = _CurrentContext;
jsMatrixStack* LMatrixStack = NULL;
jsContextGetMatrixStack(LContext, LContext->MatrixMode, LMatrixStack);
memcpy( LMatrixStack->MatrixStackf + LMatrixStack->MatrixStackPtr*ELEMENTS_IN_MATRIX, _RGLIdentityMatrixf, jsMATRIX_SIZEf );
jsContextGetMatrixStack(LContext, LContext->MatrixMode, LMatrixStack);
memcpy( LMatrixStack->MatrixStackf + LMatrixStack->MatrixStackPtr*ELEMENTS_IN_MATRIX, _RGLIdentityMatrixf, jsMATRIX_SIZEf );
LMatrixStack->dirty = GL_TRUE;
LMatrixStack->dirty = GL_TRUE;
}
GLAPI void APIENTRY glMatrixMode( GLenum mode )
{
PSGLcontext* LContext = _CurrentContext;
LContext->MatrixMode = mode;
PSGLcontext* LContext = _CurrentContext;
LContext->MatrixMode = mode;
}
GLAPI void APIENTRY glOrthof( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar )
@ -6289,11 +6204,13 @@ GLAPI void APIENTRY glDrawArrays( GLenum mode, GLint first, GLsizei count )
if ( RGL_UNLIKELY( ! RGLBIT_GET( LContext->attribs->EnabledMask, _RGL_ATTRIB_POSITION_INDEX ) ) ) return;
uint32_t _tmp_clear_loop = c_rounded_size_of_RGLDrawParams>>7;
uint32_t _tmp_clear_loop = c_rounded_size_of_RGLDrawParams >> 7;
do{
--_tmp_clear_loop;
__dcbz(s_dparams_buff+(_tmp_clear_loop<<7));
--_tmp_clear_loop;
__dcbz(s_dparams_buff+(_tmp_clear_loop << 7));
}while(_tmp_clear_loop);
jsDrawParams *dparams = (jsDrawParams *)s_dparams_buff;
dparams->mode = mode;
dparams->firstVertex = first;
@ -6307,6 +6224,9 @@ GLAPI void APIENTRY glDrawArrays( GLenum mode, GLint first, GLsizei count )
{
for ( int i = 0; i < _RGL_MAX_VERTEX_ATTRIBS; ++i )
{
dparams->attribXferOffset[i] = 0;
dparams->attribXferSize[i] = 0;
if ( clientSideMask & ( 1 << i ) )
{
jsAttribute* attrib = as->attrib + i;
@ -6324,11 +6244,6 @@ GLAPI void APIENTRY glDrawArrays( GLenum mode, GLint first, GLsizei count )
dparams->xferTotalSize += numBytesPadded;
dparams->attribXferTotalSize += numBytesPadded;
}
else
{
dparams->attribXferOffset[i] = 0;
dparams->attribXferSize[i] = 0;
}
}
}
@ -6338,12 +6253,11 @@ GLAPI void APIENTRY glDrawArrays( GLenum mode, GLint first, GLsizei count )
GLboolean isMain = 0;
if ( LContext->attribSetDirty && LContext->attribSetName )
{
jsAttribSet* attribSet = _RGLGetAttribSet( LContext->attribSetName );
}
jsAttribSet* attribSet = _RGLGetAttribSet( LContext->attribSetName );
uint32_t totalXfer = 0;
for ( GLuint i = 0; i < _RGL_MAX_VERTEX_ATTRIBS; ++i )
totalXfer += dparams->attribXferSize[i];
totalXfer += dparams->attribXferSize[i];
GLuint gpuOffset = _RGLValidateAttributesSlow( dparams, &isMain );
(void)gpuOffset;
@ -6611,43 +6525,43 @@ GLAPI void APIENTRY glPixelStorei( GLenum pname, GLint param )
GLAPI void APIENTRY glTextureReferenceSCE( GLenum target, GLuint levels, GLuint baseWidth, GLuint baseHeight, GLuint baseDepth, GLenum internalFormat, GLuint pitch, GLintptr offset )
{
PSGLcontext* LContext = _CurrentContext;
PSGLcontext* LContext = _CurrentContext;
jsTexture *texture = _RGLGetCurrentTexture( LContext->CurrentImageUnit, GL_TEXTURE_2D);
jsBufferObject *bufferObject = _RGLGetBufferObject( LContext, LContext->TextureBuffer );
_RGLReallocateImages( texture, MAX( baseWidth, MAX( baseHeight, baseDepth ) ) );
jsTexture *texture = _RGLGetCurrentTexture( LContext->CurrentImageUnit, GL_TEXTURE_2D);
jsBufferObject *bufferObject = _RGLGetBufferObject( LContext, LContext->TextureBuffer );
_RGLReallocateImages( texture, MAX( baseWidth, MAX( baseHeight, baseDepth ) ) );
GLuint width = baseWidth;
GLuint height = baseHeight;
_RGLSetImage(texture->image, GL_RGB5_A1, width, height, 0, LContext->unpackAlignment,
0, 0, NULL );
width = MAX( 1U, width / 2 );
height = MAX( 1U, height / 2 );
texture->usage = GL_TEXTURE_LINEAR_GPU_SCE;
GLuint width = baseWidth;
GLuint height = baseHeight;
_RGLSetImage(texture->image, GL_RGB5_A1, width, height, 0, LContext->unpackAlignment,
0, 0, NULL );
width = MAX( 1U, width / 2 );
height = MAX( 1U, height / 2 );
texture->usage = GL_TEXTURE_LINEAR_GPU_SCE;
GLboolean r = _RGLPlatformTextureReference( texture, pitch, bufferObject, offset );
GLboolean r = _RGLPlatformTextureReference( texture, pitch, bufferObject, offset );
if(!r)
return;
if(!r)
return;
bufferObject->textureReferences.pushBack( texture );
texture->referenceBuffer = bufferObject;
texture->offset = offset;
_RGLTextureTouchFBOs( texture );
LContext->needValidate |= PSGL_VALIDATE_TEXTURES_USED | PSGL_VALIDATE_VERTEX_TEXTURES_USED ;
bufferObject->textureReferences.pushBack( texture );
texture->referenceBuffer = bufferObject;
texture->offset = offset;
_RGLTextureTouchFBOs( texture );
LContext->needValidate |= PSGL_VALIDATE_TEXTURES_USED | PSGL_VALIDATE_VERTEX_TEXTURES_USED ;
}
GLAPI void APIENTRY glViewport( GLint x, GLint y, GLsizei width, GLsizei height )
{
PSGLcontext* LContext = _CurrentContext;
PSGLcontext* LContext = _CurrentContext;
LContext->ViewPort.X = x;
LContext->ViewPort.Y = y;
LContext->ViewPort.XSize = width;
LContext->ViewPort.YSize = height;
LContext->ViewPort.X = x;
LContext->ViewPort.Y = y;
LContext->ViewPort.XSize = width;
LContext->ViewPort.YSize = height;
_RGLFifoGlViewport(LContext->ViewPort.X, LContext->ViewPort.Y,
LContext->ViewPort.XSize, LContext->ViewPort.YSize, 0.0f, 1.0f);
_RGLFifoGlViewport(LContext->ViewPort.X, LContext->ViewPort.Y,
LContext->ViewPort.XSize, LContext->ViewPort.YSize, 0.0f, 1.0f);
}
jsTexture *_RGLGetCurrentTexture( const jsTextureImageUnit *unit, GLenum target )
@ -6677,30 +6591,27 @@ CgparameterHookFunction _cgParameterDestroyHook = NULL;
typedef struct RGLcgProfileMapType
{
CGprofile id;
char* string;
int is_vertex_program;
}
RGLcgProfileMapType;
CGprofile id;
char* string;
int is_vertex_program;
} RGLcgProfileMapType;
static void _RGLCgProgramPushFront( _CGcontext* ctx, _CGprogram* prog )
{
prog->next = ctx->programList;
ctx->programList = prog;
prog->parentContext = ctx;
ctx->programCount++;
prog->next = ctx->programList;
ctx->programList = prog;
prog->parentContext = ctx;
ctx->programCount++;
}
static _CGprogram* _RGLCgProgramFindPrev( _CGcontext* ctx, _CGprogram* prog )
{
_CGprogram* ptr = ctx->programList;
_CGprogram* ptr = ctx->programList;
while ( NULL != ptr && prog != ptr->next )
{
ptr = ptr->next;
}
while ( NULL != ptr && prog != ptr->next )
ptr = ptr->next;
return ptr;
return ptr;
}
void _RGLCgProgramErase( _CGprogram* prog )
@ -6761,32 +6672,30 @@ bool _RGLCgCreateProgramChecks( CGcontext ctx, CGprofile profile, CGenum program
typedef struct
{
const char* elfFile;
size_t elfFileSize;
const char* elfFile;
size_t elfFileSize;
const char *symtab;
size_t symbolSize;
size_t symbolCount;
const char *symbolstrtab;
const char *symtab;
size_t symbolSize;
size_t symbolCount;
const char *symbolstrtab;
const char* shadertab;
size_t shadertabSize;
const char* strtab;
size_t strtabSize;
const char* consttab;
size_t consttabSize;
}
CGELFBinary;
const char* shadertab;
size_t shadertabSize;
const char* strtab;
size_t strtabSize;
const char* consttab;
size_t consttabSize;
} CGELFBinary;
typedef struct
{
const char *texttab;
size_t texttabSize;
const char *paramtab;
size_t paramtabSize;
int index;
}
CGELFProgram;
const char *texttab;
size_t texttabSize;
const char *paramtab;
size_t paramtabSize;
int index;
} CGELFProgram;
static bool cgOpenElf( const void *ptr, size_t size, CGELFBinary *elfBinary )
{
@ -6882,7 +6791,7 @@ static CGprogram _RGLCgCreateProgram( CGcontext ctx, CGprofile profile, const Cg
// The parameters and the actual program are generated from the ABI specific calls.
_CGprogram* prog = ( _CGprogram* )malloc( sizeof( _CGprogram ) );
if ( NULL == prog )
if ( prog == NULL )
{
_RGLCgRaiseError( CG_MEMORY_ALLOC_ERROR );
return NULL;
@ -6935,7 +6844,7 @@ static CGprogram _RGLCgCreateProgram( CGcontext ctx, CGprofile profile, const Cg
// if the creation failed, free all resources.
// the error was raised when the error was encoutered.
if ( 0 == success )
if ( success == 0 )
{
// free the program object
free( prog );
@ -7011,9 +6920,7 @@ CG_API CGprogram cgCreateProgram( CGcontext ctx,
}
}
else
{
binaryBuffer = program;
}
bool bConvertedToElf = false;
@ -7134,8 +7041,6 @@ CG_API CGprogram cgCreateProgram( CGcontext ctx,
return prog;
}
CG_API CGprogram cgCreateProgramFromFile( CGcontext ctx,
CGenum program_type,
const char* program_file,
@ -7192,7 +7097,7 @@ CG_API CGprogram cgCreateProgramFromFile( CGcontext ctx,
{
fp = fopen( program_file, "rb" );
if ( NULL == fp )
if ( fp == NULL )
{
_RGLCgRaiseError( CG_FILE_READ_ERROR );
return ( CGprogram )NULL;
@ -7244,7 +7149,7 @@ CG_API CGprogram cgCreateProgramFromFile( CGcontext ctx,
if ( !fp )
{
fp = fopen( program_file, "rb" );
if ( NULL == fp )
if ( fp == NULL )
{
_RGLCgRaiseError( CG_FILE_READ_ERROR );
return ( CGprogram )NULL;
@ -7257,7 +7162,7 @@ CG_API CGprogram cgCreateProgramFromFile( CGcontext ctx,
rewind( fp );
char* ptr = ( char* )malloc( file_size + 1 );
if ( NULL == ptr )
if ( ptr == NULL )
{
_RGLCgRaiseError( CG_MEMORY_ALLOC_ERROR );
fclose( fp );
@ -7287,7 +7192,7 @@ CG_API CGprogram cgCopyProgram( CGprogram program )
return NULL;
}
_CGprogram* prog = _cgGetProgPtr( program );
if ( NULL == prog )
if ( prog == NULL )
{
_RGLCgRaiseError( CG_INVALID_PROGRAM_HANDLE_ERROR );
return ( CGprogram )NULL;
@ -7308,7 +7213,7 @@ CG_API CGprogram cgCopyProgram( CGprogram program )
newprog = ( _CGprogram* )malloc( sizeof( _CGprogram ) );
}
if ( NULL == newprog )
if ( newprog == NULL )
{
_RGLCgRaiseError( CG_MEMORY_ALLOC_ERROR );
return ( CGprogram )NULL;
@ -7371,7 +7276,7 @@ CG_API void cgDestroyProgram( CGprogram program )
return;
}
_CGprogram* ptr = _cgGetProgPtr( program );
if ( NULL == ptr )
if ( ptr == NULL )
{
_RGLCgRaiseError( CG_INVALID_PROGRAM_HANDLE_ERROR );
return;
@ -7489,7 +7394,7 @@ CGprogramGroup _RGLCgCreateProgramGroupFromFile( CGcontext ctx, const char *grou
{
FILE* fp = fopen( group_file, "rb" );
if ( NULL == fp )
if ( fp == NULL )
{
_RGLCgRaiseError( CG_FILE_READ_ERROR );
return ( CGprogramGroup )NULL;
@ -7501,7 +7406,7 @@ CGprogramGroup _RGLCgCreateProgramGroupFromFile( CGcontext ctx, const char *grou
rewind( fp );
char* ptr = ( char* )malloc( file_size + 1 );
if ( NULL == ptr )
if ( ptr == NULL )
{
_RGLCgRaiseError( CG_MEMORY_ALLOC_ERROR );
return ( CGprogramGroup )NULL;
@ -7651,16 +7556,14 @@ int _RGLCgGetProgramCount( CGprogramGroup group )
}
static const RGLcgProfileMapType RGLcgProfileMap[] =
{
{( CGprofile )6144, "CG_PROFILE_START", 1 },
{( CGprofile )6145, "unknown", 1 },
{
{( CGprofile )6144, "CG_PROFILE_START", 1 },
{( CGprofile )6145, "unknown", 1 },
#define CG_PROFILE_MACRO(name, compiler_id, compiler_id_caps, compiler_opt,int_id,vertex_profile) \
{CG_PROFILE_ ## compiler_id_caps, compiler_opt, vertex_profile},
{CG_PROFILE_ ## compiler_id_caps, compiler_opt, vertex_profile},
#include <Cg/cg_profiles.h>
{( CGprofile )0, "", 0 }
};
{( CGprofile )0, "", 0 }
};
CG_API const char* cgGetProfileString( CGprofile profile )
{
@ -7683,7 +7586,7 @@ CG_API CGprofile cgGetProfile( const char* profile_string )
unsigned int i = 0;
while ( i < arraysize )
{
if ( 0 == strcmp( RGLcgProfileMap[i].string, profile_string ) )
if ( strcmp( RGLcgProfileMap[i].string, profile_string ) == 0 )
{
return RGLcgProfileMap[i].id;
}
@ -8063,7 +7966,7 @@ CGGL_API void cgGLLoadProgram( CGprogram program )
CGGL_API CGbool cgGLIsProgramLoaded( CGprogram program )
{
return CG_TRUE;
return CG_TRUE;
}
@ -8132,43 +8035,34 @@ CGGL_API void cgGLUnbindProgram( CGprofile profile )
CGGL_API GLuint cgGLGetProgramID( CGprogram program )
{
return 0;
}
CGGL_API void cgGLEnableProgramProfiles( CGprogram program )
{
return;
}
CGGL_API void cgGLDisableProgramProfiles( CGprogram program )
{
return;
return 0;
}
CGGL_API void cgGLEnableProgramProfiles( CGprogram program ) {}
CGGL_API void cgGLDisableProgramProfiles( CGprogram program ) {}
CGGL_API void cgGLSetParameter1f( CGparameter param, float x )
{
CgRuntimeParameter *ptr = _RGLCgGLTestParameter( param );
CgRuntimeParameter *ptr = _RGLCgGLTestParameter( param );
float v[4] = {x, x, x, x};
ptr->setterIndex( ptr, v, CG_GETINDEX( param ) );
float v[4] = {x, x, x, x};
ptr->setterIndex( ptr, v, CG_GETINDEX( param ) );
}
CGGL_API void cgGLSetParameter2f( CGparameter param, float x, float y )
{
CgRuntimeParameter *ptr = _RGLCgGLTestParameter( param );
CgRuntimeParameter *ptr = _RGLCgGLTestParameter( param );
float v[4] = {x, y, y, y};
ptr->setterIndex( ptr, v, CG_GETINDEX( param ) );
float v[4] = {x, y, y, y};
ptr->setterIndex( ptr, v, CG_GETINDEX( param ) );
}
CGGL_API void cgGLSetParameterPointer( CGparameter param,
GLint fsize,
GLenum type,
GLsizei stride,
const GLvoid *pointer )
CGGL_API void cgGLSetParameterPointer
( CGparameter param,
GLint fsize,
GLenum type,
GLsizei stride,
const GLvoid *pointer )
{
CgRuntimeParameter *_ptr = _RGLCgGLTestParameter( param );
@ -8187,13 +8081,12 @@ CGGL_API void cgGLSetParameterPointer( CGparameter param,
CGGL_API void cgGLEnableClientState( CGparameter param )
{
CgRuntimeParameter *_ptr = _RGLCgGLTestParameter( param );
CgRuntimeParameter *_ptr = _RGLCgGLTestParameter( param );
const CgParameterResource *parameterResource = _RGLGetParameterResource( _ptr->program, _ptr->parameterEntry );
const CgParameterResource *parameterResource = _RGLGetParameterResource( _ptr->program, _ptr->parameterEntry );
GLuint index = ( GLuint )( parameterResource->resource - CG_ATTR0 );
_RGLEnableVertexAttribArrayNV( index );
GLuint index = ( GLuint )( parameterResource->resource - CG_ATTR0 );
_RGLEnableVertexAttribArrayNV( index );
}
CGGL_API void cgGLDisableClientState( CGparameter param )
@ -8278,9 +8171,8 @@ CGGL_API void cgGLEnableTextureParameter( CGparameter param )
static void _RGLCgContextZero( _CGcontext* p )
{
memset( p, 0, sizeof( *p ) );
p->compileType = CG_UNKNOWN;
memset( p, 0, sizeof( *p ) );
p->compileType = CG_UNKNOWN;
}
static void _RGLCgContextPushFront( _CGcontext* ctx )
@ -8306,7 +8198,7 @@ CG_API CGcontext cgCreateContext( void )
_CGcontext* ptr = NULL;
ptr = ( _CGcontext* )malloc( sizeof( _CGcontext ) );
if ( NULL == ptr )
if ( ptr == NULL )
{
_RGLCgRaiseError( CG_MEMORY_ALLOC_ERROR );
return ( CGcontext )NULL;
@ -8608,33 +8500,30 @@ unsigned int _RGLCountFloatsInCgType( CGtype type )
void _cgRaiseInvalidParam( CgRuntimeParameter*p, const void*v )
{
_RGLCgRaiseError( CG_INVALID_PARAMETER_ERROR );
_RGLCgRaiseError( CG_INVALID_PARAMETER_ERROR );
}
void _cgRaiseInvalidParamIndex( CgRuntimeParameter*p, const void*v, const int index )
{
_RGLCgRaiseError( CG_INVALID_PARAMETER_ERROR );
_RGLCgRaiseError( CG_INVALID_PARAMETER_ERROR );
}
void _cgRaiseNotMatrixParam( CgRuntimeParameter*p, const void*v )
{
_RGLCgRaiseError( CG_NOT_MATRIX_PARAM_ERROR );
}
void _cgRaiseNotMatrixParamIndex( CgRuntimeParameter*p, const void*v, const int index )
{
_RGLCgRaiseError( CG_NOT_MATRIX_PARAM_ERROR );
_RGLCgRaiseError( CG_NOT_MATRIX_PARAM_ERROR );
}
void _cgIgnoreSetParam( CgRuntimeParameter*p, const void*v )
{
}
void _cgIgnoreSetParamIndex( CgRuntimeParameter*p, const void*v, const int index )
void _cgRaiseNotMatrixParamIndex( CgRuntimeParameter*p, const void*v, const int index )
{
_RGLCgRaiseError( CG_NOT_MATRIX_PARAM_ERROR );
}
void _cgIgnoreSetParam( CgRuntimeParameter*p, const void*v ) {}
void _cgIgnoreSetParamIndex( CgRuntimeParameter*p, const void*v, const int index ) {}
CgRuntimeParameter* _cgGLTestTextureParameter( CGparameter param )
{
CgRuntimeParameter* ptr = _RGLCgGLTestParameter( param );
return ptr;
CgRuntimeParameter* ptr = _RGLCgGLTestParameter( param );
return ptr;
}

File diff suppressed because it is too large Load Diff

View File

@ -289,6 +289,14 @@
#endif
/*============================================================
TIMER PROTOTYPES
============================================================ */
#ifdef __PSL1GHT__
#define sys_timer_usleep usleep
#endif
/*============================================================
THREADING PROTOTYPES
============================================================ */