1
0
mirror of https://github.com/libretro/RetroArch synced 2024-07-08 12:15:49 +00:00

(PS3) Move out gcmgl

This commit is contained in:
twinaphex 2015-03-15 17:39:15 +01:00
parent 58d70364ec
commit dc66e35a0c
34 changed files with 0 additions and 18064 deletions

View File

@ -1,56 +0,0 @@
#which compiler to build with - GCC or SNC
#set to GCC for debug builds for use with debugger
CELL_BUILD_TOOLS = GCC
CELL_GPU_TYPE = RSX
DEBUG = 0
STRIPPING_ENABLE = 1
RGL_2D = 1
PC_DEVELOPMENT_IP_ADDRESS = "192.168.1.7"
PC_DEVELOPMENT_UDP_PORT = 3490
CELL_MK_DIR ?= $(CELL_SDK)/samples/mk
include $(CELL_MK_DIR)/sdk.makedef.mk
PPU_LIB_TARGET = librgl_ps3.a
LDDIRS = -L.
INCDIRS = -I. -Ips3/gcmgl/include -Ilibretro-common/include
RGL_DIR = ps3/gcmgl/src
PPU_SRCS = $(RGL_DIR)/libelf/readelf.c \
$(RGL_DIR)/rgl_ps3_raster.cpp \
$(RGL_DIR)/rgl_ps3.cpp
ifeq ($(CELL_BUILD_TOOLS), SNC)
PPU_CXXLD = $(CELL_SDK)/host-win32/sn/bin/ps3ppuld.exe
PPU_CXX = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe
PPU_CC = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe
SNC_PPU_AR = $(CELL_SDK)/host-win32/sn/bin/ps3snarl.exe
else
PPU_CXX = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-g++.exe
PPU_CC = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-gcc.exe
PPU_CXXLD = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ld.exe
PPU_AR = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ar.exe
endif
PPU_RANLIB = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ranlib.exe
PPU_LDLIBS = -lio_stub
DEFINES += -D__CELLOS_LV2__ -DRARCH_INTERNAL
ifeq ($(DEBUG), 1)
PPU_OPTIMIZE_LV := -O0 -g
else
PPU_OPTIMIZE_LV := -O3
endif
PPU_CFLAGS = $(PPU_OPTIMIZE_LV) $(INCDIRS) $(DEFINES)
PPU_CXXFLAGS = $(PPU_OPTIMIZE_LV) $(INCDIRS) $(DEFINES)
include $(CELL_MK_DIR)/sdk.target.mk

View File

@ -1,11 +1,9 @@
#!/bin/sh
make -C ../ -f Makefile.ps3.salamander clean || exit 1
make -C ../ -f Makefile.ps3.rgl clean || exit 1
make -C ../ -f Makefile.ps3 clean || exit 1
make -C ../ -f Makefile.ps3.salamander || exit 1
make -C ../ -f Makefile.ps3.rgl || exit 1
EXE_PATH=/usr/local/cell/host-win32/bin
MAKE_FSELF_NPDRM=$EXE_PATH/make_fself_npdrm.exe

View File

@ -1,326 +0,0 @@
#ifndef _cg_common_h
#define _cg_common_h
#include <Cg/cg.h>
#include "../export/PSGL/psgl.h"
#include "../PSGL/private.h"
#include <string>
#include "Cg/CgInternal.h"
#include "Cg/CgProgramGroup.h"
#ifdef __cplusplus
extern "C" {
#endif
#define RGL_MAX_VP_SHARED_CONSTANTS 256
#define RGL_MAX_FP_SHARED_CONSTANTS 1024
#define RGL_BOOLEAN_REGISTERS_COUNT 32
// parameter setter, prototype of functions called when a uniform is set.
typedef void(*_cgSetFunction) (void *, const void*);
typedef void(*_cgSetArrayIndexFunction) (void *, const void*, const int index);
typedef struct _CgUniform
{
void *pushBufferPtr;
} _CgUniform;
typedef struct _CGprogram _CGprogram;
typedef struct CgRuntimeParameter
{
_cgSetArrayIndexFunction samplerSetter;
_cgSetArrayIndexFunction setterIndex;
_cgSetArrayIndexFunction settercIndex;
_cgSetArrayIndexFunction setterrIndex;
void *pushBufferPointer;
const CgParameterEntry *parameterEntry;
_CGprogram *program;
int glType;
CGparameter id;
} CgRuntimeParameter;
struct _CGprogram
{
struct _CGprogram* next; // link to next in NULL-terminated singly linked list of programs
CGprogram id; // numerical id for this program object
struct _CGcontext* parentContext; // parent context for this program
void* parentEffect; // parent effect for this program (only used for default program of an effect, containing effect parameters)
bool inLocalMemory; // only pertains to fragment programs which can be in location local, the default, or location main via cgb interfaces
// parameters in the CG_PROGRAM namespace
unsigned int constantPushBufferWordSize;
unsigned int* constantPushBuffer;
unsigned int lastConstantUpdate;
// executable program image
void* platformProgram;
// entire binary program image from compiler
void* platformProgramBinary;
// extra information to ease the coding of the rgl runtime
// the following are used to know which parameters are samplers, so that we can walk them in a quick way.
unsigned int samplerCount;
unsigned int * samplerIndices;
unsigned int * samplerUnits;
//binary format additions
//info previously contained in platformProgram ( loadAddress + nvBinary )
CgProgramHeader header;
const char *name;
const void *ucode;
GLuint loadProgramId;
// offset into the allocation id above, normally zero for internal use.
// But for psglSetFragmentProgramConfiguration it's possible for
// users to manage sub-heap in allocation and put multiple
// program in each allocation.
GLuint loadProgramOffset;
int version; //contained a boolean indicating if the structure pointers have been patched or not
char *parameterResources;
int rtParametersCount;
CgRuntimeParameter *runtimeParameters;
const CgParameterEntry *parametersEntries;
unsigned short *resources;
unsigned short *pushBufferPointers;
int defaultValuesIndexCount;
const CgParameterDefaultValue *defaultValuesIndices;
int semanticCount;
const CgParameterSemantic *semanticIndices;
int defaultValueCount;
const float *defaultValues;
const char *stringTable;
unsigned int **constantPushBufferPointers;
//tmp
unsigned int *samplerValuesLocation;
void *memoryBlock;
_CGprogramGroup *programGroup;
int programIndexInGroup;
//runtime compilation / conversion
void *runtimeElf;
};
typedef struct _CGcontext
{
struct _CGcontext* next; // for global linked list of CGcontexts
CGcontext id; // numerical handle for this object
unsigned int programCount; // number of programs in the list
struct _CGprogram* programList; // head of singly linked list of programs
CGenum compileType; // compile manual, immediate or lazy (unused so far)
// default program, fake owner of the context parameters
_CGprogram defaultProgram;
//groups
CGprogramGroup groupList;
//"static" variable used to store the values of the last parameter for which getParameterValue has been called
double currentParameterValue[16];
char currentParameterName[128];
} _CGcontext;
// internal error handling
RGL_EXPORT void rglCgRaiseError( CGerror error );
// interface between object types
extern void rglCgProgramDestroyAll( _CGcontext* c );
extern void rglCgDestroyContextParam( CgRuntimeParameter* p );
RGL_EXPORT void rglCgProgramErase( _CGprogram* prog );
// default setters
void _cgRaiseInvalidParam( void *data, const void*v );
void _cgRaiseNotMatrixParam( void *data, const void*v );
void _cgIgnoreSetParam( void *dat, const void*v );
void _cgIgnoreParamIndex( void *dat, const void*v, const int index );
// cg helpers
// Is macros
#define CG_IS_CONTEXT(_ctx) rglIsName(&_CurrentContext->cgContextNameSpace, (unsigned int)_ctx)
#define CG_IS_PROGRAM(_program) rglIsName(&_CurrentContext->cgProgramNameSpace, (unsigned int)_program)
#define CG_IS_PARAMETER(_param) rglIsName(&_CurrentContext->cgParameterNameSpace, (unsigned int)(((unsigned int)_param)&CG_PARAMETERMASK))
//array indices
#define CG_PARAMETERSIZE 22 //22 bits == 4 millions parameters
#define CG_PARAMETERMASK ((1<<CG_PARAMETERSIZE)-1)
#define CG_GETINDEX(param) (int)((unsigned int)(param)>>CG_PARAMETERSIZE)
static inline bool isMatrix (CGtype type)
{
if (( type >= CG_FLOAT1x1 && type <= CG_FLOAT4x4 ) ||
( type >= CG_HALF1x1 && type <= CG_HALF4x4 ) ||
( type >= CG_INT1x1 && type <= CG_INT4x4 ) ||
( type >= CG_BOOL1x1 && type <= CG_BOOL4x4 ) ||
( type >= CG_FIXED1x1 && type <= CG_FIXED4x4 ))
return true;
return false;
}
static inline bool isSampler (CGtype type)
{
return ( type >= CG_SAMPLER1D && type <= CG_SAMPLERCUBE );
}
unsigned int rglCountFloatsInCgType( CGtype type );
unsigned int rglGetTypeRowCount( CGtype parameterType );
unsigned int rglGetTypeColCount( CGtype parameterType );
// the internal cg conversions
inline static CgRuntimeParameter* _cgGetParamPtr (CGparameter p)
{
return ( CgRuntimeParameter* )rglGetNamedValue( &_CurrentContext->cgParameterNameSpace, ( unsigned int )((( unsigned int )p )&CG_PARAMETERMASK ) );
}
inline static _CGprogram* _cgGetProgPtr( CGprogram p )
{
return ( _CGprogram* )rglGetNamedValue( &_CurrentContext->cgProgramNameSpace, (unsigned int)p );
}
inline static _CGcontext* _cgGetContextPtr( CGcontext c )
{
return ( _CGcontext* )rglGetNamedValue( &_CurrentContext->cgContextNameSpace, (unsigned int)c );
}
inline static CgRuntimeParameter* rglCgGLTestParameter( CGparameter param )
{
return _cgGetParamPtr( param );
}
CgRuntimeParameter* _cgGLTestArrayParameter( CGparameter paramIn, long offset, long nelements );
CgRuntimeParameter* _cgGLTestTextureParameter( CGparameter param );
static inline int rglGetSizeofSubArray( const unsigned short *dimensions, unsigned short count )
{
int res = 1;
for (int i = 0;i < count;i++)
res *= ( int )(*(dimensions++));
return res;
}
// platform API
CGprofile rglPlatformGetLatestProfile( CGGLenum profile_type );
int rglPlatformCopyProgram( _CGprogram* source, _CGprogram* destination );
void rglPlatformProgramErase (void *data);
int rglPlatformGenerateVertexProgram (void *data, const CgProgramHeader *programHeader, const void *ucode, const CgParameterTableHeader *parameterHeader, const char *stringTable, const float *defaultValues );
CGbool rglPlatformSupportsVertexProgram ( CGprofile p );
int rglPlatformGenerateFragmentProgram (void *data, const CgProgramHeader *programHeader, const void *ucode, const CgParameterTableHeader *parameterHeader, const char *stringTable, const float *defaultValues );
CGbool rglPlatformSupportsFragmentProgram ( CGprofile p );
// names API
static inline GLenum rglCgGetSamplerGLTypeFromCgType( CGtype type )
{
switch ( type )
{
case CG_SAMPLER1D:
case CG_SAMPLER2D:
case CG_SAMPLERRECT:
return GL_TEXTURE_2D;
case CG_SAMPLER3D:
return GL_TEXTURE_3D;
case CG_SAMPLERCUBE:
return GL_TEXTURE_CUBE_MAP;
default:
return 0;
}
}
struct rglNameSpace;
#define VERTEX_PROFILE_INDEX 0
#define FRAGMENT_PROFILE_INDEX 1
// -------------------------------------------
typedef void( * CgcontextHookFunction )( _CGcontext *context );
extern RGL_EXPORT CgcontextHookFunction _cgContextCreateHook;
extern RGL_EXPORT CgcontextHookFunction _cgContextDestroyHook;
typedef void( * CgparameterHookFunction )( CgRuntimeParameter *parameter );
extern RGL_EXPORT CgparameterHookFunction _cgParameterCreateHook;
extern RGL_EXPORT CgparameterHookFunction _cgParameterDestroyHook;
typedef void( * CgprogramHookFunction )( _CGprogram *program );
typedef void( * CgprogramCopyHookFunction )( _CGprogram *newprogram, _CGprogram *oldprogram );
extern RGL_EXPORT CgprogramHookFunction _cgProgramCreateHook;
extern RGL_EXPORT CgprogramHookFunction _cgProgramDestroyHook;
extern RGL_EXPORT CgprogramCopyHookFunction _cgProgramCopyHook;
typedef int (*cgRTCgcCompileHookFunction) (const char*, const char*, const char*, const char**, char**);
typedef void(*cgRTCgcFreeHookFunction) (char*);
extern RGL_EXPORT cgRTCgcCompileHookFunction _cgRTCgcCompileProgramHook;
extern RGL_EXPORT cgRTCgcFreeHookFunction _cgRTCgcFreeCompiledProgramHook;
//-----------------------------------------------
//inlined helper functions
static inline const CgParameterResource *rglGetParameterResource (const void *data, const CgParameterEntry *entry )
{
const _CGprogram *program = (const _CGprogram*)data;
return (CgParameterResource *)(program->parameterResources + entry->typeIndex);
}
static inline CGtype rglGetParameterCGtype (const void *data, const CgParameterEntry *entry)
{
const _CGprogram *program = (const _CGprogram*)data;
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 void *data, const CgParameterEntry *entry)
{
const _CGprogram *program = (const _CGprogram*)data;
return (CgParameterArray*)(program->parameterResources + entry->typeIndex);
}
static inline const CgParameterStructure *rglGetParameterStructure (const void *data, const CgParameterEntry *entry )
{
const _CGprogram *program = (const _CGprogram*)data;
return (CgParameterStructure*)(program->parameterResources + entry->typeIndex);
}
inline int rglGetProgramProfileIndex( CGprofile profile )
{
if ( profile == CG_PROFILE_SCE_FP_TYPEB || profile == CG_PROFILE_SCE_FP_TYPEC || profile == CG_PROFILE_SCE_FP_RSX )
return FRAGMENT_PROFILE_INDEX;
else if ( profile == CG_PROFILE_SCE_VP_TYPEB || profile == CG_PROFILE_SCE_VP_TYPEC || profile == CG_PROFILE_SCE_VP_RSX )
return VERTEX_PROFILE_INDEX;
else
return -1;
}
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,147 +0,0 @@
#ifndef _cg_internal_h
#define _cg_internal_h
#ifdef __cplusplus
extern "C" {
#endif
//Hardware shader settings
#define CGF_OUTPUTFROMH0 0x01
#define CGF_DEPTHREPLACE 0x02
#define CGF_PIXELKILL 0x04
//CgParameterEntry flags
//variability
#define CGPV_MASK 0x03
#define CGPV_VARYING 0x00
#define CGPV_UNIFORM 0x01
#define CGPV_CONSTANT 0x02
#define CGPV_MIXED 0x03
//direction
#define CGPD_MASK 0x0C
#define CGPD_IN 0x00
#define CGPD_OUT 0x04
#define CGPD_INOUT 0x08
//is_referenced
#define CGPF_REFERENCED 0x10
//is_shared
#define CGPF_SHARED 0x20
//is_global
#define CGPF_GLOBAL 0x40
//internal parameter
#define CGP_INTERNAL 0x80
//type
#define CGP_INTRINSIC 0x0000
#define CGP_STRUCTURE 0x100
#define CGP_ARRAY 0x200
#define CGP_TYPE_MASK (CGP_STRUCTURE + CGP_ARRAY)
//storage
#define CGP_UNROLLED 0x400
#define CGP_UNPACKED 0x800
#define CGP_CONTIGUOUS 0x1000
#define CGP_NORMALIZE 0x2000 // (attrib) if the usual cgGLSetParameterPointer should normalize the attrib
#define CGP_RTCREATED 0x4000 // indicates that the parameter was created at runtime
//static control flow boolean type
#define CGP_SCF_BOOL (CG_TYPE_START_ENUM + 1024)
//data types
typedef struct _CgParameterTableHeader
{
unsigned short entryCount;
unsigned short resourceTableOffset;
unsigned short defaultValueIndexTableOffset;
unsigned short defaultValueIndexCount;
unsigned short semanticIndexTableOffset;
unsigned short semanticIndexCount;
}
CgParameterTableHeader;
typedef struct _CgParameterEntry
{
unsigned int nameOffset;
unsigned short typeIndex;
unsigned short flags;
}
CgParameterEntry;
typedef struct _CgParameterArray
{
unsigned short arrayType;
unsigned short dimensionCount;
unsigned short dimensions[];
} CgParameterArray; //padded to 4 bytes
typedef struct _CgParameterStructure
{
unsigned short memberCount;
unsigned short reserved;
}
CgParameterStructure;
typedef struct _CgParameterResource
{
unsigned short type;
unsigned short resource;
}
CgParameterResource;
typedef struct _CgParameterSemantic
{
unsigned short entryIndex;
unsigned short reserved;
unsigned int semanticOffset;
}
CgParameterSemantic;
typedef struct _CgParameterDefaultValue
{
unsigned short entryIndex;
unsigned short defaultValueIndex;
}
CgParameterDefaultValue;
typedef struct CgProgramHeader
{
//28 bytes
unsigned short profile; // Vertex / Fragment
unsigned short compilerVersion;
unsigned int instructionCount;
unsigned int attributeInputMask;
union
{
struct
{
//16 bytes
unsigned int instructionSlot;
unsigned int registerCount;
unsigned int attributeOutputMask;
}
vertexProgram;
struct
{
//12 bytes
unsigned int partialTexType;
unsigned short texcoordInputMask;
unsigned short texcoord2d;
unsigned short texcoordCentroid;
unsigned char registerCount;
unsigned char flags; //combination of CGF_OUTPUTFROMH0,CGF_DEPTHREPLACE,CGF_PIXELKILL
}
fragmentProgram;
};
}
CgProgramHeader;
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,41 +0,0 @@
#ifndef CGPROGRAMGROUP_HEADER
#define CGPROGRAMGROUP_HEADER
#include "Cg/cgBinary.h"
typedef struct _CGnamedProgram
{
const char *name;
CGprogram program;
int refCount;
}
_CGnamedProgram;
typedef struct _CGprogramGroup
{
struct _CGprogramGroup *next;
CGcontext ctx;
unsigned int *constantTable;
unsigned int *stringTable;
unsigned int programCount;
_CGnamedProgram *programs;
int refCount; //total number of program refCounted
bool userCreated;
char *filedata;
char *name;
}
_CGprogramGroup;
/* Program groups */
typedef struct _CGprogramGroup *CGprogramGroup;
CGprogramGroup rglCgCreateProgramGroup( CGcontext ctx, const char *name, void *ptr, int size );
void rglCgDestroyProgramGroup( CGprogramGroup group );
int rglCgGetProgramCount( CGprogramGroup group );
CGprogram rglCgGetProgram( CGprogramGroup group, const char *name );
int rglCgGetProgramIndex( CGprogramGroup group, const char *name );
CGprogram rglCgGetProgramAtIndex( CGprogramGroup group, unsigned int index );
const char *rglCgGetProgramGroupName( CGprogramGroup group );
#endif

View File

@ -1,115 +0,0 @@
#if !defined(_H_CG_BINARY_H_)
#define _H_CG_BINARY_H_
#ifdef __cplusplus
extern "C" {
#endif
/*************************************************************************/
/*** CgBinaryGL binary data/file format ***/
/*************************************************************************/
#define CG_BINARY_FORMAT_REVISION 0x00000006
// we don't encode pointers in the binary file so cross compiling
// with differnt pointer sizes works.
typedef unsigned int CgBinaryOffset;
typedef CgBinaryOffset CgBinaryEmbeddedConstantOffset;
typedef CgBinaryOffset CgBinaryFloatOffset;
typedef CgBinaryOffset CgBinaryStringOffset;
typedef CgBinaryOffset CgBinaryParameterOffset;
// a few typedefs
typedef struct CgBinaryParameter CgBinaryParameter;
typedef struct CgBinaryEmbeddedConstant CgBinaryEmbeddedConstant;
typedef struct CgBinaryVertexProgram CgBinaryVertexProgram;
typedef struct CgBinaryFragmentProgram CgBinaryFragmentProgram;
typedef struct CgBinaryProgram CgBinaryProgram;
// fragment programs have their constants embedded in the microcode
struct CgBinaryEmbeddedConstant
{
unsigned int ucodeCount; // occurances
unsigned int ucodeOffset[1]; // offsets that need to be patched follow
};
// describe a binary program parameter (CgParameter is opaque)
struct CgBinaryParameter
{
CGtype type; // cgGetParameterType()
CGresource res; // cgGetParameterResource()
CGenum var; // cgGetParameterVariability()
int resIndex; // cgGetParameterResourceIndex()
CgBinaryStringOffset name; // cgGetParameterName()
CgBinaryFloatOffset defaultValue; // default constant value
CgBinaryEmbeddedConstantOffset embeddedConst; // embedded constant information
CgBinaryStringOffset semantic; // cgGetParameterSemantic()
CGenum direction; // cgGetParameterDirection()
int paramno; // 0..n: cgGetParameterIndex() -1: globals
CGbool isReferenced; // cgIsParameterReferenced()
CGbool isShared; // cgIsParameterShared()
};
// attributes needed for vshaders
struct CgBinaryVertexProgram
{
unsigned int instructionCount; // #instructions
unsigned int instructionSlot; // load address (indexed reads!)
unsigned int registerCount; // R registers count
unsigned int attributeInputMask; // attributes vs reads from
unsigned int attributeOutputMask; // attributes vs writes (uses SET_VERTEX_ATTRIB_OUTPUT_MASK bits)
};
typedef enum {
CgBinaryPTTNone = 0,
CgBinaryPTT2x16 = 1,
CgBinaryPTT1x32 = 2,
} CgBinaryPartialTexType;
// attributes needed for pshaders
struct CgBinaryFragmentProgram
{
unsigned int instructionCount; // #instructions
unsigned int attributeInputMask; // attributes fp reads (uses SET_VERTEX_ATTRIB_OUTPUT_MASK bits)
unsigned int partialTexType; // texid 0..15 use two bits each marking whether the texture format requires partial load: see CgBinaryPartialTexType
unsigned short texCoordsInputMask; // tex coords used by frag prog. (tex<n> is bit n)
unsigned short texCoords2D; // tex coords that are 2d (tex<n> is bit n)
unsigned short texCoordsCentroid; // tex coords that are centroid (tex<n> is bit n)
unsigned char registerCount; // R registers count
unsigned char outputFromH0; // final color from R0 or H0
unsigned char depthReplace; // fp generated z epth value
unsigned char pixelKill; // fp uses kill operations
};
// defines a binary program -- *all* address/offsets are relative to the begining of CgBinaryProgram
struct CgBinaryProgram
{
// vertex/pixel shader identification (BE/LE as well)
CGprofile profile;
// binary revision (used to verify binary and driver structs match)
unsigned int binaryFormatRevision;
// total size of this struct including profile and totalSize field!
unsigned int totalSize;
// parameter usually queried using cgGet[First/Next]LeafParameter
unsigned int parameterCount;
CgBinaryParameterOffset parameterArray;
// depending on profile points to a CgBinaryVertexProgram or CgBinaryFragmentProgram struct
CgBinaryOffset program;
// raw ucode data
unsigned int ucodeSize;
CgBinaryOffset ucode;
// variable length data follows
unsigned char data[1];
};
#ifdef __cplusplus
}
#endif
#endif // !_H_CG_BINARY_H_

View File

@ -1,51 +0,0 @@
#ifndef _BASE_H_
#define _BASE_H_
#include <stdlib.h>
#include <new>
namespace RGL
{
template<class T> class Vector
{
public:
T* array;
unsigned int capacity;
unsigned int increment;
unsigned int count;
void * operator new( size_t size ) { return malloc( size ); }
void * operator new( size_t /*size*/, void *p ) { return p; }
void operator delete( void * /*ptr*/, void * /*p*/ ) { }
Vector(): array( 0 ), count( 0 ), capacity( 0 ), increment( 4 ) {}
~Vector()
{
if (array)
{
for ( unsigned int i = 0;i < count;++i )
( array + i )->~T();
count = 0;
free(array);
}
array = 0;
}
inline void removeElement( const T &element )
{
for ( unsigned int i = count; i > 0; --i )
{
if ( array[i-1] == element )
{
unsigned int index = i - 1;
( array + index )->~T();
--count;
if ( count > index )
memmove( array + index, array + index + 1, ( count - index )*sizeof( T ) );
return;
}
}
}
};
}
#endif

View File

@ -1,93 +0,0 @@
#ifndef _TYPE_UTILS_H
#define _TYPE_UTILS_H
/* Following NV_half_float specification
* The half data type is a floating-point
* data type encoded in an unsigned scalar data type. If the unsigned scalar
* holding a half has a value of N, the corresponding floating point number
* is
* (-1)^S * 0.0, if E == 0 and M == 0,
* (-1)^S * 2^-14 * (M / 2^10), if E == 0 and M != 0,
* (-1)^S * 2^(E-15) * (1 + M/2^10), if 0 < E < 31,
* (-1)^S * INF, if E == 31 and M == 0, or
* NaN, if E == 31 and M != 0,
*
* where
*
* S = floor((N mod 65536) / 32768),
* E = floor((N mod 32768) / 1024), and
* M = N mod 1024.
*
* INF (Infinity) is a special representation indicating numerical overflow.
* NaN (Not a Number) is a special representation indicating the result of
* illegal arithmetic operations, such as division by zero. Note that all
* normal values, zero, and INF have an associated sign. -0.0 and +0.0
* should be considered equivalent for the purposes of comparisons. Note
* also that half is not a native type in most CPUs, so some special
* processing may be required to generate or interpret half data.
*
* That is SEEEEEMMMMMMMMMM
*/
typedef union
{
unsigned int i;
float f;
} rglIntAndFloat;
static const rglIntAndFloat rglNan = {i: 0x7fc00000U};
static const rglIntAndFloat rglInfinity = {i: 0x7f800000U};
#define RGL_NAN (rglNan.f)
#define RGL_INFINITY (rglInfinity.f)
static inline GLhalfARB rglFloatToHalf( float v )
{
rglIntAndFloat V = {f: v};
// extract float components
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; // NaN
else if ( E >= 15 ) return( S << 15 ) | 0x7c00; // Inf
else if ( E <= -14 ) return( S << 15 ) | (( 0x800000 + M ) >> ( -14 - E ) ); // Denorm or zero. Works for input denorms and zero
else return( S << 15 ) | ((( E + 15 )&0x1f ) << 10 ) | ( M >> 13 );
}
static inline float rglHalfToFloat( GLhalfARB v )
{
unsigned int S, E, M;
float f;
S = v >> 15;
E = ( v & 0x7C00 ) >> 10;
M = v & 0x03ff;
if ( E == 31 )
{
if ( M == 0 )
f = RGL_INFINITY;
else
f = RGL_NAN;
}
else if ( E == 0 )
{
if ( M == 0 )
f = 0.f;
else
f = M * 1.f / ( 1 << 24 );
}
else
f = ( 0x400 + M ) * 1.f / ( 1 << 25 ) * ( 1 << E );
return S ? -f : f;
}
//----------------------------------------
// Fixed Point Conversion Macros
// FixedPoint.c
//----------------------------------------
#define X2F(X) (((float)(X))* 1.f/65536.f)
#define F2X(A) ((int)((A)* 65536.f))
#endif // _TYPE_UTILS_H

View File

@ -1,811 +0,0 @@
#ifndef _RGL_TYPES_H
#define _RGL_TYPES_H
#include <stdlib.h>
#include <string.h>
#include "../export/PSGL/psgl.h"
#include "Types.h"
#include "Base.h"
#include <Cg/cg.h>
#define RGL_MAX_COLOR_ATTACHMENTS 4
#define RGL_MAX_TEXTURE_IMAGE_UNITS 16
#define RGL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 4
#define RGL_MAX_VERTEX_ATTRIBS 16
#define RGLGCM_BIG_ENDIAN
#define ENDIAN_32(X, F) ((F) ? endianSwapWord(X) : (X))
#define FRAGMENT_PROFILE_INDEX 1
#define RGLP_MAX_TEXTURE_SIZE 4096
#define RGLGCM_LINEAR_BUFFER_ALIGNMENT 128
#define RGLGCM_HOST_BUFFER_ALIGNMENT 128
#define RGLGCM_TRANSIENT_MEMORY_DEFAULT (32 << 20)
#define RGLGCM_PERSISTENT_MEMORY_DEFAULT (160 << 20)
#define RGLGCM_FIFO_SIZE_DEFAULT (256 * 1024)
#define RGLGCM_HOST_SIZE_DEFAULT (0)
#define RGLGCM_TRANSIENT_ENTRIES_DEFAULT 64
// There are 6 clock domains, each with a maximum of 4 experiments, plus 4 elapsed exp.
#define RGL_MAX_DPM_QUERIES (4 * 6 + 4)
// RSX semaphore allocation
// 64-191 events
// 192 fence implementation (independent of nv_glFence)
// 253 used in RGLGcmFifoUtils.h
#define RGLGCM_SEMA_NEVENTS 128
#define RGLGCM_SEMA_BASE 64 // libgcm uses 0-63
#define RGLGCM_SEMA_FENCE 192
// synchronization
// rglGcmSync enables GPU waiting by sending nv_glAcquireSemaphore to the
// GPU and returning a memory mapped pointer to the semaphore. The GPU
// will be released when 0 is written to the memory location.
//
// rglGcm{Inc,Test,Finish}FenceRef are intended to be drop-in replacements
// for the corresponding RGLGCM routines, using a semaphore instead of the
// fence mechanism (so IncFence uses the 3D class).
#define RGLGCM_MAX_COLOR_SURFACES 4
// allocation unit for buffer objects
// Each buffer object is allocated to a multiple of this block size. This
// must be at least 64 so that nv_glTransferDataVidToVid() can be used to
// copy buffer objects within video memory. This function performs a 2D
// blit, and there is a 64-byte minimum pitch constraint.
//
// Swizzled textures require 128-byte alignment, so this takes precedence.
#define RGL_BUFFER_OBJECT_BLOCK_SIZE 128
#define VERTEX_PROFILE_INDEX 0
// GCM can render to 4 color buffers at once.
#define RGLGCM_SETRENDERTARGET_MAXCOUNT 4
// max amount of semaphore we allocate space for
#define RGLGCM_MAX_USER_SEMAPHORES 256
#define RGLGCM_PAGE_SIZE 0x1000 // 4KB
#define RGLGCM_LM_MAX_TOTAL_QUERIES 800
#define RGLGCM_LM_MAX_ZPASS_REPORTS (RGLGCM_LM_MAX_TOTAL_QUERIES - 10)
#define RGLGCM_LM_MAX_USER_QUERIES (RGLGCM_LM_MAX_ZPASS_REPORTS)
// For main memory query PSGL is going to enable 5000 at any given time
// compared to the 800 currently for the Local memory queries
// However, if you really need more than 5k then change the line below
// and recompile [RSTENSON]
// Maximum value for RGLGCM_MM_MAX_TOTAL_QUERIES is 65,000
#define RGLGCM_MM_MAX_TOTAL_QUERIES 5000 // Should be plenty.
#define RGLGCM_MM_MAX_ZPASS_REPORTS (RGLGCM_MM_MAX_TOTAL_QUERIES - 10)
#define RGLGCM_MM_MAX_USER_QUERIES (RGLGCM_MM_MAX_ZPASS_REPORTS)
// For 2.50 PSGL will use reports in main memory by default
// To revert to reports in local memory comment out this define
#define RGLGCM_USE_MAIN_MEMORY_REPORTS
#ifdef RGLGCM_USE_MAIN_MEMORY_REPORTS
#define RGLGCM_MAX_USER_QUERIES RGLGCM_MM_MAX_USER_QUERIES
#else
#define RGLGCM_MAX_USER_QUERIES RGLGCM_LM_MAX_USER_QUERIES
#endif
#define RGLGCM_357C_NOTIFIERS_MAXCOUNT 11
enum
{
// dma contexts
RGLGCM_CHANNEL_DMA_SCRATCH_NOTIFIER,
RGLGCM_CONTEXT_DMA_MEMORY_FRAME_BUFFER,
RGLGCM_CONTEXT_DMA_TO_MEMORY_GET_REPORT,
RGLGCM_CONTEXT_DMA_MEMORY_HOST_BUFFER,
RGLGCM_CONTEXT_DMA_MEMORY_SEMAPHORE_RW,
RGLGCM_CONTEXT_DMA_MEMORY_SEMAPHORE_RO,
// classes
RGLGCM_CURIE_PRIMITIVE,
RGLGCM_MEM2MEM_HOST_TO_VIDEO,
RGLGCM_IMAGEFROMCPU,
RGLGCM_SCALEDIMAGE,
RGLGCM_CONTEXT_2D_SURFACE,
RGLGCM_CONTEXT_SWIZ_SURFACE,
RGLGCM_HANDLE_COUNT
};
// For quick float->int conversions
#define RGLGCM_F0_DOT_0 12582912.0f
// some other useful push buf defines/commands
#define RGLGCM_COUNT_SHIFT (18)
#define RGLGCM_SUBCHANNEL_SHIFT (13)
#define RGLGCM_METHOD_SHIFT (0)
#define DEFAULT_FIFO_BLOCK_SIZE (0x10000) // 64KB
#define FIFO_RESERVE_SIZE 8 // reserved words needed at the beginning of the fifo
#define BUFFER_HSYNC_NEGATIVE 0
#define BUFFER_HSYNC_POSITIVE 1
#define BUFFER_VSYNC_NEGATIVE 0
#define BUFFER_VSYNC_POSITIVE 1
// This is the format that the mode timing parameters are handed back
enum {
RGLGCM_SURFACE_SOURCE_TEMPORARY,
RGLGCM_SURFACE_SOURCE_DEVICE,
RGLGCM_SURFACE_SOURCE_TEXTURE,
RGLGCM_SURFACE_SOURCE_RENDERBUFFER,
RGLGCM_SURFACE_SOURCE_PBO,
};
enum {
RGLGCM_SURFACE_POOL_NONE,
RGLGCM_SURFACE_POOL_LINEAR,
};
#define RGLGCM_DEVICE_SYNC_FENCE 1
#define RGLGCM_DEVICE_SYNC_COND 2
// max attrib count
#define RGLGCM_ATTRIB_COUNT 16
// Names for each of the vertex attributes
#define RGLGCM_ATTRIB_POSITION 0
#define RGLGCM_ATTRIB_VERTEX_WEIGHT 1
#define RGLGCM_ATTRIB_NORMAL 2
#define RGLGCM_ATTRIB_COLOR 3
#define RGLGCM_ATTRIB_SECONDARY_C OLOR 4
#define RGLGCM_ATTRIB_FOG_COORD 5
#define RGLGCM_ATTRIB_PSIZE 6
#define RGLGCM_ATTRIB_UNUSED1 7
#define RGLGCM_ATTRIB_TEXCOORD0 8
#define RGLGCM_ATTRIB_TEXCOORD1 9
#define RGLGCM_ATTRIB_TEXCOORD2 10
#define RGLGCM_ATTRIB_TEXCOORD3 11
#define RGLGCM_ATTRIB_TEXCOORD4 12
#define RGLGCM_ATTRIB_TEXCOORD5 13
#define RGLGCM_ATTRIB_TEXCOORD6 14
#define RGLGCM_ATTRIB_TEXCOORD7 15
// Names for the vertex output components:
#define RGLGCM_ATTRIB_OUTPUT_HPOS 0
#define RGLGCM_ATTRIB_OUTPUT_COL0 1
#define RGLGCM_ATTRIB_OUTPUT_COL1 2
#define RGLGCM_ATTRIB_OUTPUT_BFC0 3
#define RGLGCM_ATTRIB_OUTPUT_BFC1 4
#define RGLGCM_ATTRIB_OUTPUT_FOGC 5
#define RGLGCM_ATTRIB_OUTPUT_PSIZ 6
#define RGLGCM_ATTRIB_OUTPUT_TEX0 7
#define RGLGCM_ATTRIB_OUTPUT_TEX1 8
#define RGLGCM_ATTRIB_OUTPUT_TEX2 9
#define RGLGCM_ATTRIB_OUTPUT_TEX3 10
#define RGLGCM_ATTRIB_OUTPUT_TEX4 11
#define RGLGCM_ATTRIB_OUTPUT_TEX5 12
#define RGLGCM_ATTRIB_OUTPUT_TEX6 13
#define RGLGCM_ATTRIB_OUTPUT_TEX7 14
// viewport adjusting
#define RGLGCM_SUBPIXEL_ADJUST (0.5/(1<<12))
#define RGLGCM_VIEWPORT_EPSILON 0.0f
#define RGLGCM_HAS_INVALIDATE_TILE
#define RGLGCM_TILED_BUFFER_ALIGNMENT 0x10000 // 64KB
#define RGLGCM_TILED_BUFFER_HEIGHT_ALIGNMENT 64
#define RGLGCM_MAX_TILED_REGIONS 15
typedef enum rglGcmEnum
{
// gleSetRenderTarget
RGLGCM_NONE = 0x0000,
// glDrawArrays, glDrawElements, glBegin
RGLGCM_POINTS = 0x0000,
RGLGCM_LINES = 0x0001,
RGLGCM_LINE_LOOP = 0x0002,
RGLGCM_LINE_STRIP = 0x0003,
RGLGCM_TRIANGLES = 0x0004,
RGLGCM_TRIANGLE_STRIP = 0x0005,
RGLGCM_TRIANGLE_FAN = 0x0006,
RGLGCM_QUADS = 0x0007,
RGLGCM_QUAD_STRIP = 0x0008,
RGLGCM_POLYGON = 0x0009,
// glClear
RGLGCM_DEPTH_BUFFER_BIT = 0x0100,
RGLGCM_STENCIL_BUFFER_BIT = 0x0400,
RGLGCM_COLOR_BUFFER_BIT = 0x4000,
// glBlendFunc, glStencilFunc
RGLGCM_ZERO = 0,
RGLGCM_ONE = 1,
RGLGCM_SRC_COLOR = 0x0300,
RGLGCM_ONE_MINUS_SRC_COLOR = 0x0301,
RGLGCM_SRC_ALPHA = 0x0302,
RGLGCM_ONE_MINUS_SRC_ALPHA = 0x0303,
RGLGCM_DST_ALPHA = 0x0304,
RGLGCM_ONE_MINUS_DST_ALPHA = 0x0305,
RGLGCM_DST_COLOR = 0x0306,
RGLGCM_ONE_MINUS_DST_COLOR = 0x0307,
RGLGCM_SRC_ALPHA_SATURATE = 0x0308,
// glAlphaFunc, glDepthFunc, glStencilFunc
RGLGCM_NEVER = 0x0200,
RGLGCM_LESS = 0x0201,
RGLGCM_EQUAL = 0x0202,
RGLGCM_LEQUAL = 0x0203,
RGLGCM_GREATER = 0x0204,
RGLGCM_NOTEQUAL = 0x0205,
RGLGCM_GEQUAL = 0x0206,
RGLGCM_ALWAYS = 0x0207,
// glLogicOp
RGLGCM_CLEAR = 0x1500,
RGLGCM_AND = 0x1501,
RGLGCM_AND_REVERSE = 0x1502,
RGLGCM_COPY = 0x1503,
RGLGCM_AND_INVERTED = 0x1504,
RGLGCM_NOOP = 0x1505,
RGLGCM_XOR = 0x1506,
RGLGCM_OR = 0x1507,
RGLGCM_NOR = 0x1508,
RGLGCM_EQUIV = 0x1509,
RGLGCM_INVERT = 0x150A,
RGLGCM_OR_REVERSE = 0x150B,
RGLGCM_COPY_INVERTED = 0x150C,
RGLGCM_OR_INVERTED = 0x150D,
RGLGCM_NAND = 0x150E,
RGLGCM_SET = 0x150F,
// BlendFunc
RGLGCM_CONSTANT_COLOR = 0x8001,
RGLGCM_ONE_MINUS_CONSTANT_COLOR = 0x8002,
RGLGCM_CONSTANT_ALPHA = 0x8003,
RGLGCM_ONE_MINUS_CONSTANT_ALPHA = 0x8004,
RGLGCM_BLEND_COLOR = 0x8005,
RGLGCM_FUNC_ADD = 0x8006,
RGLGCM_MIN = 0x8007,
RGLGCM_MAX = 0x8008,
RGLGCM_BLEND_EQUATION = 0x8009,
RGLGCM_FUNC_SUBTRACT = 0x800A,
RGLGCM_FUNC_REVERSE_SUBTRACT = 0x800B,
// glTexImage binary formats -- keep in sync with glTexImage tables!
RGLGCM_ALPHA8 = 0x803C,
RGLGCM_ALPHA16 = 0x803E,
RGLGCM_HILO8 = 0x885E,
RGLGCM_HILO16 = 0x86F8,
RGLGCM_ARGB8 = 0x6007, // does not exist in classic OpenGL
RGLGCM_BGRA8 = 0xff01, // does not exist in classic OpenGL
RGLGCM_RGBA8 = 0x8058,
RGLGCM_ABGR8 = 0xff02, // does not exist in classic OpenGL
RGLGCM_XBGR8 = 0xff03, // does not exist in classic OpenGL
RGLGCM_RGBX8 = 0xff07, // does not exist in classic OpenGL
RGLGCM_COMPRESSED_RGB_S3TC_DXT1 = 0x83F0,
RGLGCM_COMPRESSED_RGBA_S3TC_DXT1 = 0x83F1,
RGLGCM_COMPRESSED_RGBA_S3TC_DXT3 = 0x83F2,
RGLGCM_COMPRESSED_RGBA_S3TC_DXT5 = 0x83F3,
RGLGCM_DEPTH_COMPONENT16 = 0x81A5,
RGLGCM_DEPTH_COMPONENT24 = 0x81A6,
RGLGCM_FLOAT_R32 = 0x8885,
RGLGCM_RGB5_A1_SCE = 0x600C,
RGLGCM_RGB565_SCE = 0x600D,
// glEnable/glDisable
RGLGCM_BLEND = 0x0be0,
RGLGCM_COLOR_LOGIC_OP = 0x0bf2,
RGLGCM_DITHER = 0x0bd0,
// glVertexAttribPointer
RGLGCM_VERTEX_ATTRIB_ARRAY0 = 0x8650,
RGLGCM_VERTEX_ATTRIB_ARRAY1 = 0x8651,
RGLGCM_VERTEX_ATTRIB_ARRAY2 = 0x8652,
RGLGCM_VERTEX_ATTRIB_ARRAY3 = 0x8653,
RGLGCM_VERTEX_ATTRIB_ARRAY4 = 0x8654,
RGLGCM_VERTEX_ATTRIB_ARRAY5 = 0x8655,
RGLGCM_VERTEX_ATTRIB_ARRAY6 = 0x8656,
RGLGCM_VERTEX_ATTRIB_ARRAY7 = 0x8657,
RGLGCM_VERTEX_ATTRIB_ARRAY8 = 0x8658,
RGLGCM_VERTEX_ATTRIB_ARRAY9 = 0x8659,
RGLGCM_VERTEX_ATTRIB_ARRAY10 = 0x865a,
RGLGCM_VERTEX_ATTRIB_ARRAY11 = 0x865b,
RGLGCM_VERTEX_ATTRIB_ARRAY12 = 0x865c,
RGLGCM_VERTEX_ATTRIB_ARRAY13 = 0x865d,
RGLGCM_VERTEX_ATTRIB_ARRAY14 = 0x865e,
RGLGCM_VERTEX_ATTRIB_ARRAY15 = 0x865f,
// glTexImage
RGLGCM_TEXTURE_3D = 0x806F,
RGLGCM_TEXTURE_CUBE_MAP = 0x8513,
RGLGCM_TEXTURE_1D = 0x0DE0,
RGLGCM_TEXTURE_2D = 0x0DE1,
// glTexParameter/TextureMagFilter
RGLGCM_NEAREST = 0x2600,
RGLGCM_LINEAR = 0x2601,
// glTexParameter/TextureMinFilter
RGLGCM_NEAREST_MIPMAP_NEAREST = 0x2700,
RGLGCM_LINEAR_MIPMAP_NEAREST = 0x2701,
RGLGCM_NEAREST_MIPMAP_LINEAR = 0x2702,
RGLGCM_LINEAR_MIPMAP_LINEAR = 0x2703,
// glTexParameter/TextureWrapMode
RGLGCM_CLAMP = 0x2900,
RGLGCM_REPEAT = 0x2901,
RGLGCM_CLAMP_TO_EDGE = 0x812F,
RGLGCM_CLAMP_TO_BORDER = 0x812D,
RGLGCM_MIRRORED_REPEAT = 0x8370,
RGLGCM_MIRROR_CLAMP = 0x8742,
RGLGCM_MIRROR_CLAMP_TO_EDGE = 0x8743,
RGLGCM_MIRROR_CLAMP_TO_BORDER = 0x8912,
// glTexParameter/GammaRemap
RGLGCM_GAMMA_REMAP_RED_BIT = 0x0001,
RGLGCM_GAMMA_REMAP_GREEN_BIT = 0x0002,
RGLGCM_GAMMA_REMAP_BLUE_BIT = 0x0004,
RGLGCM_GAMMA_REMAP_ALPHA_BIT = 0x0008,
// glTexParameter
RGLGCM_TEXTURE_WRAP_S = 0x2802,
RGLGCM_TEXTURE_WRAP_T = 0x2803,
RGLGCM_TEXTURE_WRAP_R = 0x8072,
RGLGCM_TEXTURE_MIN_FILTER = 0x2801,
RGLGCM_TEXTURE_MAG_FILTER = 0x2800,
RGLGCM_TEXTURE_MAX_ANISOTROPY = 0x84FE,
RGLGCM_TEXTURE_COMPARE_FUNC = 0x884D,
RGLGCM_TEXTURE_MIN_LOD = 0x813A,
RGLGCM_TEXTURE_MAX_LOD = 0x813B,
RGLGCM_TEXTURE_LOD_BIAS = 0x8501,
RGLGCM_TEXTURE_BORDER_COLOR = 0x1004,
RGLGCM_TEXTURE_GAMMA_REMAP = 0xff30,
// ARB_vertex_program
RGLGCM_VERTEX_PROGRAM = 0x8620,
RGLGCM_FRAGMENT_PROGRAM = 0x8804,
// glVertexAttribPointer
RGLGCM_FLOAT = 0x1406,
RGLGCM_HALF_FLOAT = 0x140B,
RGLGCM_SHORT = 0x1402,
RGLGCM_UNSIGNED_BYTE = 0x1401,
RGLGCM_UNSIGNED_SHORT = 0x1403,
RGLGCM_UNSIGNED_INT = 0x1405,
RGLGCM_BYTE = 0x1400,
RGLGCM_INT = 0x1404,
// query support
RGLGCM_SAMPLES_PASSED = 0xff10,
// semaphore support
RGLGCM_SEMAPHORE_USING_GPU = 0xff20,
RGLGCM_SEMAPHORE_USING_CPU = 0xff21,
RGLGCM_SEMAPHORE_USING_GPU_NO_WRITE_FLUSH = 0xff22,
// depth clamp
RGLGCM_DEPTH_CLAMP = 0x864F,
// 11/11/10 bit 3-component attributes
RGLGCM_CMP = 0x6020,
} rglGcmEnum;
struct rglFramebufferAttachment
{
GLenum type; // renderbuffer or texture
GLuint name;
// only valid for texture attachment
GLenum textureTarget;
rglFramebufferAttachment(): type( GL_NONE ), name( 0 ), textureTarget( GL_NONE )
{};
};
// gleSetRenderTarget has enough arguments to define its own struct
typedef struct rglGcmRenderTargetEx rglGcmRenderTargetEx;
struct rglGcmRenderTargetEx
{
// color buffers
rglGcmEnum colorFormat;
GLuint colorBufferCount;
GLuint colorId[RGLGCM_SETRENDERTARGET_MAXCOUNT];
GLuint colorIdOffset[RGLGCM_SETRENDERTARGET_MAXCOUNT];
GLuint colorPitch[RGLGCM_SETRENDERTARGET_MAXCOUNT];
// (0,0) is in the lower left
GLboolean yInverted;
// window offset
GLuint xOffset;
GLuint yOffset;
// render dimensions
GLuint width;
GLuint height;
};
struct rglFramebuffer
{
rglFramebufferAttachment color[RGL_MAX_COLOR_ATTACHMENTS];
rglGcmRenderTargetEx rt;
GLboolean complete;
GLboolean needValidate;
};
#ifdef __cplusplus
extern "C" {
#endif
#define RGLBIT_GET(f,n) ((f) & (1<<(n)))
#define RGLBIT_TRUE(f,n) ((f) |= (1<<(n)))
#define RGLBIT_FALSE(f,n) ((f) &= ~(1<<(n)))
#define RGLBIT_ASSIGN(f,n,val) do { if(val) RGLBIT_TRUE(f,n); else RGLBIT_FALSE(f,n); } while(0)
typedef struct
{
GLfloat R, G, B, A;
} rglColorRGBAf;
typedef struct
{
int X, Y, XSize, YSize;
} rglViewPort;
// image location flags
// These are flag bits that indicate where the valid image data is. Data
// can be valid nowhere, on the host, on the GPU, or in both places.
enum {
RGL_IMAGE_DATASTATE_UNSET = 0x0, // not a flag, just a meaningful 0
RGL_IMAGE_DATASTATE_HOST = 0x1,
RGL_IMAGE_DATASTATE_GPU = 0x2
};
// Image data structure
typedef struct rglImage_
{
// isSet indicates whether a gl*TexImage* call has been made on that image,
// to know whether calling gl*TexSubImage* is valid or not.
GLboolean isSet;
GLenum internalFormat;
GLenum format;
GLenum type;
GLsizei width;
GLsizei height;
GLsizei depth;
GLsizei alignment;
// image storage
// For raster
// storage, the platform driver sets strides (in bytes) between
// lines and layers and the library takes care of the rest.
// These values are initially zero, but may be set by the platform
// rglPlatformChooseInternalStorage to specify custom storage
// (compressed, swizzled, etc.). They should be considered
// read-only except by the platform driver.
GLsizei storageSize; // minimum allocation
GLsizei xstride, ystride, zstride; // strides
GLuint xblk, yblk; // block storage size
char *data;
char *mallocData;
GLsizei mallocStorageSize;
GLenum dataState; // valid data location (see enum above)
} rglImage;
// Raster data structure
// This struct is used internally to define 3D raster data for writing
// to or reading from a rglImage. The GL-level interface for pixel/texel
// level operations always uses a raster, even though the underlying
// platform-specific storage may not be a raster (e.g. compressed
// blocks). The internal routines rglRasterToImage and rglImageToRaster
// convert between the two.
//
// A clean alternative would have been to use rglImage for everything and
// implement a single rglImageToImage copying function. However, given
// that one side will always be a raster, the implementation cost was
// not seen as worth the generality.
typedef struct
{
GLenum format;
GLenum type;
GLsizei width;
GLsizei height;
GLsizei depth;
GLsizei xstride;
GLsizei ystride;
GLsizei zstride;
void* data;
} rglRaster;
#define RGL_TEXTURE_REVALIDATE_LAYOUT 0x01
#define RGL_TEXTURE_REVALIDATE_IMAGES 0x02
#define RGL_TEXTURE_REVALIDATE_PARAMETERS 0x04
typedef struct rglBufferObject rglBufferObject;
// Texture data structure
typedef struct
{
GLuint revalidate;
GLuint target;
GLuint minFilter;
GLuint magFilter;
GLfloat minLod;
GLfloat maxLod;
GLuint maxLevel;
GLuint wrapS;
GLuint wrapT;
GLuint wrapR;
GLfloat lodBias;
GLfloat maxAnisotropy;
GLenum compareMode;
GLenum compareFunc;
GLuint gammaRemap;
GLenum usage;
rglColorRGBAf borderColor;
GLboolean vertexEnable;
GLboolean isRenderTarget;
// this is valid when the revalidate bits do not have any resource bit set.
// the validation of the resources update the bit.
GLboolean isComplete;
rglBufferObject *referenceBuffer;
intptr_t offset;
RGL::Vector<rglFramebuffer *> framebuffers;
GLuint imageCount;
rglImage* image;
void * platformTexture[]; // C99 flexible array member
} rglTexture;
typedef struct
{
GLboolean isSet;
void* platformFenceObject[];
} rglFenceObject;
// For now, we'll use a static array for lights
//
// Texture image unit data structure
typedef struct
{
GLuint bound2D;
rglTexture* default2D;
GLboolean enable2D;
// the current fragment program's target for this unit, if in use.
// this is invalid otherwise
GLenum fragmentTarget;
GLfloat lodBias;
rglTexture* currentTexture;
} rglTextureImageUnit;
enum
{
RGL_FRAMEBUFFER_ATTACHMENT_NONE,
RGL_FRAMEBUFFER_ATTACHMENT_RENDERBUFFER,
RGL_FRAMEBUFFER_ATTACHMENT_TEXTURE,
};
struct RGLdevice
{
PSGLdeviceParameters deviceParameters;
GLvoid* rasterDriver;
char platformDevice[]; // C99 flexible array member
};
typedef struct
{
// parameters to glDraw* calls
GLenum mode;
GLint firstVertex;
GLsizei vertexCount;
GLuint indexMin;
GLuint indexMax; // 0==glDrawElements; 0!=glDrawRangeElements
GLsizei indexCount;
// internal draw parameters
// client-side array transfer buffer params
GLuint xferTotalSize;
GLuint indexXferOffset;
GLuint indexXferSize;
GLuint attribXferTotalSize;
GLuint attribXferOffset[RGL_MAX_VERTEX_ATTRIBS];
GLuint attribXferSize[RGL_MAX_VERTEX_ATTRIBS];
} rglDrawParams;
// define mapping of vertex semantics to attributes
// These indices specify the aliasing of vertex attributes with
// conventional per-vertex parameters. This mapping is the same as
// specified in the NV_vertex_program extension.
#define RGL_ATTRIB_POSITION_INDEX 0
#define RGL_ATTRIB_WEIGHT_INDEX 1
#define RGL_ATTRIB_NORMAL_INDEX 2
#define RGL_ATTRIB_PRIMARY_COLOR_INDEX 3
#define RGL_ATTRIB_SECONDARY_COLOR_INDEX 4
#define RGL_ATTRIB_FOG_COORD_INDEX 5
#define RGL_ATTRIB_POINT_SIZE_INDEX 6
#define RGL_ATTRIB_BLEND_INDICES_INDEX 7
#define RGL_ATTRIB_TEX_COORD0_INDEX 8
#define RGL_ATTRIB_TEX_COORD1_INDEX 9
#define RGL_ATTRIB_TEX_COORD2_INDEX 10
#define RGL_ATTRIB_TEX_COORD3_INDEX 11
#define RGL_ATTRIB_TEX_COORD4_INDEX 12
#define RGL_ATTRIB_TEX_COORD5_INDEX 13
#define RGL_ATTRIB_TEX_COORD6_INDEX 14
#define RGL_ATTRIB_TEX_COORD7_INDEX 15
// per-attribute descriptor and data
typedef struct
{
// GL state
GLvoid* clientData; // client-side array pointer or VBO offset
GLuint clientSize; // number of components 1-4
GLenum clientType; // GL_SHORT, GL_INT, GL_FLOAT
GLsizei clientStride; // element-to-element distance [bytes]
GLuint arrayBuffer; // name of buffer object; 0==none (ie client-side)
GLfloat value[4]; // constant attribute value
GLuint frequency; // instancing divisor
GLboolean normalized;
} __attribute__((aligned (16))) rglAttribute;
// state for the entire set of vertex attributes, plus
// other AttribSet-encapsulated state.
// (this is the block of state applied en mass during glBindAttribSetSCE())
typedef struct
{
// Vertex attribute descriptors and data are stored in this array.
// The fixed function attributes are aliased to the array via the
// indices defined by _RGL_ATTRIB_*_INDEX.
rglAttribute attrib[RGL_MAX_VERTEX_ATTRIBS];
// bitfields corresponding to the attrib[] array elements:
unsigned int DirtyMask; // 1 == attribute has changed & needs updating
unsigned int EnabledMask; // 1 == attribute is enabled for drawing
unsigned int HasVBOMask; // 1 == attribute is in a VBO (ie server-side)
} __attribute__((aligned (16))) rglAttributeState;
struct rglBufferObject
{
GLuint refCount;
GLsizeiptr size;
GLboolean mapped;
GLenum internalFormat;
GLuint width;
GLuint height;
RGL::Vector<rglTexture *> textureReferences;
void *platformBufferObject[];
};
#define RGL_CONTEXT_RED_MASK 0x01
#define RGL_CONTEXT_GREEN_MASK 0x02
#define RGL_CONTEXT_BLUE_MASK 0x04
#define RGL_CONTEXT_ALPHA_MASK 0x08
#define RGL_CONTEXT_DEPTH_MASK 0x10
#define RGL_CONTEXT_COLOR_MASK 0x0F
enum
{
RGL_CONTEXT_ACTIVE_SURFACE_COLOR0,
RGL_CONTEXT_ACTIVE_SURFACE_COLOR1,
RGL_CONTEXT_ACTIVE_SURFACE_COLOR2,
RGL_CONTEXT_ACTIVE_SURFACE_COLOR3,
RGL_CONTEXT_ACTIVE_SURFACE_DEPTH,
RGL_CONTEXT_ACTIVE_SURFACE_STENCIL,
RGL_CONTEXT_ACTIVE_SURFACES
};
typedef struct rglNameSpace
{
void** data;
void** firstFree;
unsigned long capacity;
} rglNameSpace;
typedef void *( *rglTexNameSpaceCreateFunction )( void );
typedef void( *rglTexNameSpaceDestroyFunction )( void * );
typedef struct rglTexNameSpace
{
void** data;
GLuint capacity;
rglTexNameSpaceCreateFunction create;
rglTexNameSpaceDestroyFunction destroy;
} rglTexNameSpace;
struct RGLcontext
{
GLenum error;
rglViewPort ViewPort;
GLclampf DepthNear;
GLclampf DepthFar;
rglAttributeState defaultAttribs0; // a default rglAttributeState, for bind = 0
rglAttributeState *attribs; // ptr to current rglAttributeState
// Frame buffer-related fields
//
GLenum DrawBuffer, ReadBuffer;
GLboolean Blending; // enable for mrt color target 0
GLenum BlendEquationRGB;
GLenum BlendEquationAlpha;
GLenum BlendFactorSrcRGB;
GLenum BlendFactorDestRGB;
GLenum BlendFactorSrcAlpha;
GLenum BlendFactorDestAlpha;
rglColorRGBAf BlendColor;
GLboolean ColorLogicOp;
GLenum LogicOp;
GLboolean Dithering;
GLuint TexCoordReplaceMask;
rglTexNameSpace textureNameSpace;
GLuint ActiveTexture;
rglTextureImageUnit TextureImageUnits[RGL_MAX_TEXTURE_IMAGE_UNITS];
rglTextureImageUnit* CurrentImageUnit;
GLsizei packAlignment;
GLsizei unpackAlignment;
rglTexNameSpace bufferObjectNameSpace;
GLuint ArrayBuffer;
GLuint PixelUnpackBuffer;
GLuint TextureBuffer;
// framebuffer objects
GLuint framebuffer; // GL_FRAMEBUFFER_OES binding
rglTexNameSpace framebufferNameSpace;
GLboolean VertexProgram;
struct _CGprogram* BoundVertexProgram;
GLboolean FragmentProgram;
struct _CGprogram* BoundFragmentProgram;
unsigned int LastFPConstantModification;
GLboolean VSync;
GLboolean SkipFirstVSync;
GLuint needValidate;
GLboolean everAttached;
CGerror RGLcgLastError;
CGerrorCallbackFunc RGLcgErrorCallbackFunction;
// Cg containers
CGcontext RGLcgContextHead;
rglNameSpace cgContextNameSpace;
rglNameSpace cgProgramNameSpace;
rglNameSpace cgParameterNameSpace;
};
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,59 +0,0 @@
#ifndef _RGLUTILS_H_
#define _RGLUTILS_H_
#include "Types.h"
#include "../export/PSGL/export.h"
#ifdef __cplusplus
extern "C" {
#endif
#define RGL_LIKELY(COND) __builtin_expect((COND),1)
#define RGL_UNLIKELY(COND) __builtin_expect((COND),0)
#define MAX(A,B) ((A)>(B)?(A):(B))
#define MIN(A,B) ((A)<(B)?(A):(B))
#define _RGL_FLOAT_AS_UINT(x) ({union {float f; unsigned int i;} u; u.f=(x); u.i;})
#define rglClampf(value) (MAX( MIN((value), 1.f ), 0.f ))
#define endianSwapHalf(v) (((v) >> 8 & 0x00ff) | ((v) << 8 & 0xff00))
#define endianSwapWord(v) (((v) & 0xff ) << 24 | ((v) & 0xff00 ) << 8 | ((v) & 0xff0000 ) >> 8 | ((v) & 0xff000000 ) >> 24)
#define endianSwapWordByHalf(v) (((v) & 0xffff ) << 16 | (v) >> 16)
static inline int rglLog2( unsigned int i )
{
int l = 0;
while ( i )
{
++l;
i >>= 1;
}
return l -1;
}
#define rglIsPow2(i) (((i) & ((i) - 1 )) == 0)
// Pad argument x to the next multiple of argument pad.
#define rglPad(x, pad) (((x) + (pad) - 1 ) / (pad) * (pad))
// Pad pointer x to the next multiple of argument pad.
#define rglPadPtr(p, pad) ((char*)(((intptr_t)(p) + (pad) - 1 ) / (pad) * (pad)))
// names API
RGL_EXPORT unsigned int rglCreateName (void *data, void* object);
RGL_EXPORT unsigned int rglIsName( void *data, unsigned int name);
RGL_EXPORT void rglEraseName (void *data, unsigned int name);
#define rglGetNamedValue(x, name) (((struct rglNameSpace*)(x))->data[(name) - 1])
void rglTexNameSpaceResetNames(void *data);
GLboolean rglTexNameSpaceCreateNameLazy(void *data, GLuint name );
GLboolean rglTexNameSpaceIsName(void *data, GLuint name );
void rglTexNameSpaceDeleteNames(void *data, GLsizei n, const GLuint *names );
void rglTexNameSpaceReinit(void *saved, void *active);
#ifdef __cplusplus
}
#endif
#endif // _RGL_UTILS_H_

View File

@ -1,178 +0,0 @@
#ifndef _RGL_PRIVATE_H
#define _RGL_PRIVATE_H
#include "../export/PSGL/psgl.h"
#include "Types.h"
#include "Utils.h"
#ifndef OS_VERSION_NUMERIC
#define OS_VERSION_NUMERIC 0x160
#endif
#ifdef __cplusplus
extern "C" {
#endif
extern RGL_EXPORT RGLcontext* _CurrentContext;
extern RGLdevice* _CurrentDevice;
extern RGL_EXPORT char* rglVersion;
// only for internal purpose
#define GL_UNSIGNED_BYTE_4_4 0x4A00
#define GL_UNSIGNED_BYTE_4_4_REV 0x4A01
#define GL_UNSIGNED_BYTE_6_2 0x4A02
#define GL_UNSIGNED_BYTE_2_6_REV 0x4A03
#define GL_UNSIGNED_SHORT_12_4 0x4A04
#define GL_UNSIGNED_SHORT_4_12_REV 0x4A05
#define GL_UNSIGNED_BYTE_2_2_2_2 0x4A06
#define GL_UNSIGNED_BYTE_2_2_2_2_REV 0x4A07
#define GL_FLOAT_RGBA32 0x888B
typedef void( * RGLcontextHookFunction )( RGLcontext *context );
extern RGL_EXPORT RGLcontextHookFunction rglContextCreateHook;
extern RGL_EXPORT RGLcontextHookFunction rglContextDestroyHook;
extern RGLcontext* rglContextCreate(void);
extern void rglContextFree( RGLcontext* LContext );
extern void rglSetError( GLenum error );
void rglDetachContext( RGLdevice *device, RGLcontext* context );
void rglSetFlipHandler(void (*handler)(const GLuint head), RGLdevice *device);
void rglSetVBlankHandler(void (*handler)(const GLuint head), RGLdevice *device);
//----------------------------------------
// Texture.c
//----------------------------------------
extern int rglTextureInit( RGLcontext* context, GLuint name );
extern void rglTextureDelete( RGLcontext* context, GLuint name );
extern GLboolean rglTextureHasValidLevels( const rglTexture *texture, int levels, int width, int height, int depth, GLenum format, GLenum type, GLenum internalFormat );
extern rglTexture *rglGetCurrentTexture (const void *data, GLenum target);
void rglReallocateImages (void *data, GLint level, GLsizei dimension);
static inline rglTexture* rglGetTextureSafe (RGLcontext *LContext, GLuint name)
{
return rglTexNameSpaceIsName( &LContext->textureNameSpace, name ) ? ( rglTexture* )LContext->textureNameSpace.data[name] : NULL;
}
static inline rglFramebuffer *rglGetFramebuffer( RGLcontext *LContext, GLuint name );
static inline void rglTextureTouchFBOs (void *data)
{
rglTexture *texture = (rglTexture*)data;
RGLcontext *LContext = (RGLcontext*)_CurrentContext;
if (!LContext )
return; // may be called in psglDestroyContext
// check if bound to any framebuffer
GLuint fbCount = texture->framebuffers.count;
if ( fbCount > 0 )
{
rglFramebuffer *contextFramebuffer = LContext->framebuffer ? rglGetFramebuffer( LContext, LContext->framebuffer ) : NULL;
for ( GLuint i = 0;i < fbCount;++i )
{
rglFramebuffer* framebuffer = texture->framebuffers.array[i];
framebuffer->needValidate = GL_TRUE;
if (RGL_UNLIKELY( framebuffer == contextFramebuffer))
LContext->needValidate |= PSGL_VALIDATE_FRAMEBUFFER;
}
}
}
//----------------------------------------
// Image.c
//----------------------------------------
GLboolean rglIsType( GLenum type );
GLboolean rglIsFormat( GLenum format );
GLboolean rglIsValidPair( GLenum format, GLenum type );
void rglImageAllocCPUStorage (void *data);
void rglImageFreeCPUStorage (void *data);
extern int rglGetPixelSize( GLenum format, GLenum type );
//----------------------------------------
// FramebufferObject.c
//----------------------------------------
rglFramebuffer *rglCreateFramebuffer( void );
void rglDestroyFramebuffer (void *data);
static inline rglFramebuffer *rglGetFramebuffer( RGLcontext *LContext, GLuint name )
{
return ( rglFramebuffer * )LContext->framebufferNameSpace.data[name];
}
static inline rglFramebuffer *rglGetFramebufferSafe( RGLcontext *LContext, GLuint name )
{
return rglTexNameSpaceIsName( &LContext->framebufferNameSpace, name ) ? ( rglFramebuffer * )LContext->framebufferNameSpace.data[name] : NULL;
}
void rglFramebufferGetAttachmentTexture( RGLcontext* LContext, const rglFramebufferAttachment* attachment, rglTexture** texture, GLuint* face );
GLenum rglPlatformFramebufferCheckStatus (void *data);
void rglPlatformFramebufferGetParameteriv( GLenum pname, GLint* params );
//----------------------------------------
// VertexArray.c
//----------------------------------------
void rglVertexAttribPointerNV( GLuint index, GLint fsize, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* pointer );
void rglEnableVertexAttribArrayNV( GLuint index );
void rglDisableVertexAttribArrayNV( GLuint index );
//----------------------------------------
// Device/Device.c
//----------------------------------------
extern void rglDeviceInit (void *data);
extern void rglDeviceExit (void);
extern PSGLdeviceParameters * rglShadowDeviceParameters (void);
//----------------------------------------
// Device/.../PlatformDevice.c
//----------------------------------------
extern GLboolean rglPlatformDeviceInit (void *data);
extern void rglPlatformDeviceExit (void);
extern int rglPlatformCreateDevice (void *data);
extern void rglPlatformSwapBuffers (void *data);
extern const GLvoid* rglPlatformGetProcAddress (const char *funcName);
//----------------------------------------
// Raster/.../PlatformRaster.c
//----------------------------------------
void rglPlatformRasterDestroyResources (void);
GLboolean rglPlatformNeedsConversion (const rglAttributeState* as, GLuint index);
void rglInvalidateAttributes (void);
//----------------------------------------
// Raster/.../PlatformTexture.c
//----------------------------------------
extern void rglPlatformCreateTexture (void *data);
extern void rglPlatformDestroyTexture (void *data);
void rglPlatformValidateVertexTextures (void);
extern GLenum rglPlatformChooseInternalStorage (void *data, GLenum internalformat);
extern void rglPlatformCopyTexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height );
void rglPlatformGetImageData( GLenum target, GLint level, rglTexture *texture, rglImage *image );
//----------------------------------------
// Raster/.../PlatformFBops.c
//----------------------------------------
extern void rglPlatformReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, GLboolean flip, GLenum format, GLenum type, GLvoid *pixels );
extern GLboolean rglPlatformReadPBOPixels( GLint x, GLint y, GLsizei width, GLsizei height, GLboolean flip, GLenum format, GLenum type, GLvoid *pixels );
//----------------------------------------
// Raster/.../PlatformBuffer.c
//----------------------------------------
int rglPlatformBufferObjectSize (void);
GLboolean rglPlatformCreateBufferObject( rglBufferObject* bufferObject );
void rglPlatformDestroyBufferObject (void *data);
void rglPlatformBufferObjectSetData (void *buf_data, GLintptr offset, GLsizeiptr size, const GLvoid *data, GLboolean tryImmediateCopy );
char *rglPlatformBufferObjectMap (void *data, GLenum access );
GLboolean rglPlatformBufferObjectUnmap (void *data);
void rglPlatformGetBufferParameteriv( rglBufferObject *bufferObject, GLenum pname, int *params );
// this is shared in glBindTexture and cgGL code
RGL_EXPORT void rglBindTextureInternal (void *data, GLuint name, GLenum target);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,547 +0,0 @@
#ifndef __gl_h_
#define __gl_h_
#ifdef __cplusplus
extern "C"
{
#endif
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
** Software License B, Version 1.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
**
** http://oss.sgi.com/projects/FreeB
**
** Note that, as provided in the License, the Software is distributed on an
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
**
** Original Code. The Original Code is: OpenGL Sample Implementation,
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
** Copyright in any portions created by third parties is as indicated
** elsewhere herein. All Rights Reserved.
**
** Additional Notice Provisions: The application programming interfaces
** established by SGI in conjunction with the Original Code are The
** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
** Window System(R) (Version 1.3), released October 19, 1998. This software
** was created using the OpenGL(R) version 1.2.1 Sample Implementation
** published by SGI, but has not been independently verified as being
** compliant with the OpenGL(R) version 1.2.1 Specification.
*/
#ifdef RGL_EXPORT
#define GLAPI RGL_EXPORT
#endif
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SYMBIAN32__)
#define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
#endif
#ifndef APIENTRY
#define APIENTRY
#endif
#ifndef GLAPI
#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;
/* Internal convenience typedefs */
typedef void( *_GLfuncptr )();
/*************************************************************/
/* Extensions */
#define GL_OES_VERSION_1_0 1
#define GL_OES_read_format 1
#define GL_OES_compressed_paletted_texture 1
/* ClearBufferMask */
#define GL_DEPTH_BUFFER_BIT 0x00000100
#define GL_STENCIL_BUFFER_BIT 0x00000400
#define GL_COLOR_BUFFER_BIT 0x00004000
/* Boolean */
#define GL_FALSE 0
#define GL_TRUE 1
/* BeginMode */
#define GL_POINTS 0x0000
#define GL_LINES 0x0001
#define GL_LINE_LOOP 0x0002
#define GL_LINE_STRIP 0x0003
#define GL_TRIANGLES 0x0004
#define GL_TRIANGLE_STRIP 0x0005
#define GL_TRIANGLE_FAN 0x0006
/* AlphaFunction */
#define GL_NEVER 0x0200
#define GL_LESS 0x0201
#define GL_EQUAL 0x0202
#define GL_LEQUAL 0x0203
#define GL_GREATER 0x0204
#define GL_NOTEQUAL 0x0205
#define GL_GEQUAL 0x0206
#define GL_ALWAYS 0x0207
/* BlendingFactorDest */
#define GL_ZERO 0
#define GL_ONE 1
#define GL_SRC_COLOR 0x0300
#define GL_ONE_MINUS_SRC_COLOR 0x0301
#define GL_SRC_ALPHA 0x0302
#define GL_ONE_MINUS_SRC_ALPHA 0x0303
#define GL_DST_ALPHA 0x0304
#define GL_ONE_MINUS_DST_ALPHA 0x0305
/* BlendingFactorSrc */
/* GL_ZERO */
/* GL_ONE */
#define GL_DST_COLOR 0x0306
#define GL_ONE_MINUS_DST_COLOR 0x0307
#define GL_SRC_ALPHA_SATURATE 0x0308
/* GL_SRC_ALPHA */
/* GL_ONE_MINUS_SRC_ALPHA */
/* GL_DST_ALPHA */
/* GL_ONE_MINUS_DST_ALPHA */
/* ColorMaterialFace */
/* GL_FRONT_AND_BACK */
/* ColorMaterialParameter */
/* GL_AMBIENT_AND_DIFFUSE */
/* ColorPointerType */
/* GL_UNSIGNED_BYTE */
/* GL_FLOAT */
/* GL_FIXED */
/* CullFaceMode */
#define GL_FRONT 0x0404
#define GL_BACK 0x0405
#define GL_FRONT_AND_BACK 0x0408
/* DepthFunction */
/* GL_NEVER */
/* GL_LESS */
/* GL_EQUAL */
/* GL_LEQUAL */
/* GL_GREATER */
/* GL_NOTEQUAL */
/* GL_GEQUAL */
/* GL_ALWAYS */
/* EnableCap */
#define GL_FOG 0x0B60
#define GL_LIGHTING 0x0B50
#define GL_TEXTURE_2D 0x0DE1
#define GL_CULL_FACE 0x0B44
#define GL_BLEND 0x0BE2
#define GL_COLOR_LOGIC_OP 0x0BF2
#define GL_DITHER 0x0BD0
#define GL_STENCIL_TEST 0x0B90
#define GL_DEPTH_TEST 0x0B71
/* GL_LIGHT0 */
/* GL_LIGHT1 */
/* GL_LIGHT2 */
/* GL_LIGHT3 */
/* GL_LIGHT4 */
/* GL_LIGHT5 */
/* GL_LIGHT6 */
/* GL_LIGHT7 */
#define GL_POINT_SMOOTH 0x0B10
#define GL_LINE_SMOOTH 0x0B20
#define GL_SCISSOR_TEST 0x0C11
#define GL_COLOR_MATERIAL 0x0B57
#define GL_NORMALIZE 0x0BA1
#define GL_RESCALE_NORMAL 0x803A
#define GL_POLYGON_OFFSET_FILL 0x8037
#define GL_VERTEX_ARRAY 0x8074
#define GL_NORMAL_ARRAY 0x8075
#define GL_COLOR_ARRAY 0x8076
#define GL_TEXTURE_COORD_ARRAY 0x8078
#define GL_MULTISAMPLE 0x809D
#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
#define GL_SAMPLE_ALPHA_TO_ONE 0x809F
#define GL_SAMPLE_COVERAGE 0x80A0
/* ErrorCode */
#define GL_NO_ERROR 0
#define GL_INVALID_ENUM 0x0500
#define GL_INVALID_VALUE 0x0501
#define GL_INVALID_OPERATION 0x0502
#define GL_STACK_OVERFLOW 0x0503
#define GL_STACK_UNDERFLOW 0x0504
#define GL_OUT_OF_MEMORY 0x0505
/* FogMode */
/* GL_LINEAR */
#define GL_EXP 0x0800
#define GL_EXP2 0x0801
/* FogParameter */
#define GL_FOG_DENSITY 0x0B62
#define GL_FOG_START 0x0B63
#define GL_FOG_END 0x0B64
#define GL_FOG_MODE 0x0B65
#define GL_FOG_COLOR 0x0B66
/* FrontFaceDirection */
#define GL_CW 0x0900
#define GL_CCW 0x0901
/* GetPName */
#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12
#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22
#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A
#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B
#define GL_MAX_LIGHTS 0x0D31
#define GL_MAX_TEXTURE_SIZE 0x0D33
#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36
#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38
#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39
#define GL_MAX_VIEWPORT_DIMS 0x0D3A
#define GL_MAX_ELEMENTS_VERTICES 0x80E8
#define GL_MAX_ELEMENTS_INDICES 0x80E9
#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
#define GL_SUBPIXEL_BITS 0x0D50
/* HintMode */
#define GL_DONT_CARE 0x1100
#define GL_FASTEST 0x1101
#define GL_NICEST 0x1102
/* HintTarget */
#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50
#define GL_POINT_SMOOTH_HINT 0x0C51
#define GL_LINE_SMOOTH_HINT 0x0C52
#define GL_POLYGON_SMOOTH_HINT 0x0C53
#define GL_FOG_HINT 0x0C54
/* LightModelParameter */
#define GL_LIGHT_MODEL_AMBIENT 0x0B53
#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52
/* LightParameter */
#define GL_AMBIENT 0x1200
#define GL_DIFFUSE 0x1201
#define GL_SPECULAR 0x1202
#define GL_POSITION 0x1203
#define GL_SPOT_DIRECTION 0x1204
#define GL_SPOT_EXPONENT 0x1205
#define GL_SPOT_CUTOFF 0x1206
#define GL_CONSTANT_ATTENUATION 0x1207
#define GL_LINEAR_ATTENUATION 0x1208
#define GL_QUADRATIC_ATTENUATION 0x1209
/* DataType */
#define GL_BYTE 0x1400
#define GL_UNSIGNED_BYTE 0x1401
#define GL_SHORT 0x1402
#define GL_UNSIGNED_SHORT 0x1403
#define GL_FLOAT 0x1406
#define GL_FIXED 0x140C
/* LogicOp */
#define GL_CLEAR 0x1500
#define GL_AND 0x1501
#define GL_AND_REVERSE 0x1502
#define GL_COPY 0x1503
#define GL_AND_INVERTED 0x1504
#define GL_NOOP 0x1505
#define GL_XOR 0x1506
#define GL_OR 0x1507
#define GL_NOR 0x1508
#define GL_EQUIV 0x1509
#define GL_INVERT 0x150A
#define GL_OR_REVERSE 0x150B
#define GL_COPY_INVERTED 0x150C
#define GL_OR_INVERTED 0x150D
#define GL_NAND 0x150E
#define GL_SET 0x150F
/* MaterialFace */
/* GL_FRONT_AND_BACK */
/* MaterialParameter */
#define GL_EMISSION 0x1600
#define GL_SHININESS 0x1601
#define GL_AMBIENT_AND_DIFFUSE 0x1602
/* GL_AMBIENT */
/* GL_DIFFUSE */
/* GL_SPECULAR */
/* MatrixMode */
#define GL_MODELVIEW 0x1700
#define GL_PROJECTION 0x1701
#define GL_TEXTURE 0x1702
/* NormalPointerType */
/* GL_BYTE */
/* GL_SHORT */
/* GL_FLOAT */
/* GL_FIXED */
/* PixelFormat */
#define GL_ALPHA 0x1906
#define GL_RGB 0x1907
#define GL_RGBA 0x1908
/* PixelStoreParameter */
#define GL_UNPACK_ALIGNMENT 0x0CF5
#define GL_PACK_ALIGNMENT 0x0D05
/* PixelType */
/* GL_UNSIGNED_BYTE */
#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
#define GL_UNSIGNED_SHORT_5_6_5 0x8363
/* ShadingModel */
#define GL_FLAT 0x1D00
#define GL_SMOOTH 0x1D01
/* StencilFunction */
/* GL_NEVER */
/* GL_LESS */
/* GL_EQUAL */
/* GL_LEQUAL */
/* GL_GREATER */
/* GL_NOTEQUAL */
/* GL_GEQUAL */
/* GL_ALWAYS */
/* StencilOp */
/* GL_ZERO */
#define GL_KEEP 0x1E00
#define GL_REPLACE 0x1E01
#define GL_INCR 0x1E02
#define GL_DECR 0x1E03
/* GL_INVERT */
/* StringName */
#define GL_VENDOR 0x1F00
#define GL_RENDERER 0x1F01
#define GL_VERSION 0x1F02
#define GL_EXTENSIONS 0x1F03
/* TexCoordPointerType */
/* GL_SHORT */
/* GL_FLOAT */
/* GL_FIXED */
/* GL_BYTE */
/* TextureEnvMode */
#define GL_MODULATE 0x2100
#define GL_DECAL 0x2101
/* GL_BLEND */
#define GL_ADD 0x0104
/* GL_REPLACE */
/* TextureEnvParameter */
#define GL_TEXTURE_ENV_MODE 0x2200
#define GL_TEXTURE_ENV_COLOR 0x2201
/* TextureEnvTarget */
#define GL_TEXTURE_ENV 0x2300
/* TextureMagFilter */
#define GL_NEAREST 0x2600
#define GL_LINEAR 0x2601
/* TextureMinFilter */
/* GL_NEAREST */
/* GL_LINEAR */
#define GL_NEAREST_MIPMAP_NEAREST 0x2700
#define GL_LINEAR_MIPMAP_NEAREST 0x2701
#define GL_NEAREST_MIPMAP_LINEAR 0x2702
#define GL_LINEAR_MIPMAP_LINEAR 0x2703
/* TextureParameterName */
#define GL_TEXTURE_MAG_FILTER 0x2800
#define GL_TEXTURE_MIN_FILTER 0x2801
#define GL_TEXTURE_WRAP_S 0x2802
#define GL_TEXTURE_WRAP_T 0x2803
/* TextureTarget */
/* GL_TEXTURE_2D */
/* TextureUnit */
#define GL_TEXTURE0 0x84C0
#define GL_TEXTURE1 0x84C1
#define GL_TEXTURE2 0x84C2
#define GL_TEXTURE3 0x84C3
#define GL_TEXTURE4 0x84C4
#define GL_TEXTURE5 0x84C5
#define GL_TEXTURE6 0x84C6
#define GL_TEXTURE7 0x84C7
#define GL_TEXTURE8 0x84C8
#define GL_TEXTURE9 0x84C9
#define GL_TEXTURE10 0x84CA
#define GL_TEXTURE11 0x84CB
#define GL_TEXTURE12 0x84CC
#define GL_TEXTURE13 0x84CD
#define GL_TEXTURE14 0x84CE
#define GL_TEXTURE15 0x84CF
#define GL_TEXTURE16 0x84D0
#define GL_TEXTURE17 0x84D1
#define GL_TEXTURE18 0x84D2
#define GL_TEXTURE19 0x84D3
#define GL_TEXTURE20 0x84D4
#define GL_TEXTURE21 0x84D5
#define GL_TEXTURE22 0x84D6
#define GL_TEXTURE23 0x84D7
#define GL_TEXTURE24 0x84D8
#define GL_TEXTURE25 0x84D9
#define GL_TEXTURE26 0x84DA
#define GL_TEXTURE27 0x84DB
#define GL_TEXTURE28 0x84DC
#define GL_TEXTURE29 0x84DD
#define GL_TEXTURE30 0x84DE
#define GL_TEXTURE31 0x84DF
/* TextureWrapMode */
#define GL_REPEAT 0x2901
#define GL_CLAMP_TO_EDGE 0x812F
/* PixelInternalFormat */
#define GL_PALETTE4_RGB8_OES 0x8B90
#define GL_PALETTE4_RGBA8_OES 0x8B91
#define GL_PALETTE4_R5_G6_B5_OES 0x8B92
#define GL_PALETTE4_RGBA4_OES 0x8B93
#define GL_PALETTE4_RGB5_A1_OES 0x8B94
#define GL_PALETTE8_RGB8_OES 0x8B95
#define GL_PALETTE8_RGBA8_OES 0x8B96
#define GL_PALETTE8_R5_G6_B5_OES 0x8B97
#define GL_PALETTE8_RGBA4_OES 0x8B98
#define GL_PALETTE8_RGB5_A1_OES 0x8B99
/* VertexPointerType */
/* GL_SHORT */
/* GL_FLOAT */
/* GL_FIXED */
/* GL_BYTE */
/* LightName */
#define GL_LIGHT0 0x4000
#define GL_LIGHT1 0x4001
#define GL_LIGHT2 0x4002
#define GL_LIGHT3 0x4003
#define GL_LIGHT4 0x4004
#define GL_LIGHT5 0x4005
#define GL_LIGHT6 0x4006
#define GL_LIGHT7 0x4007
/*************************************************************/
GLAPI void APIENTRY glActiveTexture( GLenum texture );
GLAPI void APIENTRY glAlphaFunc( GLenum func, GLclampf ref );
GLAPI void APIENTRY glAlphaFuncx( GLenum func, GLclampx ref );
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 glClearDepthf( GLclampf depth );
GLAPI void APIENTRY glClearDepthx( GLclampx depth );
GLAPI void APIENTRY glClearStencil( GLint s );
GLAPI void APIENTRY glClientActiveTexture( GLenum texture );
GLAPI void APIENTRY glColor4x( GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha );
GLAPI void APIENTRY glColorMask( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha );
GLAPI void APIENTRY glColorPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer );
GLAPI void APIENTRY glCopyTexImage2D( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border );
GLAPI void APIENTRY glCopyTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height );
GLAPI void APIENTRY glCullFace( GLenum mode );
GLAPI void APIENTRY glDeleteTextures( GLsizei n, const GLuint *textures );
GLAPI void APIENTRY glDepthFunc( GLenum func );
GLAPI void APIENTRY glDepthMask( GLboolean flag );
GLAPI void APIENTRY glDepthRangef( GLclampf zNear, GLclampf zFar );
GLAPI void APIENTRY glDepthRangex( GLclampx zNear, GLclampx zFar );
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 glDrawElements( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices );
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 void APIENTRY glGetIntegerv( GLenum pname, GLint *params );
GLAPI const GLubyte * APIENTRY glGetString( GLenum name );
GLAPI void APIENTRY glHint( GLenum target, GLenum mode );
GLAPI void APIENTRY glLineWidth( GLfloat width );
GLAPI void APIENTRY glLineWidthx( GLfixed width );
GLAPI void APIENTRY glLoadIdentity( void );
GLAPI void APIENTRY glLogicOp( GLenum opcode );
GLAPI void APIENTRY glMaterialf( GLenum face, GLenum pname, GLfloat param );
GLAPI void APIENTRY glMaterialfv( GLenum face, GLenum pname, const GLfloat *params );
GLAPI void APIENTRY glMaterialx( GLenum face, GLenum pname, GLfixed param );
GLAPI void APIENTRY glMaterialxv( GLenum face, GLenum pname, const GLfixed *params );
GLAPI void APIENTRY glMatrixMode( GLenum mode );
GLAPI void APIENTRY glMultiTexCoord4f( GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q );
GLAPI void APIENTRY glMultiTexCoord4x( GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q );
GLAPI void APIENTRY glNormal3f( GLfloat nx, GLfloat ny, GLfloat nz );
GLAPI void APIENTRY glNormal3x( GLfixed nx, GLfixed ny, GLfixed nz );
GLAPI void APIENTRY glOrthof( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar );
GLAPI void APIENTRY glOrthox( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar );
GLAPI void APIENTRY glPixelStorei( GLenum pname, GLint param );
GLAPI void APIENTRY glPointSize( GLfloat size );
GLAPI void APIENTRY glPointSizex( GLfixed size );
GLAPI void APIENTRY glPolygonOffset( GLfloat factor, GLfloat units );
GLAPI void APIENTRY glPolygonOffsetx( GLfixed factor, GLfixed units );
GLAPI void APIENTRY glReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels );
GLAPI void APIENTRY glRotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z );
GLAPI void APIENTRY glRotatex( GLfixed angle, GLfixed x, GLfixed y, GLfixed z );
GLAPI void APIENTRY glSampleCoverage( GLclampf value, GLboolean invert );
GLAPI void APIENTRY glSampleCoveragex( GLclampx value, GLboolean invert );
GLAPI void APIENTRY glScalef( GLfloat x, GLfloat y, GLfloat z );
GLAPI void APIENTRY glScalex( GLfixed x, GLfixed y, GLfixed z );
GLAPI void APIENTRY glScissor( GLint x, GLint y, GLsizei width, GLsizei height );
GLAPI void APIENTRY glTexCoordPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer );
GLAPI void APIENTRY glTexEnvf( GLenum target, GLenum pname, GLfloat param );
GLAPI void APIENTRY glTexEnvfv( GLenum target, GLenum pname, const GLfloat *params );
GLAPI void APIENTRY glTexEnvx( GLenum target, GLenum pname, GLfixed param );
GLAPI void APIENTRY glTexEnvxv( GLenum target, GLenum pname, const GLfixed *params );
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 glTexParameterf( GLenum target, GLenum pname, GLfloat param );
GLAPI void APIENTRY glTexParameterx( GLenum target, GLenum pname, GLfixed param );
GLAPI void APIENTRY glTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, 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
}
#endif
#endif /* __gl_h_ */

View File

@ -1,422 +0,0 @@
#ifndef __gl_ext_h_
#define __gl_ext_h_
#ifndef _MSC_VER
#include <stdint.h>
#else
#include <stddef.h>
#endif
#ifdef __cplusplus
extern "C"
{
#endif
typedef intptr_t GLintptr;
typedef intptr_t GLsizeiptr;
typedef unsigned short GLhalfARB;
#define GL_QUADS 0x0007
#define GL_QUAD_STRIP 0x0008
#define GL_INT 0x1404
#define GL_UNSIGNED_INT 0x1405
/* Image types */
#define GL_UNSIGNED_BYTE_3_3_2 0x8032
#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362
#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364
#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365
#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366
#define GL_UNSIGNED_INT_8_8_8_8 0x8035
#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367
#define GL_UNSIGNED_INT_10_10_10_2 0x8036
#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
#define GL_UNSIGNED_INT_24_8_SCE 0x6008
#define GL_UNSIGNED_INT_8_24_REV_SCE 0x6009
#define GL_HALF_FLOAT_ARB 0x140B
/* Image internal formats */
#define GL_ALPHA4 0x803B
#define GL_ALPHA12 0x803D
#define GL_ALPHA16 0x803E
#define GL_R3_G3_B2 0x2A10
#define GL_RGB4 0x804F
#define GL_RGB5 0x8050
#define GL_RGB8 0x8051
#define GL_RGBA2 0x8055
#define GL_RGBA4 0x8056
#define GL_RGB5_A1 0x8057
#define GL_RGBA12 0x805A
#define GL_RGBA16 0x805B
#define GL_BGR 0x80E0
#define GL_BGRA 0x80E1
#define GL_ABGR 0x8000
#define GL_RED 0x1903
#define GL_GREEN 0x1904
#define GL_BLUE 0x1905
#define GL_ARGB_SCE 0x6007
#define GL_RGBA32F_ARB 0x8814
#define GL_RGB32F_ARB 0x8815
#define GL_ALPHA32F_ARB 0x8816
#define GL_RGBA16F_ARB 0x881A
#define GL_RGB16F_ARB 0x881B
#define GL_ALPHA16F_ARB 0x881C
#define GL_UNSIGNED_SHORT_8_8_SCE 0x600B
#define GL_UNSIGNED_SHORT_8_8_REV_SCE 0x600C
#define GL_UNSIGNED_INT_16_16_SCE 0x600D
#define GL_UNSIGNED_INT_16_16_REV_SCE 0x600E
#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2
#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3
/* TexGen */
#define GL_EYE_LINEAR 0x2400
#define GL_OBJECT_LINEAR 0x2401
#define GL_SPHERE_MAP 0x2402
#define GL_NORMAL_MAP 0x8511
#define GL_REFLECTION_MAP 0x8512
#define GL_S 0x2000
#define GL_T 0x2001
#define GL_R 0x2002
#define GL_Q 0x2003
#define GL_OBJECT_PLANE 0x2501
#define GL_EYE_PLANE 0x2502
#define GL_TEXTURE_GEN_MODE 0x2500
#define GL_TEXTURE_GEN_S 0x0C60
#define GL_TEXTURE_GEN_T 0x0C61
#define GL_TEXTURE_GEN_R 0x0C62
#define GL_TEXTURE_GEN_Q 0x0C63
/* Blending */
#define GL_CONSTANT_COLOR 0x8001
#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
#define GL_CONSTANT_ALPHA 0x8003
#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
#define GL_BLEND_EQUATION 0x8009
#define GL_FUNC_ADD 0x8006
#define GL_MIN 0x8007
#define GL_MAX 0x8008
#define GL_FUNC_SUBTRACT 0x800A
#define GL_FUNC_REVERSE_SUBTRACT 0x800B
/* Texture3D */
#define GL_TEXTURE_3D 0x806F
#define GL_TEXTURE_WRAP_R 0x8072
#define GL_MAX_3D_TEXTURE_SIZE 0x8073
/* CubeMap */
#define GL_TEXTURE_CUBE_MAP 0x8513
#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
/* PolygonMode */
#define GL_POINT 0x1B00
#define GL_LINE 0x1B01
#define GL_FILL 0x1B02
/* PolygonOffset for GL_LINE */
#define GL_POLYGON_OFFSET_LINE 0x2A02
/* Filter Control */
#define GL_TEXTURE_FILTER_CONTROL 0x8500
#define GL_TEXTURE_LOD_BIAS 0x8501
#define GL_TEXTURE_MIN_LOD 0x813A
#define GL_TEXTURE_MAX_LOD 0x813B
#define GL_TEXTURE_MAX_LEVEL 0x813D
#define GL_TEXTURE_BORDER_COLOR 0x1004
/* depth/shadow */
#define GL_NONE 0x0
#define GL_DEPTH_TEXTURE_MODE_ARB 0x884B
#define GL_TEXTURE_COMPARE_MODE_ARB 0x884C
#define GL_TEXTURE_COMPARE_FUNC_ARB 0x884D
#define GL_COMPARE_R_TO_TEXTURE_ARB 0x884E
/* Wrap modes */
#define GL_CLAMP 0x2900
#define GL_MIRRORED_REPEAT 0x8370
#define GL_MIRROR_CLAMP_EXT 0x8742
#define GL_MIRROR_CLAMP_TO_EDGE_EXT 0x8743
#define GL_MIRROR_CLAMP_TO_BORDER_EXT 0x8912
#define GL_CLAMP_TO_BORDER 0x812D
/* Fog Coordinate Source */
#define GL_FOG_COORDINATE_SOURCE 0x8450
#define GL_FOG_COORDINATE 0x8451
#define GL_FRAGMENT_DEPTH 0x8452
/* Fragment Control TXP */
#define GL_FRAGMENT_PROGRAM_CONTROL_CONTROLTXP_SCE 0x8453
/* Gets */
#define GL_MODELVIEW_MATRIX 0x0BA6
#define GL_TEXTURE_MATRIX 0x0BA8
#define GL_PROJECTION_MATRIX 0x0BA7
#define GL_MAX_TEXTURE_IMAGE_UNITS_ARB 0x8872
/* Surface targets */
#define GL_MAX_DRAW_BUFFERS_ATI 0x8824
#define GL_DRAW_BUFFER0_ATI 0x8825
#define GL_DRAW_BUFFER1_ATI 0x8826
#define GL_DRAW_BUFFER2_ATI 0x8827
#define GL_DRAW_BUFFER3_ATI 0x8828
#define GL_DRAW_BUFFER4_ATI 0x8829
#define GL_DRAW_BUFFER5_ATI 0x882A
#define GL_DRAW_BUFFER6_ATI 0x882B
#define GL_DRAW_BUFFER7_ATI 0x882C
#define GL_DRAW_BUFFER8_ATI 0x882D
#define GL_DRAW_BUFFER9_ATI 0x882E
#define GL_DRAW_BUFFER10_ATI 0x882F
#define GL_DRAW_BUFFER11_ATI 0x8830
#define GL_DRAW_BUFFER12_ATI 0x8831
#define GL_DRAW_BUFFER13_ATI 0x8832
#define GL_DRAW_BUFFER14_ATI 0x8833
#define GL_DRAW_BUFFER15_ATI 0x8834
#define GL_DRAW_DEPTH_SCE 0x6004
#define GL_DRAW_STENCIL_SCE 0x6005
#define GL_RGBA8 0x8058
#define GL_FLOAT_DEPTH_COMPONENT16_SCE 0x6000
#define GL_FLOAT_DEPTH_COMPONENT32_SCE 0x6001
#define GL_DEPTH24_STENCIL8_SCE 0x6002
#define GL_STENCIL8_SCE 0x6003
#define GL_DEPTH_COMPONENT 0x1902
#define GL_DEPTH_COMPONENT16 0x81A5
#define GL_DEPTH_COMPONENT24 0x81A6
#define GL_DEPTH_COMPONENT32 0x81A7
#define GL_STENCIL_INDEX 0x1901
#define GL_DRAWABLE_BIT_SCE 0x0001
#define GL_ALLOW_SCAN_OUT_BIT_SCE 0x0002
#define GL_TEXTURE_READ_BIT_SCE 0x0004
#define GL_ANTIALIASED_BIT_SCE 0x0008
/* VBO & PBO */
#define GL_ARRAY_BUFFER 0x8892
#define GL_ELEMENT_ARRAY_BUFFER 0x8893
#define GL_PIXEL_PACK_BUFFER_ARB 0x88EB
#define GL_PIXEL_UNPACK_BUFFER_ARB 0x88EC
#define GL_STREAM_DRAW 0x88E0
#define GL_STREAM_READ 0x88E1
#define GL_STREAM_COPY 0x88E2
#define GL_STATIC_DRAW 0x88E4
#define GL_STATIC_READ 0x88E5
#define GL_STATIC_COPY 0x88E6
#define GL_DYNAMIC_DRAW 0x88E8
#define GL_DYNAMIC_READ 0x88E9
#define GL_DYNAMIC_COPY 0x88EA
#define GL_SYSTEM_DRAW 0x6020
/* Map/Unmap */
#define GL_READ_ONLY 0x88B8
#define GL_WRITE_ONLY 0x88B9
#define GL_READ_WRITE 0x88BA
/* VSYNC */
#define GL_VSYNC_SCE 0x6006
#define GL_TEXTURE_GAMMA_REMAP_R_SCE 0x6010
#define GL_TEXTURE_GAMMA_REMAP_G_SCE 0x6011
#define GL_TEXTURE_GAMMA_REMAP_B_SCE 0x6012
#define GL_TEXTURE_GAMMA_REMAP_A_SCE 0x6013
#define GL_SHADER_SRGB_REMAP_SCE 0x6014
#define GL_DIVIDE_SCE 0x6015
#define GL_MODULO_SCE 0x6016
#define GL_TEXTURE_FROM_VERTEX_PROGRAM_SCE 0x6017
/* Primitive restart */
#define GL_PRIMITIVE_RESTART_NV 0x8558
/* Anisotropic filtering */
#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
/* Sync */
#define GL_ALL_COMPLETED_NV 0x84F2
#define GL_FENCE_STATUS_NV 0x84F3
#define GL_FENCE_CONDITION_NV 0x84F4
/* User clip planes */
#define GL_MAX_CLIP_PLANES 0x0D32
#define GL_CLIP_PLANE0 0x3000
#define GL_CLIP_PLANE1 0x3001
#define GL_CLIP_PLANE2 0x3002
#define GL_CLIP_PLANE3 0x3003
#define GL_CLIP_PLANE4 0x3004
#define GL_CLIP_PLANE5 0x3005
/* Point Sprites */
#define GL_POINT_SPRITE_OES 0x8861
#define GL_COORD_REPLACE_OES 0x8862
#define GL_VERTEX_PROGRAM_POINT_SIZE_ARB 0x8642
/* Framebuffer object */
#define GL_INVALID_FRAMEBUFFER_OPERATION_OES 0x0506
#define GL_MAX_RENDERBUFFER_SIZE_OES 0x84E8
#define GL_FRAMEBUFFER_BINDING_OES 0x8CA6
#define GL_RENDERBUFFER_BINDING_OES 0x8CA7
#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES 0x8CD0
#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES 0x8CD1
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES 0x8CD2
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES 0x8CD3
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4
#define GL_FRAMEBUFFER_COMPLETE_OES 0x8CD5
#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES 0x8CD6
#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES 0x8CD7
#define GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_OES 0x8CD8
#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES 0x8CD9
#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES 0x8CDA
#define GL_FRAMEBUFFER_UNSUPPORTED_OES 0x8CDD
#define GL_MAX_COLOR_ATTACHMENTS_OES 0x8CDF
#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0
#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1
#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2
#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3
#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4
#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5
#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6
#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7
#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8
#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9
#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA
#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB
#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC
#define GL_COLOR_ATTACHMENT13_EXT 0x8CED
#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE
#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF
#define GL_DEPTH_ATTACHMENT_OES 0x8D00
#define GL_STENCIL_ATTACHMENT_OES 0x8D20
#define GL_FRAMEBUFFER_OES 0x8D40
#define GL_RENDERBUFFER_OES 0x8D41
#define GL_RENDERBUFFER_WIDTH_OES 0x8D42
#define GL_RENDERBUFFER_HEIGHT_OES 0x8D43
#define GL_RENDERBUFFER_INTERNAL_FORMAT_OES 0x8D44
#define GL_STENCIL_INDEX_OES 0x8D45
#define GL_STENCIL_INDEX4_OES 0x8D47
#define GL_STENCIL_INDEX8_OES 0x8D48
/* multiple render target blend enable enums */
#define GL_BLEND_MRT0_SCE GL_COLOR_ATTACHMENT0_EXT
#define GL_BLEND_MRT1_SCE GL_COLOR_ATTACHMENT1_EXT
#define GL_BLEND_MRT2_SCE GL_COLOR_ATTACHMENT2_EXT
#define GL_BLEND_MRT3_SCE GL_COLOR_ATTACHMENT3_EXT
/* Texture usage hint */
#define GL_TEXTURE_ALLOCATION_HINT_SCE 0x6018
#define GL_TEXTURE_TILED_GPU_SCE 0x6019
#define GL_TEXTURE_LINEAR_GPU_SCE 0x601A
#define GL_TEXTURE_SWIZZLED_GPU_SCE 0x601B
#define GL_TEXTURE_LINEAR_SYSTEM_SCE 0x601C
#define GL_TEXTURE_SWIZZLED_SYSTEM_SCE 0x601D
/* Occlusion query & Conditional rendering */
#define GL_SAMPLES_PASSED_ARB 0x8914
#define GL_QUERY_COUNTER_BITS_ARB 0x8864
#define GL_CURRENT_QUERY_ARB 0x8865
#define GL_QUERY_RESULT_ARB 0x8866
#define GL_QUERY_RESULT_AVAILABLE_ARB 0x8867
/* Two-sided stencil, Stencil wrap */
#define GL_STENCIL_TEST_TWO_SIDE_EXT 0x8910
#define GL_INCR_WRAP 0x8507
#define GL_DECR_WRAP 0x8508
/* depth clamp */
#define GL_DEPTH_CLAMP_NV 0x864F
/* 32-bit 3-component attributes (11/11/10) */
#define GL_FIXED_11_11_10_SCE 0x6020
/* Anti-aliasing */
#define GL_REDUCE_DST_COLOR_SCE 0x6021
#define GL_TEXTURE_MULTISAMPLING_HINT_SCE 0x6022
#define GL_FRAMEBUFFER_MULTISAMPLING_MODE_SCE 0x6023
#define GL_MULTISAMPLING_NONE_SCE 0x6030
#define GL_MULTISAMPLING_2X_DIAGONAL_CENTERED_SCE 0x6031
#define GL_MULTISAMPLING_4X_SQUARE_CENTERED_SCE 0x6032
#define GL_MULTISAMPLING_4X_SQUARE_ROTATED_SCE 0x6033
/* Texture reference buffer */
#define GL_TEXTURE_REFERENCE_BUFFER_SCE 0x6040
#define GL_BUFFER_SIZE 0x8764
#define GL_BUFFER_PITCH_SCE 0x6041
/******************************************************************************/
GLAPI void APIENTRY glBlendEquation( GLenum mode );
GLAPI void APIENTRY glBlendEquationSeparate( GLenum modeRGB, GLenum modeAlpha );
GLAPI void APIENTRY glBlendFuncSeparate( GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha );
GLAPI void APIENTRY glBlendColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha );
GLAPI void APIENTRY glNormal3fv( const GLfloat* v );
GLAPI void APIENTRY glGetBooleanv( GLenum pname, GLboolean* params );
GLAPI void APIENTRY glGetFloatv( GLenum pname, GLfloat* params );
GLAPI void APIENTRY glTexParameterfv( GLenum target, GLenum pname, const GLfloat* params );
GLAPI void APIENTRY glTexParameteri( GLenum target, GLenum pname, GLint param );
GLAPI void APIENTRY glTexParameteriv( GLenum target, GLenum pname, const GLint* params );
GLAPI void APIENTRY glTexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels );
/* VBO & PBO */
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 glGetBufferParameteriv( GLenum target, GLenum pname, GLint *params );
/* VBO & PBO map/unmap */
GLAPI GLvoid* APIENTRY glMapBuffer( GLenum target, GLenum access );
GLAPI GLboolean APIENTRY glUnmapBuffer( GLenum target );
/* Sync */
GLAPI void APIENTRY glDeleteFencesNV( GLsizei n, const GLuint *fences );
GLAPI void APIENTRY glGenFencesNV( GLsizei n, GLuint *fences );
GLAPI GLboolean APIENTRY glIsFenceNV( GLuint fence );
GLAPI GLboolean APIENTRY glTestFenceNV( GLuint fence );
GLAPI void APIENTRY glGetFenceivNV( GLuint fence, GLenum pname, GLint *params );
GLAPI void APIENTRY glFinishFenceNV( GLuint fence );
GLAPI void APIENTRY glSetFenceNV( GLuint fence, GLenum condition );
/* Framebuffer object */
GLAPI GLboolean APIENTRY glIsRenderbufferOES( GLuint );
GLAPI void APIENTRY glBindRenderbufferOES( GLenum, GLuint );
GLAPI void APIENTRY glDeleteRenderbuffersOES( GLsizei, const GLuint * );
GLAPI void APIENTRY glGenRenderbuffersOES( GLsizei, GLuint * );
GLAPI void APIENTRY glRenderbufferStorageOES( GLenum, GLenum, GLsizei, GLsizei );
GLAPI void APIENTRY glGetRenderbufferParameterivOES( GLenum, GLenum, GLint * );
GLAPI GLboolean APIENTRY glIsFramebufferOES( GLuint );
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 glFramebufferRenderbufferOES( GLenum, GLenum, GLenum, GLuint );
GLAPI void APIENTRY glGetFramebufferAttachmentParameterivOES( GLenum, GLenum, GLenum, GLint * );
GLAPI void APIENTRY glGenerateMipmapOES( GLenum );
GLAPI void APIENTRY glGenerateMipmap( GLenum target);
/* Texture Reference */
GLAPI void APIENTRY glTextureReferenceSCE( GLenum target, GLuint levels, GLuint baseWidth, GLuint baseHeight, GLuint baseDepth, GLenum internalFormat, GLuint pitch, GLintptr offset );
GLAPI GLvoid* APIENTRY glMapBufferTextureReferenceRA( GLenum target, GLenum access );
GLAPI GLboolean APIENTRY glUnmapBufferTextureReferenceRA( GLenum target );
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,7 +0,0 @@
#ifndef _RGL_EXPORT_DEFINE_H
#define _RGL_EXPORT_DEFINE_H
#define PSGL_EXPORT
#define RGL_EXPORT
#endif

View File

@ -1,320 +0,0 @@
#ifndef _RGL_EXPORT_H
#define _RGL_EXPORT_H
#include <stdlib.h>
#include "export.h"
#include <GLES/gl.h>
#include <GLES/glext.h>
#include <Cg/cg.h>
#include <Cg/cgGL.h>
#include <cell/cgb/cgb_struct.h>
#include <cell/resc.h>
#include <sdk_version.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct PSGLdevice PSGLdevice;
typedef struct PSGLcontext PSGLcontext;
typedef enum PSGLtvStandard
{
PSGL_TV_STANDARD_NONE,
PSGL_TV_STANDARD_NTSC_M,
PSGL_TV_STANDARD_NTSC_J,
PSGL_TV_STANDARD_PAL_M,
PSGL_TV_STANDARD_PAL_B,
PSGL_TV_STANDARD_PAL_D,
PSGL_TV_STANDARD_PAL_G,
PSGL_TV_STANDARD_PAL_H,
PSGL_TV_STANDARD_PAL_I,
PSGL_TV_STANDARD_PAL_N,
PSGL_TV_STANDARD_PAL_NC,
PSGL_TV_STANDARD_HD480I,
PSGL_TV_STANDARD_HD480P,
PSGL_TV_STANDARD_HD576I,
PSGL_TV_STANDARD_HD576P,
PSGL_TV_STANDARD_HD720P,
PSGL_TV_STANDARD_HD1080I,
PSGL_TV_STANDARD_HD1080P,
PSGL_TV_STANDARD_1280x720_ON_VESA_1280x768 = 128,
PSGL_TV_STANDARD_1280x720_ON_VESA_1280x1024,
PSGL_TV_STANDARD_1920x1080_ON_VESA_1920x1200,
} PSGLtvStandard;
#define RGL_TV_STANDARD_NONE (PSGL_TV_STANDARD_NONE)
#define RGL_TV_STANDARD_NTSC_M 1
#define RGL_TV_STANDARD_NTSC_J 2
#define RGL_TV_STANDARD_PAL_M 3
#define RGL_TV_STANDARD_PAL_B 4
#define RGL_TV_STANDARD_PAL_D 5
#define RGL_TV_STANDARD_PAL_G 6
#define RGL_TV_STANDARD_PAL_H 7
#define RGL_TV_STANDARD_PAL_I 8
#define RGL_TV_STANDARD_PAL_N 9
#define RGL_TV_STANDARD_PAL_NC 10
#define RGL_TV_STANDARD_HD480I 11
#define RGL_TV_STANDARD_HD480P 12
#define RGL_TV_STANDARD_HD576I 13
#define RGL_TV_STANDARD_HD576P 14
#define RGL_TV_STANDARD_HD720P 15
#define RGL_TV_STANDARD_HD1080I 16
#define RGL_TV_STANDARD_HD1080P 17
#define RGL_TV_STANDARD_1280x720_ON_VESA_1280x768 128
#define RGL_TV_STANDARD_1280x720_ON_VESA_1280x1024 129
#define RGL_TV_STANDARD_1920x1080_ON_VESA_1920x1200 130
typedef enum PSGLbufferingMode
{
PSGL_BUFFERING_MODE_SINGLE = 1,
PSGL_BUFFERING_MODE_DOUBLE = 2,
PSGL_BUFFERING_MODE_TRIPLE = 3,
} PSGLbufferingMode;
/* spoof as PSGL */
#define RGL_BUFFERING_MODE_SINGLE (PSGL_BUFFERING_MODE_SINGLE)
#define RGL_BUFFERING_MODE_DOUBLE (PSGL_BUFFERING_MODE_DOUBLE)
#define RGL_BUFFERING_MODE_TRIPLE (PSGL_BUFFERING_MODE_TRIPLE)
typedef enum PSGLdeviceConnector
{
PSGL_DEVICE_CONNECTOR_NONE,
PSGL_DEVICE_CONNECTOR_VGA,
PSGL_DEVICE_CONNECTOR_DVI,
PSGL_DEVICE_CONNECTOR_HDMI,
PSGL_DEVICE_CONNECTOR_COMPOSITE,
PSGL_DEVICE_CONNECTOR_SVIDEO,
PSGL_DEVICE_CONNECTOR_COMPONENT,
} PSGLdeviceConnector;
#define RGL_DEVICE_CONNECTOR_NONE (PSGL_DEVICE_CONNECTOR_NONE)
#define RGL_DEVICE_CONNECTOR_VGA 1
#define RGL_DEVICE_CONNECTOR_DVI 2
#define RGL_DEVICE_CONNECTOR_HDMI 3
#define RGL_DEVICE_CONNECTOR_COMPOSITE 4
#define RGL_DEVICE_CONNECTOR_SVIDEO 5
#define RGL_DEVICE_CONNECTOR_COMPONENT 6
typedef enum RescRatioMode
{
RESC_RATIO_MODE_FULLSCREEN,
RESC_RATIO_MODE_LETTERBOX, // default
RESC_RATIO_MODE_PANSCAN,
} RescRatioMode;
typedef enum RescPalTemporalMode
{
RESC_PAL_TEMPORAL_MODE_50_NONE, // default - no conversion
RESC_PAL_TEMPORAL_MODE_60_DROP,
RESC_PAL_TEMPORAL_MODE_60_INTERPOLATE,
RESC_PAL_TEMPORAL_MODE_60_INTERPOLATE_30_DROP,
RESC_PAL_TEMPORAL_MODE_60_INTERPOLATE_DROP_FLEXIBLE,
} RescPalTemporalMode;
typedef enum RescInterlaceMode
{
RESC_INTERLACE_MODE_NORMAL_BILINEAR,
RESC_INTERLACE_MODE_INTERLACE_FILTER,
} RescInterlaceMode;
#define PSGL_DEVICE_PARAMETERS_COLOR_FORMAT 0x0001
#define PSGL_DEVICE_PARAMETERS_DEPTH_FORMAT 0x0002
#define PSGL_DEVICE_PARAMETERS_MULTISAMPLING_MODE 0x0004
#define PSGL_DEVICE_PARAMETERS_TV_STANDARD 0x0008
#define PSGL_DEVICE_PARAMETERS_CONNECTOR 0x0010
#define PSGL_DEVICE_PARAMETERS_BUFFERING_MODE 0x0020
#define PSGL_DEVICE_PARAMETERS_WIDTH_HEIGHT 0x0040
#define PSGL_DEVICE_PARAMETERS_RESC_RENDER_WIDTH_HEIGHT 0x0080
#define PSGL_DEVICE_PARAMETERS_RESC_RATIO_MODE 0x0100
#define PSGL_DEVICE_PARAMETERS_RESC_PAL_TEMPORAL_MODE 0x0200
#define PSGL_DEVICE_PARAMETERS_RESC_INTERLACE_MODE 0x0400
#define PSGL_DEVICE_PARAMETERS_RESC_ADJUST_ASPECT_RATIO 0x0800
/* spoof as PSGL */
#define RGL_DEVICE_PARAMETERS_COLOR_FORMAT 0x0001
#define RGL_DEVICE_PARAMETERS_DEPTH_FORMAT 0x0002
#define RGL_DEVICE_PARAMETERS_MULTISAMPLING_MODE 0x0004
#define RGL_DEVICE_PARAMETERS_TV_STANDARD 0x0008
#define RGL_DEVICE_PARAMETERS_CONNECTOR 0x0010
#define RGL_DEVICE_PARAMETERS_BUFFERING_MODE 0x0020
#define RGL_DEVICE_PARAMETERS_WIDTH_HEIGHT 0x0040
#define RGL_DEVICE_PARAMETERS_RESC_RENDER_WIDTH_HEIGHT 0x0080
#define RGL_DEVICE_PARAMETERS_RESC_RATIO_MODE 0x0100
#define RGL_DEVICE_PARAMETERS_RESC_PAL_TEMPORAL_MODE 0x0200
#define RGL_DEVICE_PARAMETERS_RESC_INTERLACE_MODE 0x0400
#define RGL_DEVICE_PARAMETERS_RESC_ADJUST_ASPECT_RATIO 0x0800
// mask for validation
#define PSGL_VALIDATE_NONE 0x00000000
#define PSGL_VALIDATE_FRAMEBUFFER 0x00000001
#define PSGL_VALIDATE_TEXTURES_USED 0x00000002
#define PSGL_VALIDATE_VERTEX_PROGRAM 0x00000004
#define PSGL_VALIDATE_VERTEX_CONSTANTS 0x00000008
#define PSGL_VALIDATE_VERTEX_TEXTURES_USED 0x00000010
#define PSGL_VALIDATE_FFX_VERTEX_PROGRAM 0x00000020
#define PSGL_VALIDATE_FRAGMENT_PROGRAM 0x00000040
#define PSGL_VALIDATE_FFX_FRAGMENT_PROGRAM 0x00000080
#define PSGL_VALIDATE_FRAGMENT_SHARED_CONSTANTS 0x00000100
#define PSGL_VALIDATE_VIEWPORT 0x00000200
#define PSGL_VALIDATE_DEPTH_TEST 0x00000800
#define PSGL_VALIDATE_WRITE_MASK 0x00001000
#define PSGL_VALIDATE_STENCIL_TEST 0x00002000
#define PSGL_VALIDATE_STENCIL_OP_AND_MASK 0x00004000
#define PSGL_VALIDATE_SCISSOR_BOX 0x00008000
#define PSGL_VALIDATE_FACE_CULL 0x00010000
#define PSGL_VALIDATE_BLENDING 0x00020000
#define PSGL_VALIDATE_POINT_RASTER 0x00040000
#define PSGL_VALIDATE_LINE_RASTER 0x00080000
#define PSGL_VALIDATE_POLYGON_OFFSET 0x00100000
#define PSGL_VALIDATE_SHADE_MODEL 0x00200000
#define PSGL_VALIDATE_LOGIC_OP 0x00400000
#define PSGL_VALIDATE_MULTISAMPLING 0x00800000
#define PSGL_VALIDATE_POLYGON_MODE 0x01000000
#define PSGL_VALIDATE_PRIMITIVE_RESTART 0x02000000
#define PSGL_VALIDATE_CLIP_PLANES 0x04000000
#define PSGL_VALIDATE_SHADER_SRGB_REMAP 0x08000000
#define PSGL_VALIDATE_POINT_SPRITE 0x10000000
#define PSGL_VALIDATE_TWO_SIDE_COLOR 0x20000000
#define PSGL_VALIDATE_ALL 0x3FFFFFFF
/* spoof as PSGL */
#define RGL_VALIDATE_NONE 0x00000000
#define RGL_VALIDATE_FRAMEBUFFER 0x00000001
#define RGL_VALIDATE_TEXTURES_USED 0x00000002
#define RGL_VALIDATE_VERTEX_PROGRAM 0x00000004
#define RGL_VALIDATE_VERTEX_CONSTANTS 0x00000008
#define RGL_VALIDATE_VERTEX_TEXTURES_USED 0x00000010
#define RGL_VALIDATE_FFX_VERTEX_PROGRAM 0x00000020
#define RGL_VALIDATE_FRAGMENT_PROGRAM 0x00000040
#define RGL_VALIDATE_FFX_FRAGMENT_PROGRAM 0x00000080
#define RGL_VALIDATE_FRAGMENT_SHARED_CONSTANTS 0x00000100
#define RGL_VALIDATE_VIEWPORT 0x00000200
#define RGL_VALIDATE_DEPTH_TEST 0x00000800
#define RGL_VALIDATE_WRITE_MASK 0x00001000
#define RGL_VALIDATE_STENCIL_TEST 0x00002000
#define RGL_VALIDATE_STENCIL_OP_AND_MASK 0x00004000
#define RGL_VALIDATE_SCISSOR_BOX 0x00008000
#define RGL_VALIDATE_FACE_CULL 0x00010000
#define RGL_VALIDATE_BLENDING 0x00020000
#define RGL_VALIDATE_POINT_RASTER 0x00040000
#define RGL_VALIDATE_LINE_RASTER 0x00080000
#define RGL_VALIDATE_POLYGON_OFFSET 0x00100000
#define RGL_VALIDATE_SHADE_MODEL 0x00200000
#define RGL_VALIDATE_LOGIC_OP 0x00400000
#define RGL_VALIDATE_MULTISAMPLING 0x00800000
#define RGL_VALIDATE_POLYGON_MODE 0x01000000
#define RGL_VALIDATE_PRIMITIVE_RESTART 0x02000000
#define RGL_VALIDATE_CLIP_PLANES 0x04000000
#define RGL_VALIDATE_SHADER_SRGB_REMAP 0x08000000
#define RGL_VALIDATE_POINT_SPRITE 0x10000000
#define RGL_VALIDATE_TWO_SIDE_COLOR 0x20000000
#define RGL_VALIDATE_ALL 0x3FFFFFFF
#define RGLdevice PSGLdevice
#define RGLdeviceParameters PSGLdeviceParameters
#define RGLcontext PSGLcontext
typedef struct
{
GLuint enable;
GLenum colorFormat;
GLenum depthFormat;
GLenum multisamplingMode;
PSGLtvStandard TVStandard;
PSGLdeviceConnector connector;
PSGLbufferingMode bufferingMode;
GLuint width; // dimensions of display device (scanout buffer)
GLuint height;
// dimensions of render buffer. Only set explicitly if the render target buffer
// needs to be different size than display scanout buffer (resolution scaling required).
// These can only be set if PSGL_DEVICE_PARAMETERS_RESC_RENDER_WIDTH_HEIGHT is set in the "enable" mask,
// otherwise, render buffer dimensions are set to device dimensions (width/height).
GLuint renderWidth;
GLuint renderHeight;
RescRatioMode rescRatioMode; // RESC aspect ratio rescaling mode: full screen, letterbox, or pan & scan
RescPalTemporalMode rescPalTemporalMode; // RESC pal frame rate conversion mode: none, drop frame, interpolate
RescInterlaceMode rescInterlaceMode; // RESC interlace filter mode: normal bilinear or use the anti-flicker interlace filter
// horizontal and vertical scaling to adjust for the difference in overscan rates for each SD/HD mode or TV
GLfloat horizontalScale;
GLfloat verticalScale;
} PSGLdeviceParameters;
#define PSGL_INIT_MAX_SPUS 0x0001
#define PSGL_INIT_INITIALIZE_SPUS 0x0002
#define PSGL_INIT_PERSISTENT_MEMORY_SIZE 0x0004
#define PSGL_INIT_TRANSIENT_MEMORY_SIZE 0x0008
#define PSGL_INIT_ERROR_CONSOLE 0x0010
#define PSGL_INIT_FIFO_SIZE 0x0020
#define PSGL_INIT_HOST_MEMORY_SIZE 0x0040
#define PSGL_INIT_USE_PMQUERIES 0x0080
/* spoof as PSGL */
#define RGL_INIT_MAX_SPUS 0x0001
#define RGL_INIT_INITIALIZE_SPUS 0x0002
#define RGL_INIT_PERSISTENT_MEMORY_SIZE 0x0004
#define RGL_INIT_TRANSIENT_MEMORY_SIZE 0x0008
#define RGL_INIT_ERROR_CONSOLE 0x0010
#define RGL_INIT_FIFO_SIZE 0x0020
#define RGL_INIT_HOST_MEMORY_SIZE 0x0040
#define RGL_INIT_USE_PMQUERIES 0x0080
typedef struct PSGLinitOptions
{
GLuint enable; // bitfield of options to set
GLuint maxSPUs;
GLboolean initializeSPUs;
GLuint persistentMemorySize;
GLuint transientMemorySize;
int errorConsole;
GLuint fifoSize;
GLuint hostMemorySize;
} PSGLinitOptions;
#define RGLinitOptions PSGLinitOptions
typedef void*( *PSGLmallocFunc )( size_t LSize ); // expected to return 16-byte aligned
typedef void*( *PSGLmemalignFunc )( size_t align, size_t LSize );
typedef void*( *PSGLreallocFunc )( void* LBlock, size_t LSize );
typedef void( *PSGLfreeFunc )( void* LBlock );
extern PSGL_EXPORT void psglInit (void *data);
extern PSGL_EXPORT void psglExit (void);
PSGL_EXPORT PSGLdevice* psglCreateDeviceAuto( GLenum colorFormat, GLenum depthFormat, GLenum multisamplingMode );
PSGL_EXPORT PSGLdevice* psglCreateDeviceExtended( const void *data);
PSGL_EXPORT GLfloat psglGetDeviceAspectRatio( const PSGLdevice * device );
PSGL_EXPORT void psglGetDeviceDimensions( const PSGLdevice * device, GLuint *width, GLuint *height );
PSGL_EXPORT void psglGetRenderBufferDimensions( const PSGLdevice * device, GLuint *width, GLuint *height );
PSGL_EXPORT void psglDestroyDevice (void *data);
PSGL_EXPORT void psglMakeCurrent( PSGLcontext* context, PSGLdevice* device );
PSGL_EXPORT PSGLcontext* psglCreateContext (void);
PSGL_EXPORT void psglDestroyContext (void *data);
PSGL_EXPORT void psglResetCurrentContext (void);
PSGL_EXPORT PSGLcontext* psglGetCurrentContext (void);
PSGL_EXPORT PSGLdevice* psglGetCurrentDevice (void);
PSGL_EXPORT void psglSwap (void);
static inline PSGL_EXPORT void psglRescAdjustAspectRatio( const float horizontalScale, const float verticalScale )
{
cellRescAdjustAspectRatio( horizontalScale, verticalScale );
}
/* hw cursor error code */
#define PSGL_HW_CURSOR_OK CELL_OK
#define PSGL_HW_CURSOR_ERROR_FAILURE CELL_GCM_ERROR_FAILURE
#define PSGL_HW_CURSOR_ERROR_INVALID_VALUE CELL_GCM_ERROR_INVALID_VALUE
#ifdef __cplusplus
}
#endif
#endif /* RGL_EXPORT_H */

View File

@ -1,262 +0,0 @@
#ifndef _CGC_CGBIO_CGBDEFS_HPP
#define _CGC_CGBIO_CGBDEFS_HPP
///////////////////////
// ELF Header Constants
// File type
#define ET_NONE 0
#define ET_REL 1
#define ET_EXEC 2
#define ET_DYN 3
#define ET_CORE 4
#define ET_LOOS 0xFE00
#define ET_HIOS 0xFEFF
#define ET_LOPROC 0xFF00
#define ET_HIPROC 0xFFFF
// Machine/Architecture
#define EM_NONE 0 // No machine
#define EM_RSX 0x528e // RSX
// Machine/Architecture flags
#define EM_RSX_NONE 0
// Machine/Architecture ABI version
#define EI_ABIVERSION_RSX 1
// ELF File version
#define EV_NONE 0
#define EV_CURRENT 1
// Identification index
#define EI_MAG0 0
#define EI_MAG1 1
#define EI_MAG2 2
#define EI_MAG3 3
#define EI_CLASS 4
#define EI_DATA 5
#define EI_VERSION 6
#define EI_OSABI 7
#define EI_ABIVERSION 8
#define EI_PAD 9
#define EI_NIDENT 16
// Magic number
#ifndef ELFMAG0
#define ELFMAG0 0x7F
#endif
#define ELFMAG1 'E'
#define ELFMAG2 'L'
#define ELFMAG3 'F'
// File class
#define ELFCLASSNONE 0
#define ELFCLASS32 1
#define ELFCLASS64 2
// Encoding
#define ELFDATANONE 0
#define ELFDATA2LSB 1
#define ELFDATA2MSB 2
// OS extensions
#define ELFOSABI_NONE 0 // No extensions or unspecified
#define ELFOSABI_HPUX 1 // Hewlett-Packard HP-UX
#define ELFOSABI_NETBSD 2 // NetBSD
#define ELFOSABI_LINUX 3 // Linux
#define ELFOSABI_SOLARIS 6 // Sun Solaris
#define ELFOSABI_AIX 7 // AIX
#define ELFOSABI_IRIX 8 // IRIX
#define ELFOSABI_FREEBSD 9 // FreeBSD
#define ELFOSABI_TRU64 10 // Compaq TRU64 UNIX
#define ELFOSABI_MODESTO 11 // Novell Modesto
#define ELFOSABI_OPENBSD 12 // Open BSD
#define ELFOSABI_CGRUNTIME 19 // Cg Run-Time
/////////////////////
// Sections constants
// Section indexes
#ifndef SHN_UNDEF
#define SHN_UNDEF 0
#endif
#ifndef SHN_LORESERVE
#define SHN_LORESERVE 0xFF00
#endif
#ifndef SHN_LOPROC
#define SHN_LOPROC 0xFF00
#endif
#ifndef SHN_HIPROC
#define SHN_HIPROC 0xFF1F
#endif
#ifndef SHN_LOOS
#define SHN_LOOS 0xFF20
#endif
#ifndef SHN_HIOS
#define SHN_HIOS 0xFF3F
#endif
#ifndef SHN_ABS
#define SHN_ABS 0xFFF1
#endif
#ifndef SHN_COMMON
#define SHN_COMMON 0xFFF2
#endif
#ifndef SHN_XINDEX
#define SHN_XINDEX 0xFFFF
#endif
#ifndef SHN_HIRESERVE
#define SHN_HIRESERVE 0xFFFF
#endif
// Section types
#define SHT_NULL 0
#define SHT_PROGBITS 1
#define SHT_SYMTAB 2
#define SHT_STRTAB 3
#define SHT_RELA 4
#define SHT_HASH 5
#define SHT_DYNAMIC 6
#define SHT_NOTE 7
#define SHT_NOBITS 8
#define SHT_REL 9
#define SHT_SHLIB 10
#define SHT_DYNSYM 11
#define SHT_INIT_ARRAY 14
#define SHT_FINI_ARRAY 15
#define SHT_PREINIT_ARRAY 16
#define SHT_GROUP 17
#define SHT_SYMTAB_SHNDX 18
#define SHT_LOOS 0x60000000
#define SHT_HIOS 0x6fffffff
#define SHT_LOPROC 0x70000000
#define SHT_RSX_PARAM 0x70000000
#define SHT_RSX_SHADERTAB 0x70000001
#define SHT_RSX_FXTAB 0x70000002
#define SHT_RSX_ANNOTATE 0x70000003
#define SHT_HIPROC 0x7FFFFFFF
#define SHT_LOUSER 0x80000000
#define SHT_HIUSER 0xFFFFFFFF
// Section flags
#ifndef SHF_WRITE
#define SHF_WRITE 0x1
#endif
#ifndef SHF_ALLOC
#define SHF_ALLOC 0x2
#endif
#ifndef SHF_EXECINSTR
#define SHF_EXECINSTR 0x4
#endif
#ifndef SHF_MERGE
#define SHF_MERGE 0x10
#endif
#ifndef SHF_STRINGS
#define SHF_STRINGS 0x20
#endif
#ifndef SHF_INFO_LINK
#define SHF_INFO_LINK 0x40
#endif
#ifndef SHF_LINK_ORDER
#define SHF_LINK_ORDER 0x80
#endif
#ifndef SHF_OS_NONCONFORMING
#define SHF_OS_NONCONFORMING 0x100
#endif
#define SHF_GROUP 0x200
#define SHF_TLS 0x400
#define SHF_MASKOS 0x0ff00000
#ifndef SHF_MASKPROC
#define SHF_MASKPROC 0xF0000000
#endif
// Section group flags
#define GRP_COMDAT 0x1
#define GRP_MASKOS 0x0ff00000
#define GRP_MASKPROC 0xf0000000
// Symbol binding
#define STB_LOCAL 0
#define STB_GLOBAL 1
#define STB_WEAK 2
#define STB_LOOS 10
#define STB_HIOS 12
#define STB_LOPROC 13
#define STB_HIPROC 15
// Symbol types
#define STT_NOTYPE 0
#define STT_OBJECT 1
#define STT_FUNC 2
#define STT_SECTION 3
#define STT_FILE 4
#define STT_COMMON 5
#define STT_TLS 6
#define STT_LOOS 10
#define STT_HIOS 12
#define STT_LOPROC 13
#define STT_HIPROC 15
// Symbol visibility
#define STV_DEFAULT 0
#define STV_INTERNAL 1
#define STV_HIDDEN 2
#define STV_PROTECTED 3
// Shader Function type (st_other field)
#define STO_RSX_SHADER 0
#define STO_RSX_EFFECT 1
// Undefined name
#define STN_UNDEF 0
// Relocation types
#define R_RSX_NONE 0
#define R_RSX_FLOAT4 1
/* Note header in a PT_NOTE section */
struct Elf32_Note
{
unsigned int n_namesz; /* Name size */
unsigned int n_descsz; /* Content size */
unsigned int n_type; /* Content type */
};
// Relocation entries
// Dynamic structure
struct Elf32_Dyn
{
signed int d_tag;
union
{
unsigned int d_val;
unsigned int d_ptr;
} d_un;
};
#endif // CGC_CGBIO_CGBDEFS_HPP

View File

@ -1,61 +0,0 @@
/* cgbio.hpp -- interface to the whole cg binary input/output library.
*
* This is the only header file, that an application need to include
* in order to manipulate both elf and nvidia original cg binary
* format.
*/
#ifndef CGC_CGBIO_CGBIO_HPP
#define CGC_CGBIO_CGBIO_HPP
#include "cgbdefs.hpp"
#include <string>
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
};
} // bio namespace
} // cgc namespace
#include "nvbi.hpp"
namespace cgc
{
namespace bio
{
class bin_io
{
public:
static const bin_io* instance();
static void delete_instance();
CGBIO_ERROR new_nvb_reader( nvb_reader** obj ) const;
const char *error_string( CGBIO_ERROR error ) const;
private:
bin_io();
bin_io( const bin_io& );
static bin_io* instance_;
}; // bin_io
} // bio namespace
} // cgc namespace
#endif // CGC_CGBIO_CGBIO_HPP

View File

@ -1,22 +0,0 @@
#ifndef CGBTYPES_HEADER
#define CGBTYPES_HEADER
// parameter structure
typedef struct _Elf32_cgParameter
{
uint32_t cgp_name; // index of name in strtab
uint32_t cgp_semantic; // index of semantic string in strtab
uint16_t cgp_default; // index of default data in const //Reduced to half
uint16_t cgp_reloc; // index of reloc indices in rel
uint16_t cgp_resource; // index of hardware resource assigned
uint16_t cgp_resource_index; // index of hardware resource assigned
unsigned char cgp_type;
uint16_t cgp_info;
unsigned char unused;
} Elf32_cgParameter; //20 bytes
#define CGF_OUTPUTFROMH0 0x01
#define CGF_DEPTHREPLACE 0x02
#define CGF_PIXELKILL 0x04
#endif

View File

@ -1,63 +0,0 @@
#ifndef CGC_CGBIO_CGBUTILS_HPP
#define CGC_CGBIO_CGBUTILS_HPP
#include "cgbdefs.hpp"
#define ELF32_ST_BIND(idx) ( idx >> 4 )
#define ELF32_ST_TYPE(idx) ( idx & 0xf )
#define ELF32_ST_INFO(b, t) (( b << 4 ) + ( t & 0xf ))
#define ELF32_ST_VISIBILITY(o) ( o & 0x3 )
namespace cgc
{
namespace bio
{
typedef enum
{
CGBIODATANONE = ELFDATANONE,
CGBIODATALSB = ELFDATA2LSB,
CGBIODATAMSB = ELFDATA2MSB
} HOST_ENDIANNESS; // endianness
inline HOST_ENDIANNESS host_endianness(void)
{
const int ii = 1;
const char* cp = (const char*) &ii;
return ( cp[0] == 1 ) ? CGBIODATALSB : CGBIODATAMSB;
}
template< typename T > inline T convert_endianness( const T value, unsigned char endianness )
{
if ( host_endianness() == endianness )
return value;
if ( sizeof( T ) == 1 )
return value;
if ( sizeof( T ) == 2 )
return ( ((value & 0x00FF) << 8) | ((value & 0xFF00) >> 8) );
if ( sizeof( T ) == 4 )
return ( ((value & 0x000000FF) << 24) | ((value & 0x0000FF00) << 8)
| ((value & 0x00FF0000) >> 8) | ((value & 0xFF000000) >> 24) );
if ( sizeof( T ) == 8 )
{
T result = value;
for ( int ii = 0; ii < 4; ++ii )
{
char ch = *( (( char* ) &result) + ii );
*( (( char* ) &result) + ii ) = *( (( char* ) &result) + (7 - ii) );
*( (( char* ) &result) + (7 - ii) ) = ch;
}
return result;
}
// exception
return value;
}
} // bio namespace
} // cgc namespace
#endif // CGC_CGBIO_CGBUTILS_HPP

View File

@ -1,15 +0,0 @@
#ifndef CGNV2RT_HEADER
#define CGNV2RT_HEADER
#include <stdio.h>
#include <vector>
#define CNV2END(val) convert_endianness((val), elfEndianness)
#define ENDSWAP(val) convert_endianness((val), (host_endianness() == 1) ? 2 : 1)
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 convertNvToElfFreeBinaryShader(void *binaryShader);
#endif

View File

@ -1,82 +0,0 @@
#ifndef CGC_CGBIO_NVBI_HPP
#define CGC_CGBIO_NVBI_HPP
#include "cgbdefs.hpp"
#include <string>
#include <vector>
#include <cstddef>
#include <Cg/cg.h>
#include <Cg/cgBinary.h>
namespace cgc
{
namespace bio
{
class nvb_reader
{
public:
virtual ~nvb_reader() {}
virtual ptrdiff_t
reference() const = 0;
virtual ptrdiff_t
release() const = 0;
virtual CGBIO_ERROR
loadFromString( const char* source, size_t length ) = 0;
virtual bool
is_loaded() const = 0;
virtual unsigned char
endianness() const = 0;
virtual CGprofile
profile() const = 0;
virtual unsigned int
revision() const = 0;
virtual unsigned int
size() const = 0;
virtual unsigned int
number_of_params() const = 0;
virtual unsigned int
ucode_size() const = 0;
virtual const char*
ucode() const = 0;
virtual const CgBinaryFragmentProgram*
fragment_program() const = 0;
virtual const CgBinaryVertexProgram*
vertex_program() const = 0;
virtual CGBIO_ERROR
get_param( unsigned int index,
CGtype& type,
CGresource& resource,
CGenum& variability,
int& resource_index,
const char** name,
std::vector<float>& default_value,
std::vector<unsigned int>& embedded_constants,
const char** semantic,
CGenum& direction,
int& paramno,
bool& is_referenced,
bool& is_shared ) const = 0;
virtual CGBIO_ERROR get_param_name( unsigned int index, const char** name, bool& is_referenced) const = 0;
}; // nvb_reader
} // bio namespace
} // cgc namespace
#endif // CGC_CGBIO_NVBI_HPP

View File

@ -1,93 +0,0 @@
#ifndef CGC_CGBIO_NVBIIMPL_HPP
#define CGC_CGBIO_NVBIIMPL_HPP
#include <vector>
#include <Cg/cg.h>
#include <Cg/cgBinary.h>
#include "cgbio.hpp"
namespace cgc
{
namespace bio
{
class nvb_reader_impl : public nvb_reader
{
public:
nvb_reader_impl();
virtual
~nvb_reader_impl();
virtual ptrdiff_t
reference() const;
virtual ptrdiff_t
release() const;
virtual CGBIO_ERROR
loadFromString( const char* source, size_t length);
virtual bool
is_loaded() const;
virtual unsigned char
endianness() const;
virtual CGprofile
profile() const;
virtual unsigned int
revision() const;
virtual unsigned int
size() const;
virtual unsigned int
number_of_params() const;
virtual unsigned int
ucode_size() const;
virtual const char*
ucode() const;
virtual const CgBinaryFragmentProgram*
fragment_program() const;
virtual const CgBinaryVertexProgram*
vertex_program() const;
virtual CGBIO_ERROR
get_param( unsigned int index,
CGtype& type,
CGresource& resource,
CGenum& variability,
int& resource_index,
const char ** name,
std::vector<float>& default_value,
std::vector<unsigned int>& embedded_constants,
const char ** semantic,
CGenum& direction,
int& paramno,
bool& is_referenced,
bool& is_shared ) const;
virtual CGBIO_ERROR get_param_name( unsigned int index, const char ** name , bool& is_referenced) const;
private:
mutable ptrdiff_t ref_count_;
int offset_;
bool loaded_;
bool owner_;
bool strStream_;
CgBinaryProgram header_;
unsigned char endianness_;
char* image_;
}; // nvb_reader_impl
} // bio namespace
} // cgc namespace
#endif // CGC_CGBIO_NVBIIMPL_HPP

View File

@ -1,141 +0,0 @@
#ifndef _GMM_ALLOC_H_
#define _GMM_ALLOC_H_
void gmmPrintState(); // print out all blocks and their current states
#define GMM_ASSERT(cond) ((void)0)
#define GMM_ERROR 0xFFFFFFFF
#define GMM_TILE_ALIGNMENT 0x10000 // 16K
#define GMM_ALIGNMENT 128 // non-tile is 128 byte
#define GMM_RSX_WAIT_INDEX 254 // label index
#define GMM_PPU_WAIT_INDEX 255 // label index
#define GMM_BLOCK_COUNT 512 // initial memory block pool
#define GMM_TILE_BLOCK_COUNT 16 // initial tile memory block pool
#define GMM_NUM_FREE_BINS 22
#define GMM_FREE_BIN_0 0x80 // 0x00 - 0x80
#define GMM_FREE_BIN_1 0x100 // 0x80 - 0x100
#define GMM_FREE_BIN_2 0x180 // ...
#define GMM_FREE_BIN_3 0x200
#define GMM_FREE_BIN_4 0x280
#define GMM_FREE_BIN_5 0x300
#define GMM_FREE_BIN_6 0x380
#define GMM_FREE_BIN_7 0x400
#define GMM_FREE_BIN_8 0x800
#define GMM_FREE_BIN_9 0x1000
#define GMM_FREE_BIN_10 0x2000
#define GMM_FREE_BIN_11 0x4000
#define GMM_FREE_BIN_12 0x8000
#define GMM_FREE_BIN_13 0x10000
#define GMM_FREE_BIN_14 0x20000
#define GMM_FREE_BIN_15 0x40000
#define GMM_FREE_BIN_16 0x80000
#define GMM_FREE_BIN_17 0x100000
#define GMM_FREE_BIN_18 0x200000
#define GMM_FREE_BIN_19 0x400000
#define GMM_FREE_BIN_20 0x800000
#define GMM_FREE_BIN_21 0x1000000
// data structure for the fixed allocater
typedef struct GmmFixedAllocData{
char **ppBlockList[2]; // pre-allocated list of block descriptors
uint16_t **ppFreeBlockList[2];
uint16_t *pBlocksUsed[2];
uint16_t BlockListCount[2];
}GmmFixedAllocData;
// common shared block descriptor for tile and non-tile block
// "base class" for GmmBlock and GmmTileBlock
typedef struct GmmBaseBlock{
uint8_t isTile;
uint32_t address;
uint32_t size;
}GmmBaseBlock;
typedef struct GmmBlock{
GmmBaseBlock base; // inheritence
struct GmmBlock *pPrev;
struct GmmBlock *pNext;
uint8_t isPinned;
// these would only be valid if the block is in
// pending free list or free list
struct GmmBlock *pPrevFree;
struct GmmBlock *pNextFree;
uint32_t fence;
}GmmBlock;
typedef struct GmmTileBlock
{
GmmBaseBlock base; // inheritence
struct GmmTileBlock *pPrev;
struct GmmTileBlock *pNext;
uint32_t tileTag;
void *pData;
} GmmTileBlock;
typedef struct GmmAllocator
{
uint32_t memoryBase;
uint32_t startAddress;
uint32_t size;
uint32_t freeAddress;
GmmBlock *pHead;
GmmBlock *pTail;
GmmBlock *pSweepHead;
uint32_t freedSinceSweep;
uint32_t tileStartAddress;
uint32_t tileSize;
GmmTileBlock *pTileHead;
GmmTileBlock *pTileTail;
GmmBlock *pPendingFreeHead;
GmmBlock *pPendingFreeTail;
// Acceleration data structure for free blocks
GmmBlock *pFreeHead[GMM_NUM_FREE_BINS];
GmmBlock *pFreeTail[GMM_NUM_FREE_BINS];
uint32_t totalSize; // == size + tileSize
} GmmAllocator;
uint32_t gmmDestroy(void);
char *gmmIdToAddress(const uint32_t id);
uint32_t gmmFree (const uint32_t freeId);
uint32_t gmmAlloc(const uint32_t size);
uint32_t gmmAllocTiled(const uint32_t size);
extern GmmAllocator *pGmmLocalAllocator;
#define GMM_ADDRESS_TO_OFFSET(address) (address - pGmmLocalAllocator->memoryBase)
#define gmmGetBlockSize(id) (((GmmBaseBlock*)id)->size)
#define gmmGetTileData(id) (((GmmTileBlock*)id)->pData)
#define gmmIdToOffset(id) (GMM_ADDRESS_TO_OFFSET(((GmmBaseBlock*)id)->address))
#define gmmAllocFixedTileBlock() ((GmmTileBlock*)gmmAllocFixed(1))
#define gmmFreeFixedTileBlock(data) (gmmFreeFixed(1, (GmmTileBlock*)data))
#define gmmFreeFixedBlock(data) (gmmFreeFixed(0, (GmmBlock*)data))
#define gmmAllocTileBlock(pAllocator, size, pBlock) ((pBlock == NULL) ? gmmCreateTileBlock(pAllocator, size) : pBlock)
#define gmmSetTileAttrib(id, tag, data) \
((GmmTileBlock*)id)->tileTag = tag; \
((GmmTileBlock*)id)->pData = data;
#define gmmPinId(id) \
if (!((GmmBaseBlock*)id)->isTile) \
((GmmBlock *)id)->isPinned = 1;
#define gmmUnpinId(id) \
if (!((GmmBaseBlock*)id)->isTile) \
((GmmBlock *)id)->isPinned = 0;
#endif

View File

@ -1,691 +0,0 @@
#ifndef _GCM_CMDS_H
#define _GCM_CMDS_H
#define gcm_emit_at(buffer, location, word) ((buffer)[(location)] = (word))
#define gcm_emit_method_at(buffer, location, method, n) gcm_emit_at((buffer),(location), (method) |((n) << 18))
#define gcm_finish_n_commands(buffer, n) (buffer) += n
#define rglGcmSetTextureAddress(thisContext, index, wraps, wrapt, wrapr, unsignedRemap, zfunc, gamma) \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_SET_TEXTURE_ADDRESS + 0x20 * ((index)), 1); \
gcm_emit_at(thisContext->current, 1, (((wraps)) | ((0) << 4) | (((wrapt)) << 8) | (((unsignedRemap)) << 12) | (((wrapr)) << 16) | (((gamma)) << 20) |((0) << 24) | (((zfunc)) << 28))); \
gcm_finish_n_commands(thisContext->current, 2);
#define rglGcmSetTextureFilter(thisContext, index, bias, min, mag, conv) \
{ \
bool continue_func = true; \
if(thisContext->current + (2) > thisContext->end) \
{ \
if((*thisContext->callback)(thisContext, (2)) != 0) \
continue_func = false; \
} \
if (continue_func) \
{ \
gcm_emit_method_at(thisContext->current, 0, (CELL_GCM_NV4097_SET_TEXTURE_FILTER + 0x20 * ((index))), 1); \
gcm_emit_at(thisContext->current, 1, (((bias)) | (((conv)) << 13) | (((min)) << 16) | (((mag)) << 24) | ((0) << 28) | ((0) << 29) | ((0) << 30) | ((0) << 31))); \
gcm_finish_n_commands(thisContext->current, 2); \
} \
}
#define rglGcmSetReferenceCommandInline(thisContext, ref) \
{ \
bool continue_func = true; \
if(thisContext->current + (2) > thisContext->end) \
{ \
if((*thisContext->callback)(thisContext, (2)) != 0) \
continue_func = false; \
} \
if (continue_func) \
{ \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV406E_SET_REFERENCE, 1); \
gcm_emit_at(thisContext->current, 1, ref); \
gcm_finish_n_commands(thisContext->current, 2); \
} \
}
#define rglGcmSetTextureBorderColor(thisContext, index, color) \
gcm_emit_method_at(thisContext->current, 0, (CELL_GCM_NV4097_SET_TEXTURE_BORDER_COLOR + 0x20 * ((index))), 1); \
gcm_emit_at(thisContext->current, 1, color); \
gcm_finish_n_commands(thisContext->current, 2);
#define rglDisableVertexAttribArrayNVInline(context, index) \
RGLBIT_FALSE(context->attribs->EnabledMask, index); \
RGLBIT_TRUE(context->attribs->DirtyMask, index);
#define rglEnableVertexAttribArrayNVInline(context, index) \
RGLBIT_TRUE(context->attribs->EnabledMask, index); \
RGLBIT_TRUE(context->attribs->DirtyMask, index);
#define rglGcmSetVertexData4f(thisContext, index, v) \
gcm_emit_method_at(thisContext->current, 0, (CELL_GCM_NV4097_SET_VERTEX_DATA4F_M + (index) * 16), 4); \
memcpy(&thisContext->current[1], v, sizeof(float)*4); \
gcm_finish_n_commands(thisContext->current, 5);
#define rglGcmSetJumpCommand(thisContext, offset) \
gcm_emit_at(thisContext->current, 0, ((offset) | (0x20000000))); \
gcm_finish_n_commands(thisContext->current, 1);
#define rglGcmSetVertexDataArray(thisContext, index, frequency, stride, size, type, location, offset) \
gcm_emit_method_at(thisContext->current, 0, (CELL_GCM_NV4097_SET_VERTEX_DATA_ARRAY_FORMAT + ((index)) * 4), 1); \
gcm_emit_at(thisContext->current, 1, ((((frequency)) << 16) | (((stride)) << 8) | (((size)) << 4) | ((type)))); \
gcm_finish_n_commands(thisContext->current, 2); \
gcm_emit_method_at(thisContext->current, 0, (CELL_GCM_NV4097_SET_VERTEX_DATA_ARRAY_OFFSET + ((index)) * 4), 1); \
gcm_emit_at(thisContext->current, 1, ((((location)) << 31) | (offset))); \
gcm_finish_n_commands(thisContext->current, 2);
#define rglGcmSetInlineTransferPointer(thisContext, offset, count, pointer) \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV3062_SET_OFFSET_DESTIN, 1); \
gcm_emit_at(thisContext->current, 1, (offset & ~63)); \
gcm_finish_n_commands(thisContext->current, 2); \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV3062_SET_COLOR_FORMAT, 2); \
gcm_emit_at(thisContext->current, 1, CELL_GCM_TRANSFER_SURFACE_FORMAT_Y32); \
gcm_emit_at(thisContext->current, 2, ((0x1000) | ((0x1000) << 16))); \
gcm_finish_n_commands(thisContext->current, 3); \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV308A_POINT, 3); \
gcm_emit_at(thisContext->current, 1, (((0) << 16) | ((offset & 63) >> 2))); \
gcm_emit_at(thisContext->current, 2, (((1) << 16) | (count))); \
gcm_emit_at(thisContext->current, 3, (((1) << 16) | (count))); \
gcm_finish_n_commands(thisContext->current, 4); \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV308A_COLOR, ((count + 1) & ~1)); \
gcm_finish_n_commands(thisContext->current, 1); \
pointer = thisContext->current; \
gcm_finish_n_commands(thisContext->current, ((count + 1) & ~1));
#define rglGcmSetWriteBackEndLabel(thisContext, index, value) \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_SET_SEMAPHORE_OFFSET, 1); \
gcm_emit_at(thisContext->current, 1, 0x10 * index); \
gcm_finish_n_commands(thisContext->current, 2); \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_BACK_END_WRITE_SEMAPHORE_RELEASE, 1); \
gcm_emit_at(thisContext->current, 1, ( value & 0xff00ff00) | ((value >> 16) & 0xff) | (((value >> 0 ) & 0xff) << 16)); \
gcm_finish_n_commands(thisContext->current, 2);
#define rglGcmSetWaitLabel(thisContext, index, value) \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV406E_SEMAPHORE_OFFSET, 1); \
gcm_emit_at(thisContext->current, 1, 0x10 * index); \
gcm_finish_n_commands(thisContext->current, 2); \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV406E_SEMAPHORE_ACQUIRE, 1); \
gcm_emit_at(thisContext->current, 1, value); \
gcm_finish_n_commands(thisContext->current, 2);
#define rglGcmSetInvalidateVertexCache(thisContext) \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_INVALIDATE_VERTEX_CACHE_FILE, 1); \
gcm_emit_at(thisContext->current, 1, 0); \
gcm_finish_n_commands(thisContext->current, 2); \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_INVALIDATE_VERTEX_FILE, 1); \
gcm_emit_at(thisContext->current, 1, 0); \
gcm_finish_n_commands(thisContext->current, 2); \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_INVALIDATE_VERTEX_FILE, 1); \
gcm_emit_at(thisContext->current, 1, 0); \
gcm_finish_n_commands(thisContext->current, 2); \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_INVALIDATE_VERTEX_FILE, 1); \
gcm_emit_at(thisContext->current, 1, 0); \
gcm_finish_n_commands(thisContext->current, 2);
#define rglGcmSetClearSurface(thisContext, mask) \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_CLEAR_SURFACE, 1); \
gcm_emit_at(thisContext->current, 1, mask); \
gcm_finish_n_commands(thisContext->current, 2); \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_NO_OPERATION, 1); \
gcm_emit_at(thisContext->current, 1, 0); \
gcm_finish_n_commands(thisContext->current, 2);
#define rglGcmSetTextureControl(thisContext, index, enable, minlod, maxlod, maxaniso) \
gcm_emit_at(thisContext->current, 0, (((1) << (18)) | (CELL_GCM_NV4097_SET_TEXTURE_CONTROL0 + 0x20 * ((index))))); \
gcm_emit_at(thisContext->current, 1, ((((0) << 2) | ((maxaniso)) << 4) | (((maxlod)) << 7) | (((minlod)) << 19) | ((enable) << 31))); \
gcm_finish_n_commands(thisContext->current, 2);
#define rglGcmSetTextureRemap(thisContext, index, remap) \
gcm_emit_method_at(thisContext->current, 0, (CELL_GCM_NV4097_SET_TEXTURE_CONTROL1 + ((index)) * 32), 1); \
gcm_emit_at(thisContext->current, 1, remap); \
gcm_finish_n_commands(thisContext->current, 2);
#define rglGcmSetTransferLocation(thisContext, location) \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV3062_SET_CONTEXT_DMA_IMAGE_DESTIN, 1); \
gcm_emit_at(thisContext->current, 1, (CELL_GCM_CONTEXT_DMA_MEMORY_FRAME_BUFFER + location)); \
gcm_finish_n_commands(thisContext->current, 2);
#define rglGcmInlineTransfer(thisContext, dstOffset, srcAdr, sizeInWords, location) \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV3062_SET_CONTEXT_DMA_IMAGE_DESTIN, 1); \
gcm_emit_at(thisContext->current, 1, (CELL_GCM_CONTEXT_DMA_MEMORY_FRAME_BUFFER + location)); \
gcm_finish_n_commands(thisContext->current, 2); \
rglGcmSetInlineTransfer(thisContext, dstOffset, srcAdr, sizeInWords);
#define rglGcmSetClearColor(thisContext, color) \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_SET_COLOR_CLEAR_VALUE, 1); \
gcm_emit_at(thisContext->current, 1, color); \
gcm_finish_n_commands(thisContext->current, 2);
#define rglGcmSetTextureBorder(thisContext, index, texture, border) \
gcm_emit_at(thisContext->current, 0, (((2) << (18)) | (CELL_GCM_NV4097_SET_TEXTURE_OFFSET + ((index)) * 32))); \
gcm_emit_at(thisContext->current, 1, texture->offset); \
gcm_emit_at(thisContext->current, 2, (texture->location + 1) | (texture->cubemap << 2) | (border << 3) | (texture->dimension << 4) | (texture->format << 8) | (texture->mipmap << 16)); \
gcm_finish_n_commands(thisContext->current, 3); \
gcm_emit_at(thisContext->current, 0, (((1) << (18)) | (CELL_GCM_NV4097_SET_TEXTURE_IMAGE_RECT + ((index)) * 32))); \
gcm_emit_at(thisContext->current, 1, texture->height | (texture->width << 16)); \
gcm_finish_n_commands(thisContext->current, 2); \
gcm_emit_at(thisContext->current, 0, (((1) << (18)) | (CELL_GCM_NV4097_SET_TEXTURE_CONTROL3 + ((index)) * 4))); \
gcm_emit_at(thisContext->current, 1, texture->pitch | (texture->depth << 20)); \
gcm_finish_n_commands(thisContext->current, 2); \
gcm_emit_at(thisContext->current, 0, (((1) << (18)) | (CELL_GCM_NV4097_SET_TEXTURE_CONTROL1 + ((index)) * 32))); \
gcm_emit_at(thisContext->current, 1, texture->remap); \
gcm_finish_n_commands(thisContext->current, 2);
#define rglGcmSetBlendEnable(thisContext, enable) \
{ \
bool continue_func = true; \
if(thisContext->current + (2) > thisContext->end) \
{ \
if((*thisContext->callback)(thisContext, (2)) != 0) \
continue_func = false; \
} \
if (continue_func) \
{ \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_SET_BLEND_ENABLE, 1); \
gcm_emit_at(thisContext->current, 1, enable); \
gcm_finish_n_commands(thisContext->current, 2); \
} \
}
#define rglGcmSetBlendEnableMrt(thisContext, mrt1, mrt2, mrt3) \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_SET_BLEND_ENABLE_MRT, 1); \
gcm_emit_at(thisContext->current, 1, (((mrt1) << 1)|((mrt2) << 2)|((mrt3) << 3))); \
gcm_finish_n_commands(thisContext->current, 2);
#define rglGcmSetBlendEquation(thisContext, color, alpha) \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_SET_BLEND_EQUATION, 1); \
gcm_emit_at(thisContext->current, 1, (((color)) | (((alpha)) << 16))); \
gcm_finish_n_commands(thisContext->current, 2);
#define rglGcmSetBlendFunc(thisContext, sfcolor, dfcolor, sfalpha, dfalpha) \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_SET_BLEND_FUNC_SFACTOR, 2); \
gcm_emit_at(thisContext->current, 1, (((sfcolor)) | (((sfalpha)) << 16))); \
gcm_emit_at(thisContext->current, 2, (((dfcolor)) | (((dfalpha)) << 16))); \
gcm_finish_n_commands(thisContext->current, 3);
#define rglGcmSetUserClipPlaneControl(thisContext, plane0, plane1, plane2, plane3, plane4, plane5) \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_SET_USER_CLIP_PLANE_CONTROL, 1); \
gcm_emit_at(thisContext->current, 1, ((plane0) | ((plane1) << 4) | ((plane2) << 8) | ((plane3) << 12) | ((plane4) << 16) | ((plane5) << 20))); \
gcm_finish_n_commands(thisContext->current, 2);
#define rglGcmSetInvalidateTextureCache(thisContext, value) \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_INVALIDATE_L2, 1); \
gcm_emit_at(thisContext->current, 1, value); \
gcm_finish_n_commands(thisContext->current, 2);
#define rglGcmSetViewport(thisContext, x, y, w, h, min, max, scale, offset) \
CellGcmCast d0,d1; \
d0.f = min; \
d1.f = max; \
CellGcmCast o[4],s[4]; \
o[0].f = offset[0]; \
o[1].f = offset[1]; \
o[2].f = offset[2]; \
o[3].f = offset[3]; \
s[0].f = scale[0]; \
s[1].f = scale[1]; \
s[2].f = scale[2]; \
s[3].f = scale[3]; \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_SET_VIEWPORT_HORIZONTAL, 2); \
gcm_emit_at(thisContext->current, 1, (((x)) | (((w)) << 16))); \
gcm_emit_at(thisContext->current, 2, (((y)) | (((h)) << 16))); \
gcm_finish_n_commands(thisContext->current, 3); \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_SET_CLIP_MIN, 2); \
gcm_emit_at(thisContext->current, 1, (d0.u)); \
gcm_emit_at(thisContext->current, 2, (d1.u)); \
gcm_finish_n_commands(thisContext->current, 3); \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_SET_VIEWPORT_OFFSET, 8); \
gcm_emit_at(thisContext->current, 1, (o[0].u)); \
gcm_emit_at(thisContext->current, 2, (o[1].u)); \
gcm_emit_at(thisContext->current, 3, (o[2].u)); \
gcm_emit_at(thisContext->current, 4, (o[3].u)); \
gcm_emit_at(thisContext->current, 5, (s[0].u)); \
gcm_emit_at(thisContext->current, 6, (s[1].u)); \
gcm_emit_at(thisContext->current, 7, (s[2].u)); \
gcm_emit_at(thisContext->current, 8, (s[3].u)); \
gcm_finish_n_commands(thisContext->current, 9); \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_SET_VIEWPORT_OFFSET, 8); \
gcm_emit_at(thisContext->current, 1, (o[0].u)); \
gcm_emit_at(thisContext->current, 2, (o[1].u)); \
gcm_emit_at(thisContext->current, 3, (o[2].u)); \
gcm_emit_at(thisContext->current, 4, (o[3].u)); \
gcm_emit_at(thisContext->current, 5, (s[0].u)); \
gcm_emit_at(thisContext->current, 6, (s[1].u)); \
gcm_emit_at(thisContext->current, 7, (s[2].u)); \
gcm_emit_at(thisContext->current, 8, (s[3].u)); \
gcm_finish_n_commands(thisContext->current, 9);
#define rglGcmSetDitherEnable(thisContext, enable) \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_SET_DITHER_ENABLE, 1); \
gcm_emit_at(thisContext->current, 1, enable); \
gcm_finish_n_commands(thisContext->current, 2);
#define rglGcmSetReferenceCommand(thisContext, ref) \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV406E_SET_REFERENCE, 1); \
gcm_emit_at(thisContext->current, 1, ref); \
gcm_finish_n_commands(thisContext->current, 2);
#define rglGcmSetZMinMaxControl(thisContext, cullNearFarEnable, zclampEnable, cullIgnoreW) \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_SET_ZMIN_MAX_CONTROL, 1); \
gcm_emit_at(thisContext->current, 1, ((cullNearFarEnable) | ((zclampEnable) << 4) | ((cullIgnoreW)<<8))); \
gcm_finish_n_commands(thisContext->current, 2);
#define rglGcmSetVertexAttribOutputMask(thisContext, mask) \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_SET_VERTEX_ATTRIB_OUTPUT_MASK, 1); \
gcm_emit_at(thisContext->current, 1, mask); \
gcm_finish_n_commands(thisContext->current, 2);
#define rglGcmSetNopCommand(thisContext, i, count) \
for(i = 0;i < count; i++) \
gcm_emit_at(thisContext->current, i, 0); \
gcm_finish_n_commands(thisContext->current, count);
#define rglGcmSetAntiAliasingControl(thisContext, enable, alphaToCoverage, alphaToOne, sampleMask) \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_SET_ANTI_ALIASING_CONTROL, 1); \
gcm_emit_at(thisContext->current, 1, ((enable) | ((alphaToCoverage) << 4) | ((alphaToOne) << 8) | ((sampleMask) << 16))); \
gcm_finish_n_commands(thisContext->current, 2);
#define rglGcmFifoFinish(fifo, ref, offset_bytes) \
ref = rglGcmFifoPutReference( fifo ); \
rglGcmFifoFlush( fifo, offset_bytes ); \
while (rglGcmFifoReferenceInUse(fifo, ref));
#define rglGcmFifoReadReference(fifo) (fifo->lastHWReferenceRead = *((volatile GLuint *)&fifo->dmaControl->Reference))
#define rglGcmFifoFlush(fifo, offsetInBytes) \
cellGcmAddressToOffset( fifo->ctx.current, ( uint32_t * )&offsetInBytes ); \
rglGcmFlush(gCellGcmCurrentContext); \
fifo->dmaControl->Put = offsetInBytes; \
fifo->lastPutWritten = fifo->ctx.current; \
fifo->lastSWReferenceFlushed = fifo->lastSWReferenceWritten;
#define rglGcmFlush(thisContext) cellGcmFlushUnsafe(thisContext)
#define rglGcmSetSurface(thisContext, surface, origin, pixelCenter, log2Width, log2Height) \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_SET_CONTEXT_DMA_COLOR_A, 1); \
gcm_emit_at(thisContext->current, 1, (CELL_GCM_CONTEXT_DMA_MEMORY_FRAME_BUFFER + surface->colorLocation[0])); \
gcm_finish_n_commands(thisContext->current, 2); \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_SET_CONTEXT_DMA_COLOR_B, 1); \
gcm_emit_at(thisContext->current, 1, (CELL_GCM_CONTEXT_DMA_MEMORY_FRAME_BUFFER + surface->colorLocation[1])); \
gcm_finish_n_commands(thisContext->current, 2); \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_SET_CONTEXT_DMA_COLOR_C, 2); \
gcm_emit_at(thisContext->current, 1, (CELL_GCM_CONTEXT_DMA_MEMORY_FRAME_BUFFER + surface->colorLocation[2])); \
gcm_emit_at(thisContext->current, 2, (CELL_GCM_CONTEXT_DMA_MEMORY_FRAME_BUFFER + surface->colorLocation[3])); \
gcm_finish_n_commands(thisContext->current, 3); \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_SET_CONTEXT_DMA_ZETA, 1); \
gcm_emit_at(thisContext->current, 1, (CELL_GCM_CONTEXT_DMA_MEMORY_FRAME_BUFFER + surface->depthLocation)); \
gcm_finish_n_commands(thisContext->current, 2); \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_SET_SURFACE_FORMAT, 6); \
gcm_emit_at(thisContext->current, 1, ((surface->colorFormat) | ((surface->depthFormat) << 5) | ((surface->type) << 8) | ((surface->antialias) << 12) | ((log2Width) << 16) | ((log2Height) << 24))); \
gcm_emit_at(thisContext->current, 2, (surface->colorPitch[0])); \
gcm_emit_at(thisContext->current, 3, (surface->colorOffset[0])); \
gcm_emit_at(thisContext->current, 4, (surface->depthOffset)); \
gcm_emit_at(thisContext->current, 5, (surface->colorOffset[1])); \
gcm_emit_at(thisContext->current, 6, (surface->colorPitch[1])); \
gcm_finish_n_commands(thisContext->current, 7); \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_SET_SURFACE_PITCH_Z, 1); \
gcm_emit_at(thisContext->current, 1, (surface->depthPitch)); \
gcm_finish_n_commands(thisContext->current, 2); \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_SET_SURFACE_PITCH_C, 4); \
gcm_emit_at(thisContext->current, 1, (surface->colorPitch[2])); \
gcm_emit_at(thisContext->current, 2, (surface->colorPitch[3])); \
gcm_emit_at(thisContext->current, 3, (surface->colorOffset[2])); \
gcm_emit_at(thisContext->current, 4, (surface->colorOffset[3])); \
gcm_finish_n_commands(thisContext->current, 5); \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_SET_SURFACE_COLOR_TARGET, 1); \
gcm_emit_at(thisContext->current, 1, surface->colorTarget); \
gcm_finish_n_commands(thisContext->current, 2); \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_SET_WINDOW_OFFSET, 1); \
gcm_emit_at(thisContext->current, 1, ((surface->x) | ((surface->y) << 16))); \
gcm_finish_n_commands(thisContext->current, 2); \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_SET_SURFACE_CLIP_HORIZONTAL, 2); \
gcm_emit_at(thisContext->current, 1, ((surface->x) | ((surface->width) << 16))); \
gcm_emit_at(thisContext->current, 2, ((surface->y) | ((surface->height) << 16))); \
gcm_finish_n_commands(thisContext->current, 3); \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_SET_SHADER_WINDOW, 1); \
gcm_emit_at(thisContext->current, 1, ((surface->height - (((surface->height) & 0x1000) >> 12)) | ((origin) << 12) | ((pixelCenter) << 16))); \
gcm_finish_n_commands(thisContext->current, 2);
#define rglGcmSend(thisContext, dstId, dstOffset, pitch, src, size) \
GLuint id = gmmAlloc(size); \
memcpy( gmmIdToAddress(id), (src), size ); \
rglGcmTransferData(thisContext, dstId, dstOffset, size, id, 0, size, size, 1 ); \
gmmFree( id )
#define rglGcmSetUpdateFragmentProgramParameter(thisContext, offset, location) \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_SET_SHADER_PROGRAM, 1); \
gcm_emit_at(thisContext->current, 1, ((location+1) | (offset))); \
gcm_finish_n_commands(thisContext->current, 2);
#define rglGcmSetBlendColor(thisContext, color, color2) \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_SET_BLEND_COLOR, 1); \
gcm_emit_at(thisContext->current, 1, color); \
gcm_finish_n_commands(thisContext->current, 2); \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_SET_BLEND_COLOR2, 1); \
gcm_emit_at(thisContext->current, 1, color2); \
gcm_finish_n_commands(thisContext->current, 2);
#define rglGcmSetVertexProgramParameterBlock(thisContext, baseConst, constCount, value) \
{ \
uint32_t blockCount, blockRemain, i; \
blockCount = (constCount * 4) >> 5; \
blockRemain = (constCount * 4) & 0x1f; \
for (i=0; i < blockCount; i++) \
{ \
uint32_t loadAt = baseConst + i * 8; \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_SET_TRANSFORM_CONSTANT_LOAD, 33); \
gcm_emit_at(thisContext->current, 1, loadAt); \
memcpy(&thisContext->current[2], value, 16 * sizeof(float)); \
memcpy(&thisContext->current[18], &value[16], 16 * sizeof(float)); \
gcm_finish_n_commands(thisContext->current, 34); \
value += 32; \
} \
if (blockRemain == 0) \
return; \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_SET_TRANSFORM_CONSTANT_LOAD, blockRemain + 1); \
gcm_emit_at(thisContext->current, 1, (baseConst + blockCount * 8)); \
gcm_finish_n_commands(thisContext->current, 2); \
blockRemain >>= 2; \
for (i=0; i < blockRemain; ++i) \
{ \
memcpy(thisContext->current, value, 4 * sizeof(float)); \
gcm_finish_n_commands(thisContext->current, 4); \
value += 4; \
} \
}
#define rglGcmSetInlineTransfer(thisContext, dstOffset, srcAdr, sizeInWords) \
{ \
uint32_t *src, *srcEnd, paddedSizeInWords; \
paddedSizeInWords = (sizeInWords + 1) & ~1; \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV3062_SET_OFFSET_DESTIN, 1); \
gcm_emit_at(thisContext->current, 1, dstOffset & ~63); \
gcm_finish_n_commands(thisContext->current, 2); \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV3062_SET_COLOR_FORMAT, 2); \
gcm_emit_at(thisContext->current, 1, CELL_GCM_TRANSFER_SURFACE_FORMAT_Y32); \
gcm_emit_at(thisContext->current, 2, ((0x1000) | ((0x1000) << 16))); \
gcm_finish_n_commands(thisContext->current, 3); \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV308A_POINT, 3); \
gcm_emit_at(thisContext->current, 1, (((0) << 16) | ((dstOffset & 63) >> 2))); \
gcm_emit_at(thisContext->current, 2, (((1) << 16) | (sizeInWords))); \
gcm_emit_at(thisContext->current, 3, (((1) << 16) | (sizeInWords))); \
gcm_finish_n_commands(thisContext->current, 4); \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV308A_COLOR, paddedSizeInWords); \
gcm_finish_n_commands(thisContext->current, 1); \
src = (uint32_t*)srcAdr; \
srcEnd = src + sizeInWords; \
while(src < srcEnd) \
{ \
gcm_emit_at(thisContext->current, 0, src[0]); \
gcm_finish_n_commands(thisContext->current, 1); \
src += 1; \
} \
if (paddedSizeInWords != sizeInWords) \
{ \
gcm_emit_at(thisContext->current, 0, 0); \
gcm_finish_n_commands(thisContext->current, 1); \
} \
}
#define rglGcmSetFragmentProgramLoad(thisContext, conf, location) \
{ \
uint32_t registerCount, texMask, texMask2D, texMaskCentroid, i; \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_SET_SHADER_PROGRAM, 1); \
gcm_emit_at(thisContext->current, 1, ((location+1) | ((conf->offset) & 0x1fffffff))); \
gcm_finish_n_commands(thisContext->current, 2); \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_SET_VERTEX_ATTRIB_OUTPUT_MASK, 1); \
gcm_emit_at(thisContext->current, 1, conf->attributeInputMask); \
gcm_finish_n_commands(thisContext->current, 2); \
texMask = conf->texCoordsInputMask; \
texMask2D = conf->texCoords2D; \
texMaskCentroid = conf->texCoordsCentroid; \
for(i = 0; texMask; i++) \
{ \
if (texMask & 1) \
{ \
gcm_emit_method_at(thisContext->current, 0, (CELL_GCM_NV4097_SET_TEX_COORD_CONTROL + (i) * 4), 1); \
gcm_emit_at(thisContext->current, 1, (texMask2D & 1) | ((texMaskCentroid & 1) << 4)); \
gcm_finish_n_commands(thisContext->current, 2); \
} \
texMask >>= 1; \
texMask2D >>= 1; \
texMaskCentroid >>= 1; \
} \
registerCount = conf->registerCount; \
if (registerCount < 2) \
registerCount = 2; \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_SET_SHADER_CONTROL, 1); \
gcm_emit_at(thisContext->current, 1, conf->fragmentControl | (registerCount << 24)); \
gcm_finish_n_commands(thisContext->current, 2); \
}
#define rglGcmSetDrawArrays(thisContext, mode, first, count) \
{ \
if ((mode) == GL_TRIANGLE_STRIP && (first) == 0 && (count) == 4) \
{ \
gcm_emit_at(thisContext->current, 0, (((3) << (18)) | CELL_GCM_NV4097_INVALIDATE_VERTEX_FILE | (0x40000000))); \
gcm_emit_at(thisContext->current, 1, 0); \
gcm_emit_at(thisContext->current, 2, 0); \
gcm_emit_at(thisContext->current, 3, 0); \
gcm_finish_n_commands(thisContext->current, 4); \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_SET_BEGIN_END, 1); \
gcm_emit_at(thisContext->current, 1, (mode)); \
gcm_finish_n_commands(thisContext->current, 2); \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_DRAW_ARRAYS, 1); \
gcm_emit_at(thisContext->current, 1, (((first)) | (3 <<24))); \
gcm_finish_n_commands(thisContext->current, 2); \
(first) += 4; \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_SET_BEGIN_END, 1); \
gcm_emit_at(thisContext->current, 1, 0); \
gcm_finish_n_commands(thisContext->current, 2); \
} \
else \
rglGcmSetDrawArraysSlow(thisContext, (mode), (first), (count)); \
}
#define rglGcmSetVertexProgramLoad(thisContext, conf, ucode) \
{ \
uint32_t *rawData, instCount, instIndex, loop, rest, i, j; \
rawData = (uint32_t*)(ucode); \
instCount = conf->instructionCount; \
instIndex = conf->instructionSlot; \
loop = instCount / 8; \
rest = (instCount % 8) * 4; \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_SET_TRANSFORM_PROGRAM_LOAD, 2); \
gcm_emit_at(thisContext->current, 1, instIndex); \
gcm_emit_at(thisContext->current, 2, instIndex); \
gcm_finish_n_commands(thisContext->current, 3); \
for (i = 0; i < loop; i++) \
{ \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_SET_TRANSFORM_PROGRAM, 32); \
memcpy(&thisContext->current[1], &rawData[0], sizeof(uint32_t)*16); \
memcpy(&thisContext->current[17], &rawData[16], sizeof(uint32_t)*16); \
gcm_finish_n_commands(thisContext->current, (1 + 32)); \
rawData += 32; \
} \
if (rest > 0) \
{ \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_SET_TRANSFORM_PROGRAM, rest); \
for (j = 0; j < rest; j++) \
gcm_emit_at(thisContext->current, j + 1, rawData[j]); \
gcm_finish_n_commands(thisContext->current, (1 + rest)); \
} \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_SET_VERTEX_ATTRIB_INPUT_MASK, 1); \
gcm_emit_at(thisContext->current, 1, conf->attributeInputMask); \
gcm_finish_n_commands(thisContext->current, 2); \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_SET_TRANSFORM_TIMEOUT, 1); \
if (conf->registerCount <= 32) \
{ \
gcm_emit_at(thisContext->current, 1, ((0xFFFF) | ((32) << 16))); \
} \
else \
{ \
gcm_emit_at(thisContext->current, 1, ((0xFFFF) | ((48) << 16))); \
} \
gcm_finish_n_commands(thisContext->current, 2); \
}
#define rglGcmFifoGlViewport(data, zNear, zFar) \
{ \
GLint clipY0, clipY1, clipX0, clipX1; \
GLfloat z_scale, z_center; \
rglGcmViewportState *vp; \
rglGcmRenderTarget *rt; \
vp = (rglGcmViewportState*)data; \
rt = (rglGcmRenderTarget*)&rglGcmState_i.renderTarget; \
clipX0 = vp->x; \
clipX1 = vp->x + vp->w; \
clipY0 = vp->y; \
clipY1 = vp->y + vp->h; \
if (rt->yInverted) \
{ \
clipY0 = rt->gcmRenderTarget.height - (vp->y + vp->h); \
clipY1 = rt->gcmRenderTarget.height - vp->y; \
} \
if (clipX0 < 0) \
clipX0 = 0; \
if (clipY0 < 0) \
clipY0 = 0; \
if (clipX1 >= CELL_GCM_MAX_RT_DIMENSION) \
clipX1 = CELL_GCM_MAX_RT_DIMENSION; \
if (clipY1 >= CELL_GCM_MAX_RT_DIMENSION) \
clipY1 = CELL_GCM_MAX_RT_DIMENSION; \
if ((clipX1 <= clipX0) || (clipY1 <= clipY0)) \
clipX0 = clipY0 = clipX1 = clipY1 = 0; \
vp->xScale = vp->w * 0.5f; \
vp->xCenter = (GLfloat)(vp->x + vp->xScale + RGLGCM_SUBPIXEL_ADJUST); \
vp->yScale = vp->h * 0.5f; \
vp->yCenter = (GLfloat)(vp->y + vp->yScale + RGLGCM_SUBPIXEL_ADJUST); \
if (rt->yInverted) \
{ \
vp->yScale = vp->h * -0.5f; \
vp->yCenter = (GLfloat)(rt->gcmRenderTarget.height - RGLGCM_VIEWPORT_EPSILON - vp->y + vp->yScale + RGLGCM_SUBPIXEL_ADJUST); \
} \
z_scale = (GLfloat)( 0.5f * ( (zFar) - (zNear) ) ); \
z_center = (GLfloat)( 0.5f * ( (zFar) + (zNear) ) ); \
float scale[4] = { vp->xScale, vp->yScale, z_scale, 0.0f}; \
float offset[4] = { vp->xCenter, vp->yCenter, z_center, 0.0f}; \
rglGcmSetViewport(thisContext, clipX0, clipY0, clipX1 - clipX0, clipY1 - clipY0, (zNear), (zFar), scale, offset ); \
}
#define rglGcmTransferData(thisContext, a,b,c,d,e,f,g,h) \
{ \
GLuint dstId = a; \
GLuint dstIdOffset = b; \
GLint dstPitch = c; \
GLuint srcId = d; \
GLuint srcIdOffset = e; \
GLint srcPitch = f; \
GLint bytesPerRow = g; \
GLint rowCount = h; \
uint32_t colCount, rows, cols; \
GLuint dstOffset, srcOffset; \
dstOffset = gmmIdToOffset(dstId) + dstIdOffset; \
srcOffset = gmmIdToOffset(srcId) + srcIdOffset; \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV0039_SET_CONTEXT_DMA_BUFFER_IN, 2); \
gcm_emit_at(thisContext->current, 1, CELL_GCM_CONTEXT_DMA_MEMORY_FRAME_BUFFER); \
gcm_emit_at(thisContext->current, 2, CELL_GCM_CONTEXT_DMA_MEMORY_FRAME_BUFFER); \
gcm_finish_n_commands(thisContext->current, 3); \
if ((srcPitch == bytesPerRow) && (dstPitch == bytesPerRow)) \
{ \
bytesPerRow *= rowCount; \
rowCount = 1; \
srcPitch = 0; \
dstPitch = 0; \
} \
while(--rowCount >= 0) \
{ \
for(colCount = bytesPerRow; colCount>0; colCount -= cols) \
{ \
cols = (colCount > CL0039_MAX_LINES) ? CL0039_MAX_LINES : colCount; \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV0039_OFFSET_IN, 8); \
gcm_emit_at(thisContext->current, 1, (srcOffset + (bytesPerRow - colCount))); \
gcm_emit_at(thisContext->current, 2, (dstOffset + (bytesPerRow - colCount))); \
gcm_emit_at(thisContext->current, 3, 0); \
gcm_emit_at(thisContext->current, 4, 0); \
gcm_emit_at(thisContext->current, 5, cols); \
gcm_emit_at(thisContext->current, 6, 1); \
gcm_emit_at(thisContext->current, 7, (((1) << 8) | (1))); \
gcm_emit_at(thisContext->current, 8, 0); \
gcm_finish_n_commands(thisContext->current, 9); \
} \
dstOffset += dstPitch; \
srcOffset += srcPitch; \
} \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV0039_OFFSET_OUT, 1); \
gcm_emit_at(thisContext->current, 1, 0); \
gcm_finish_n_commands(thisContext->current, 2); \
}
#define rglGcmSetTransferImage(thisContext, mode, dstOffset, dstPitch, dstX, dstY, srcOffset, srcPitch, srcX, srcY, width, height, bytesPerPixel) \
{ \
uint32_t srcFormat, dstFormat, x, y, finalDstX, finalDstY; \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV3062_SET_CONTEXT_DMA_IMAGE_DESTIN, 1); \
gcm_emit_at(thisContext->current, 1, CELL_GCM_CONTEXT_DMA_MEMORY_FRAME_BUFFER); \
gcm_finish_n_commands(thisContext->current, 2); \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV3089_SET_CONTEXT_DMA_IMAGE, 1); \
gcm_emit_at(thisContext->current, 1, CELL_GCM_CONTEXT_DMA_MEMORY_FRAME_BUFFER); \
gcm_finish_n_commands(thisContext->current, 2); \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV3089_SET_CONTEXT_SURFACE, 1); \
gcm_emit_at(thisContext->current, 1, 0x313371C3); \
gcm_finish_n_commands(thisContext->current, 2); \
srcFormat = 0; \
dstFormat = 0; \
switch (bytesPerPixel) \
{ \
case 2: \
srcFormat = CELL_GCM_TRANSFER_SCALE_FORMAT_R5G6B5; \
dstFormat = CELL_GCM_TRANSFER_SURFACE_FORMAT_R5G6B5; \
break; \
case 4: \
srcFormat = CELL_GCM_TRANSFER_SCALE_FORMAT_A8R8G8B8; \
dstFormat = CELL_GCM_TRANSFER_SURFACE_FORMAT_A8R8G8B8; \
break; \
} \
finalDstX = dstX + width; \
finalDstY = dstY + height; \
for (y = dstY; y < finalDstY;) \
{ \
uint32_t dstTop, dstBltHeight; \
dstTop = y & ~(BLOCKSIZE_MAX_DIMENSIONS - 1); \
dstBltHeight = (( (dstTop + BLOCKSIZE_MAX_DIMENSIONS) < finalDstY) ? (dstTop + BLOCKSIZE_MAX_DIMENSIONS) : finalDstY) - y; \
for (x = dstX; x < finalDstX;) \
{ \
uint32_t dstLeft, dstRight, dstBltWidth, dstBlockOffset, srcBlockOffset, safeDstBltWidth; \
dstLeft = x & ~(BLOCKSIZE_MAX_DIMENSIONS - 1); \
dstRight = dstLeft + BLOCKSIZE_MAX_DIMENSIONS; \
dstBltWidth = ((dstRight < finalDstX) ? dstRight : finalDstX) - x; \
dstBlockOffset = bytesPerPixel * (dstLeft & ~(BLOCKSIZE_MAX_DIMENSIONS - 1)) + dstPitch * dstTop; \
srcBlockOffset = bytesPerPixel * (srcX + x-dstX) + srcPitch * (srcY + y-dstY); \
safeDstBltWidth = (dstBltWidth < 16) ? 16 : (dstBltWidth + 1) & ~1; \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV3062_SET_OFFSET_DESTIN, 1); \
gcm_emit_at(thisContext->current, 1, dstOffset + dstBlockOffset); \
gcm_finish_n_commands(thisContext->current, 2); \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV3062_SET_COLOR_FORMAT, 2); \
gcm_emit_at(thisContext->current, 1, dstFormat); \
gcm_emit_at(thisContext->current, 2, ((dstPitch) | ((dstPitch) << 16))); \
gcm_finish_n_commands(thisContext->current, 3); \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV3089_SET_COLOR_CONVERSION, 9); \
gcm_emit_at(thisContext->current, 1, CELL_GCM_TRANSFER_CONVERSION_TRUNCATE); \
gcm_emit_at(thisContext->current, 2, srcFormat); \
gcm_emit_at(thisContext->current, 3, CELL_GCM_TRANSFER_OPERATION_SRCCOPY); \
gcm_emit_at(thisContext->current, 4, (((y - dstTop) << 16) | (x - dstLeft))); \
gcm_emit_at(thisContext->current, 5, (((dstBltHeight) << 16) | (dstBltWidth))); \
gcm_emit_at(thisContext->current, 6, (((y - dstTop) << 16) | (x - dstLeft))); \
gcm_emit_at(thisContext->current, 7, (((dstBltHeight) << 16) | (dstBltWidth))); \
gcm_emit_at(thisContext->current, 8, 1048576); \
gcm_emit_at(thisContext->current, 9, 1048576); \
gcm_finish_n_commands(thisContext->current, 10); \
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV3089_IMAGE_IN_SIZE, 4); \
gcm_emit_at(thisContext->current, 1, (((dstBltHeight) << 16) | (safeDstBltWidth))); \
gcm_emit_at(thisContext->current, 2, ((srcPitch) | ((CELL_GCM_TRANSFER_ORIGIN_CORNER) << 16) | ((CELL_GCM_TRANSFER_INTERPOLATOR_ZOH) << 24))); \
gcm_emit_at(thisContext->current, 3, (srcOffset + srcBlockOffset)); \
gcm_emit_at(thisContext->current, 4, 0); \
gcm_finish_n_commands(thisContext->current, 5); \
x += dstBltWidth; \
} \
y += dstBltHeight; \
} \
}
#endif

View File

@ -1,260 +0,0 @@
#ifndef _RGL_INLINE_H
#define _RGL_INLINE_H
#define SUBPIXEL_BITS 12
#define SUBPIXEL_ADJUST (0.5/(1<<SUBPIXEL_BITS))
#define BLOCKSIZE_MAX_DIMENSIONS 1024
#define CL0039_MIN_PITCH -32768
#define CL0039_MAX_PITCH 32767
#define CL0039_MAX_LINES 0x3fffff
#define CL0039_MAX_ROWS 0x7ff
#define RGLGCM_UTIL_LABEL_INDEX 253
#include "rgl-gcm-cmds.h"
static inline GLuint rglPlatformGetBitsPerPixel (GLenum internalFormat)
{
switch (internalFormat)
{
case RGLGCM_ALPHA16:
case RGLGCM_HILO8:
case RGLGCM_RGB5_A1_SCE:
case RGLGCM_RGB565_SCE:
return 16;
case RGLGCM_ALPHA8:
return 8;
case RGLGCM_RGBX8:
case RGLGCM_RGBA8:
case RGLGCM_ABGR8:
case RGLGCM_ARGB8:
case RGLGCM_BGRA8:
case RGLGCM_FLOAT_R32:
case RGLGCM_HILO16:
case RGLGCM_XBGR8:
return 32;
default:
return 0;
}
}
#define rglGcmSwap16Float32(fp, f) \
{ \
union SwapF32_16 \
{ \
uint32_t ui; \
float f; \
} v; \
v.f = *f; \
v.ui = (v.ui>>16) | (v.ui<<16); \
*fp = v.f; \
}
#define rglDeallocateBuffer(bufferObject, rglBuffer) \
if (rglBuffer->pool == RGLGCM_SURFACE_POOL_LINEAR) \
gmmFree( rglBuffer->bufferId ); \
rglBuffer->pool = RGLGCM_SURFACE_POOL_NONE; \
rglBuffer->bufferId = GMM_ERROR
static void rglGcmSetDrawArraysSlow(struct CellGcmContextData *thisContext, uint8_t mode,
uint32_t first, uint32_t count)
{
uint32_t lcount, i,j, loop, rest;
--count;
lcount = count & 0xff;
count >>= 8;
loop = count / CELL_GCM_MAX_METHOD_COUNT;
rest = count % CELL_GCM_MAX_METHOD_COUNT;
(thisContext->current)[0] = (((3) << (18)) | CELL_GCM_NV4097_INVALIDATE_VERTEX_FILE | (0x40000000));
gcm_emit_at(thisContext->current, 1, 0);
gcm_emit_at(thisContext->current, 2, 0);
gcm_emit_at(thisContext->current, 3, 0);
gcm_finish_n_commands(thisContext->current, 4);
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_SET_BEGIN_END, 1);
gcm_emit_at(thisContext->current, 1, mode);
gcm_finish_n_commands(thisContext->current, 2);
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_DRAW_ARRAYS, 1);
gcm_emit_at(thisContext->current, 1, ((first) | ((lcount)<<24)));
gcm_finish_n_commands(thisContext->current, 2);
first += lcount + 1;
for(i=0;i<loop;i++)
{
thisContext->current[0] = ((((2047)) << (18)) | CELL_GCM_NV4097_DRAW_ARRAYS | (0x40000000));
gcm_finish_n_commands(thisContext->current, 1);
for(j = 0; j < CELL_GCM_MAX_METHOD_COUNT; j++)
{
gcm_emit_at(thisContext->current, 0, ((first) | ((255U)<<24)));
gcm_finish_n_commands(thisContext->current, 1);
first += 256;
}
}
if(rest)
{
thisContext->current[0] = (((rest) << (18)) | CELL_GCM_NV4097_DRAW_ARRAYS | (0x40000000));
gcm_finish_n_commands(thisContext->current, 1);
for(j = 0;j < rest; j++)
{
gcm_emit_at(thisContext->current, 0, ((first) | ((255U)<<24)));
gcm_finish_n_commands(thisContext->current, 1);
first += 256;
}
}
gcm_emit_method_at(thisContext->current, 0, CELL_GCM_NV4097_SET_BEGIN_END, 1);
gcm_emit_at(thisContext->current, 1, 0);
gcm_finish_n_commands(thisContext->current, 2);
}
static inline GLuint rglGcmMapMinTextureFilter( GLenum filter )
{
switch (filter)
{
case GL_NEAREST:
return CELL_GCM_TEXTURE_NEAREST;
break;
case GL_LINEAR:
return CELL_GCM_TEXTURE_LINEAR;
break;
case GL_NEAREST_MIPMAP_NEAREST:
return CELL_GCM_TEXTURE_NEAREST_NEAREST;
break;
case GL_NEAREST_MIPMAP_LINEAR:
return CELL_GCM_TEXTURE_NEAREST_LINEAR;
break;
case GL_LINEAR_MIPMAP_NEAREST:
return CELL_GCM_TEXTURE_LINEAR_NEAREST;
break;
case GL_LINEAR_MIPMAP_LINEAR:
return CELL_GCM_TEXTURE_LINEAR_LINEAR;
break;
default:
return 0;
}
return filter;
}
static inline GLuint rglGcmMapWrapMode( GLuint mode )
{
switch ( mode )
{
case RGLGCM_CLAMP:
return CELL_GCM_TEXTURE_CLAMP;
break;
case RGLGCM_REPEAT:
return CELL_GCM_TEXTURE_WRAP;
break;
case RGLGCM_CLAMP_TO_EDGE:
return CELL_GCM_TEXTURE_CLAMP_TO_EDGE;
break;
case RGLGCM_CLAMP_TO_BORDER:
return CELL_GCM_TEXTURE_BORDER;
break;
case RGLGCM_MIRRORED_REPEAT:
return CELL_GCM_TEXTURE_MIRROR;
break;
case RGLGCM_MIRROR_CLAMP_TO_EDGE:
return CELL_GCM_TEXTURE_MIRROR_ONCE_CLAMP_TO_EDGE;
break;
case RGLGCM_MIRROR_CLAMP_TO_BORDER:
return CELL_GCM_TEXTURE_MIRROR_ONCE_BORDER;
break;
case RGLGCM_MIRROR_CLAMP:
return CELL_GCM_TEXTURE_MIRROR_ONCE_CLAMP;
break;
default:
return 0;
break;
}
return 0;
}
// Fast conversion for values between 0.0 and 65535.0
static inline GLuint RGLGCM_QUICK_FLOAT2UINT (const GLfloat f)
{
union
{
GLfloat f;
GLuint ui;
} t;
t.f = f + RGLGCM_F0_DOT_0;
return t.ui & 0xffff;
}
// construct a packed unsigned int ARGB8 color
static inline void RGLGCM_CALC_COLOR_LE_ARGB8( GLuint *color0, const GLfloat r,
const GLfloat g, const GLfloat b, const GLfloat a )
{
GLuint r2, g2, b2, a2;
r2 = RGLGCM_QUICK_FLOAT2UINT( r * 255.0f );
g2 = RGLGCM_QUICK_FLOAT2UINT( g * 255.0f );
b2 = RGLGCM_QUICK_FLOAT2UINT( b * 255.0f );
a2 = RGLGCM_QUICK_FLOAT2UINT( a * 255.0f );
*color0 = ( a2 << 24 ) | ( r2 << 16 ) | ( g2 << 8 ) | ( b2 << 0 );
}
// Utility to let RSX wait for complete RSX pipeline idle
static inline void rglGcmUtilWaitForIdle (void)
{
CellGcmContextData *thisContext = (CellGcmContextData*)gCellGcmCurrentContext;
// set write label command in push buffer, and wait
// NOTE: this is for RSX to wailt
rglGcmSetWriteBackEndLabel(thisContext, RGLGCM_UTIL_LABEL_INDEX, rglGcmState_i.labelValue );
rglGcmSetWaitLabel(thisContext, RGLGCM_UTIL_LABEL_INDEX, rglGcmState_i.labelValue);
// increment label value for next time.
rglGcmState_i.labelValue++;
// make sure the entire pipe in clear not just the front end
// Utility function that does GPU 'finish'.
rglGcmSetWriteBackEndLabel(thisContext, RGLGCM_UTIL_LABEL_INDEX, rglGcmState_i.labelValue );
rglGcmFlush(gCellGcmCurrentContext);
while( *(cellGcmGetLabelAddress( RGLGCM_UTIL_LABEL_INDEX)) != rglGcmState_i.labelValue);
rglGcmState_i.labelValue++;
}
// Prints out an int in hexedecimal and binary, broken into bytes.
// Can be used for printing out macro and constant values.
// example: rglPrintIt( RGLGCM_3DCONST(SET_SURFACE_FORMAT, COLOR, LE_A8R8G8B8) );
// 00 00 00 08 : 00000000 00000000 00000000 00001000 */
static inline void rglPrintIt (unsigned int v)
{
// HEX (space between bytes)
printf( "%02x %02x %02x %02x : ", ( v >> 24 )&0xff, ( v >> 16 )&0xff, ( v >> 8 )&0xff, v&0xff );
// BINARY (space between bytes)
for ( unsigned int mask = ( 0x1 << 31 ), i = 1; mask != 0; mask >>= 1, i++ )
printf( "%d%s", ( v & mask ) ? 1 : 0, ( i % 8 == 0 ) ? " " : "" );
printf( "\n" );
}
// prints the last numWords of the command fifo
static inline void rglPrintFifoFromPut( unsigned int numWords )
{
for ( int i = -numWords; i <= -1; i++ )
rglPrintIt((( uint32_t* )rglGcmState_i.fifo.ctx.current )[i] );
}
// prints the last numWords of the command fifo
static inline void rglPrintFifoFromGet( unsigned int numWords )
{
for ( int i = -numWords; i <= -1; i++ )
rglPrintIt((( uint32_t* )rglGcmState_i.fifo.lastGetRead )[i] );
}
#endif

View File

@ -1,371 +0,0 @@
#ifndef _RGL_TYPEDEFS_H
#define _RGL_TYPEDEFS_H
#include "../include/export/PSGL/psgl.h"
#include "../include/PSGL/Types.h"
typedef struct rglGcmRenderTargetEx rglGcmRenderTargetEx;
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; // In 10K Hertz
GLushort wHSyncPolarity;
GLushort wVSyncPolarity;
} MODESTRUC;
// descriptor for 2D data
typedef struct
{
GLenum source; // device, texture, renderbuffer
GLuint width, height;
GLuint bpp; // bytes per pixel, derived from format
GLuint pitch; // 0 if swizzled
rglGcmEnum format; // e.g. RGLGCM_ARGB8
GLenum pool; // type of memory
GLuint dataId; // id to get address and offset
GLuint dataIdOffset;
} rglGcmSurface;
typedef struct
{
// TODO: get rid of this member
rglGcmRenderTargetEx rt;
// framebuffers
rglGcmSurface color[3];
// double/triple buffering management
GLuint drawBuffer; // 0, 1, or 2
GLuint scanBuffer; // 0, 1, or 2
// resc buffers
GLuint RescColorBuffersId;
GLuint RescVertexArrayId;
GLuint RescFragmentShaderId;
const MODESTRUC *ms;
GLboolean vsync;
GLboolean skipFirstVsync;
GLenum deviceType;
GLenum TVStandard;
GLenum TVFormat;
GLuint swapFifoRef;
GLuint swapFifoRef2; // Added for supporting Triple buffering [RSTENSON]
GLboolean setOffset;
GLboolean signal;
GLuint semaValue;
unsigned int syncMethod;
} rglGcmDevice;
typedef struct rglGcmDriver_
{
rglGcmRenderTargetEx rt;
GLboolean rtValid;
GLboolean invalidateVertexCache;
int xSuperSampling; // supersampling factor in X
int ySuperSampling; // supersampling factor in Y
GLuint flushBufferCount; // # of mapped buffer objects in bounce buffer
GLuint fpLoadProgramId; // address of the currently bound fragment program
GLuint fpLoadProgramOffset;
GLuint sharedFPConstantsId;
char *sharedVPConstants;
} rglGcmDriver;
typedef struct
{
GLuint SET_TEXTURE_CONTROL3; // pitch and depth
GLuint SET_TEXTURE_OFFSET; // gpu addr (from dma ctx)
GLuint SET_TEXTURE_FORMAT; // which dma ctx, [123]D, border source, mem layout, mip levels
GLuint SET_TEXTURE_ADDRESS; // wrap, signed and unsigned remap control, gamma, zfunc
GLuint SET_TEXTURE_CONTROL0; // enable, lod clamp, aniso, image field, alpha kill, colorkey
GLuint SET_TEXTURE_CONTROL1; // remap and crossbar setup.
GLuint SET_TEXTURE_FILTER; // lod bias, convol filter, min/mag filter, component signedness
GLuint SET_TEXTURE_IMAGE_RECT; // texture width/height
} rglGcmTextureMethods;
// Gcm Specific function parameter mappings.
// for cellGcmSetControl
struct rglGcmTextureControl0
{
GLuint minLOD;
GLuint maxLOD;
GLuint maxAniso;
};
// for cellGcmSetAddress
struct rglGcmTextureAddress
{
GLuint wrapS;
GLuint wrapT;
GLuint wrapR;
GLuint unsignedRemap;
GLuint zfunc;
GLuint gamma;
};
// for cellGcmSetTextureFilter
struct rglGcmTextureFilter
{
GLuint min;
GLuint mag;
GLuint conv;
GLint bias;
};
// Structure to contain Gcm Function Parameters for setting later.
// Control1 and Control3 will be set by cellGcmSetTexture
struct rglGcmTextureMethodParams
{
rglGcmTextureControl0 control0;
rglGcmTextureAddress address;
rglGcmTextureFilter filter;
GLuint borderColor; // texture border color
};
typedef struct
{
// These are enough to describe the GPU format
GLuint faces;
GLuint levels;
GLuint baseWidth;
GLuint baseHeight;
GLuint baseDepth;
rglGcmEnum internalFormat;
GLuint pixelBits;
GLuint pitch;
} rglGcmTextureLayout;
// GCM texture data structure
typedef struct
{
GLenum pool;
rglGcmTextureMethods methods; // [RSTENSON] soon to be legacy
rglGcmTextureMethodParams gcmMethods;
CellGcmTexture gcmTexture;
GLuint gpuAddressId;
GLuint gpuAddressIdOffset;
GLuint gpuSize;
rglGcmTextureLayout gpuLayout;
} rglGcmTexture;
/* pio flow control data structure */
typedef volatile struct
{
GLuint Ignored00[0x010];
GLuint Put; /* put offset, write only 0040-0043*/
GLuint Get; /* get offset, read only 0044-0047*/
GLuint Reference; /* reference value, read only 0048-004b*/
GLuint Ignored01[0x1];
GLuint SetReference; /* set reference value 0050-0053*/
GLuint TopLevelGet; /* top level get offset, read only 0054-0057*/
GLuint Ignored02[0x2];
GLuint SetContextDmaSemaphore; /* set sema ctxdma, write only 0060-0063*/
GLuint SetSemaphoreOffset; /* set sema offset, write only 0064-0067*/
GLuint SetSemaphoreAcquire; /* set sema acquire, write only 0068-006b*/
GLuint SetSemaphoreRelease; /* set sema release, write only 006c-006f*/
GLuint Ignored03[0x7e4];
} rglGcmControlDma;
// _only_ update lastGetRead if the Get is in our pushbuffer
#define fifoUpdateGetLastRead(fifo) \
uint32_t* tmp = (uint32_t*)(( char* )fifo->dmaPushBufferBegin - fifo->dmaPushBufferOffset + ( *(( volatile GLuint* )&fifo->dmaControl->Get))); \
if ((tmp >= fifo->ctx.begin) && (tmp <= fifo->ctx.end)) \
fifo->lastGetRead = tmp;
// all fifo related data is kept here
struct rglGcmFifo
{
CellGcmContextData ctx;
// dmaControl for allocated channel
rglGcmControlDma *dmaControl;
// for storing the start of the push buffer
// begin will be moving around
uint32_t *dmaPushBufferBegin;
uint32_t *dmaPushBufferEnd;
// Fifo block size
GLuint fifoBlockSize;
// pushbuffer location etc.
// members around here were moved up
unsigned long dmaPushBufferOffset;
GLuint dmaPushBufferSizeInWords;
// the last Put value we wrote
uint32_t *lastPutWritten;
// the last Get value we know of
uint32_t *lastGetRead;
// cached value of last reference write
GLuint lastSWReferenceWritten;
// cached value of lastSWReferenceWritten at most
// recent fifo flush
GLuint lastSWReferenceFlushed;
// cached value of last reference read
GLuint lastHWReferenceRead;
uint32_t *dmaPushBufferGPU;
int spuid;
};
// 16 byte aligned semaphores
struct rglGcmSemaphore
{
GLuint val;
GLuint pad0;
GLuint pad1;
GLuint pad2;
};
// semaphore storage
struct rglGcmSemaphoreMemory
{
rglGcmSemaphore userSemaphores[RGLGCM_MAX_USER_SEMAPHORES];
};
struct rglGcmResource
{
char *localAddress;
GLuint localSize;
GLuint MemoryClock;
GLuint GraphicsClock;
char * linearMemory;
unsigned int persistentMemorySize;
// host memory window the gpu can access
char * hostMemoryBase;
GLuint hostMemorySize;
// offset of dmaPushBuffer relative to its DMA CONTEXT
unsigned long dmaPushBufferOffset;
char * dmaPushBuffer;
GLuint dmaPushBufferSize;
void* dmaControl;
// semaphores
rglGcmSemaphoreMemory *semaphores;
};
typedef struct
{
GLenum pool; // LINEAR, or NONE
unsigned int bufferId; // allocated Id
unsigned int bufferSize;
unsigned int pitch;
GLuint mapCount; // map reference count
GLenum mapAccess; // READ_ONLY, WRITE_ONLY, or READ_WRITE
}
rglGcmBufferObject;
typedef struct rglGcmShader_
{
GLuint loadAddressId;
CgBinaryProgram __attribute__(( aligned( 16 ) ) ) program;
} rglGcmShader;
// the current rendering surface/target
typedef struct rglGcmRenderTarget rglGcmRenderTarget;
struct rglGcmRenderTarget
{
GLuint colorFormat;
GLuint colorBufferCount;
// (0,0) is in the lower left
GLuint yInverted;
// gcm render target structure [RSTENSON]
CellGcmSurface gcmRenderTarget;
};
// cached state: viewport
typedef struct rglGcmViewportState rglGcmViewportState;
struct rglGcmViewportState
{
// user values given as input to glViewport
GLint x, y, w, h;
// from glViewport
GLfloat xScale, xCenter;
GLfloat yScale, yCenter;
};
// cached state: blend
typedef struct rglGcmBlendState rglGcmBlendState;
struct rglGcmBlendState
{
// current blend color
GLfloat r, g, b, a;
// alpha blend reference
GLuint alphaFunc;
GLfloat alphaRef;
};
typedef struct rglGcmInterpolantState rglGcmInterpolantState;
struct rglGcmInterpolantState
{
// mask of inputs used by programs
// Uses bits from SET_VERTEX_ATTRIB_OUTPUT_MASK.
GLuint vertexProgramAttribMask;
GLuint fragmentProgramAttribMask;
};
// cached state (because no dedecated method exist)
typedef struct rglGcmCachedState rglGcmCachedState;
struct rglGcmCachedState
{
// we need to track blending color, too
rglGcmBlendState blend;
// need to cache viewport values, because of yInverted
rglGcmViewportState viewport;
// all interpolants are enabled/disabled with a single mask
rglGcmInterpolantState interpolant;
};
// ** the master instance representing a channel/context **
struct rglGcmState
{
char *localAddress;
// host memory window the gpu can access
void *hostMemoryBase;
GLuint hostMemorySize;
// semaphores
rglGcmSemaphoreMemory *semaphores;
// -- context state --
rglGcmFifo fifo;
rglGcmRenderTarget renderTarget;
rglGcmCachedState state;
CellGcmConfig config;
GLuint labelValue;
};
extern rglGcmState rglGcmState_i;
#endif

View File

@ -1,250 +0,0 @@
#ifndef ELF_H
#define ELF_H
/*
* ELF header
*/
/* e_ident[] Identification Indexes */
#define EI_MAG0 0 /* File identification */
#define EI_MAG1 1 /* File identification */
#define EI_MAG2 2 /* File identification */
#define EI_MAG3 3 /* File identification */
#define EI_CLASS 4 /* File class */
#define EI_DATA 5 /* Data encoding */
#define EI_VERSION 6 /* File version */
#define EI_OSABI 7 /* Operating system/ABI identification */
#define EI_ABIVERSION 8 /* ABI version */
#define EI_PAD 9 /* Start of padding bytes */
#define EI_NIDENT 16 /* Size of e_ident[] */
/* e_ident[EI_MAG0] to e_ident[EI_MAG3] */
#define ELFMAG0 0x7f /* e_ident[EI_MAG0] */
#define ELFMAG1 'E' /* e_ident[EI_MAG1] */
#define ELFMAG2 'L' /* e_ident[EI_MAG2] */
#define ELFMAG3 'F' /* e_ident[EI_MAG3] */
/* e_ident[EI_CLASS] */
#define ELFCLASSNONE 0 /* Invalid class */
#define ELFCLASS32 1 /* 32-bit objects */
#define ELFCLASS64 2 /* 64-bit objects */
/* e_ident[EI_DATA] */
#define ELFDATANONE 0 /* Invalid data encoding */
#define ELFDATA2LSB 1 /* little endian */
#define ELFDATA2MSB 2 /* big endian */
/* e_ident[EI_VERSION] */
#define EV_NONE 0 /* Invalid version */
#define EV_CURRENT 1 /* Current version */
/* e_type */
#define ET_NONE 0 /* No file type */
#define ET_REL 1 /* Relocatable file */
#define ET_EXEC 2 /* Executable file */
#define ET_DYN 3 /* Shared object file */
#define ET_CORE 4 /* Core file */
/* e_machine */
#define EM_PPC 20 /* PowerPC 32-bit */
#define EM_PPC64 21 /* PowerPC 64-bit */
typedef struct {
unsigned char e_ident[EI_NIDENT];
uint16_t e_type;
uint16_t e_machine;
uint32_t e_version;
uint32_t e_entry;
int32_t e_phoff;
int32_t e_shoff;
uint32_t e_flags;
uint16_t e_ehsize;
uint16_t e_phentsize;
uint16_t e_phnum;
uint16_t e_shentsize;
uint16_t e_shnum;
uint16_t e_shstrndx;
} Elf32_Ehdr;
typedef struct {
unsigned char e_ident[EI_NIDENT];
uint16_t e_type;
uint16_t e_machine;
uint32_t e_version;
uint64_t e_entry;
uint64_t e_phoff;
uint64_t e_shoff;
uint32_t e_flags;
uint16_t e_ehsize;
uint16_t e_phentsize;
uint16_t e_phnum;
uint16_t e_shentsize;
uint16_t e_shnum;
uint16_t e_shstrndx;
} Elf64_Ehdr;
/*
* Program Header
*/
/* Segment Types, p_type */
#define PT_NULL 0
#define PT_LOAD 1
#define PT_DYNAMIC 2
#define PT_INTERP 3
#define PT_NOTE 4
#define PT_SHLIB 5
#define PT_PHDR 6
#define PT_LOOS 0x60000000
#define PT_HIOS 0x6fffffff
#define PT_LOPROC 0x70000000
#define PT_HIPROC 0x7fffffff
typedef struct {
uint32_t p_type;
int32_t p_offset;
uint32_t p_vaddr;
uint32_t p_paddr;
uint32_t p_filesz;
uint32_t p_memsz;
uint32_t p_flags;
uint32_t p_align;
} Elf32_Phdr;
typedef struct {
uint32_t p_type;
uint32_t p_flags;
uint64_t p_offset;
uint64_t p_vaddr;
uint64_t p_paddr;
uint64_t p_filesz;
uint64_t p_memsz;
uint64_t p_align;
} Elf64_Phdr;
/*
* Section Header
*/
/* sh_type */
#define SHT_NULL 0 /* Section header table entry unused */
#define SHT_PROGBITS 1 /* Program data */
#define SHT_SYMTAB 2 /* Symbol table */
#define SHT_STRTAB 3 /* String table */
#define SHT_RELA 4 /* Relocation entries with addends */
#define SHT_HASH 5 /* Symbol hash table */
#define SHT_DYNAMIC 6 /* Dynamic linking information */
#define SHT_NOTE 7 /* Notes */
#define SHT_NOBITS 8 /* Program space with no data (bss) */
#define SHT_REL 9 /* Relocation entries, no addends */
#define SHT_SHLIB 10 /* Reserved */
#define SHT_DYNSYM 11 /* Dynamic linker symbol table */
#define SHF_WRITE (1 << 0) /* Writable */
#define SHF_ALLOC (1 << 1) /* Occupies memory during execution */
#define SHF_EXECINSTR (1 << 2) /* Executable */
#define SHF_MERGE (1 << 4) /* Might be merged */
#define SHF_STRINGS (1 << 5) /* Contains nul-terminated strings */
#define SHF_INFO_LINK (1 << 6) /* `sh_info' contains SHT index */
#define SHF_LINK_ORDER (1 << 7) /* Preserve order after combining */
#define SHF_OS_NONCONFORMING (1 << 8) /* Non-standard OS specific handling
required */
#define SHF_MASKOS 0x0ff00000 /* OS-specific. */
#define SHF_MASKPROC 0xf0000000 /* Processor-specific */
typedef struct {
uint32_t sh_name;
uint32_t sh_type;
uint32_t sh_flags;
uint32_t sh_addr;
int32_t sh_offset;
uint32_t sh_size;
uint32_t sh_link;
uint32_t sh_info;
uint32_t sh_addralign;
uint32_t sh_entsize;
} Elf32_Shdr;
/* Special section indices. */
#define SHN_UNDEF 0 /* Undefined section */
#define SHN_LORESERVE 0xff00 /* Start of reserved indices */
#define SHN_LOPROC 0xff00 /* Start of processor-specific */
#define SHN_HIPROC 0xff1f /* End of processor-specific */
#define SHN_LOOS 0xff20 /* Start of OS-specific */
#define SHN_HIOS 0xff3f /* End of OS-specific */
#define SHN_ABS 0xfff1 /* Associated symbol is absolute */
#ifndef SHN_COMMON
#define SHN_COMMON 0xfff2 /* Associated symbol is common */
#endif
#ifndef SHN_XINDEX
#define SHN_XINDEX 0xffff /* Index is in extra table. */
#endif
#ifndef SHN_HIRESERVE
#define SHN_HIRESERVE 0xffff /* End of reserved indices */
#endif
/*
* Symbol Header
*/
typedef struct {
uint32_t st_name;
uint32_t st_value;
uint32_t st_size;
unsigned char st_info;
unsigned char st_other;
uint16_t st_shndx;
} Elf32_Sym;
/* Relocation table entry without addend (in section of type SHT_REL). */
typedef struct
{
uint32_t r_offset; /* Address */
uint32_t r_info; /* Relocation type and symbol index */
} Elf32_Rel;
/* I have seen two different definitions of the Elf64_Rel and
Elf64_Rela structures, so we'll leave them out until Novell (or
whoever) gets their act together. */
/* The following, at least, is used on Sparc v9, MIPS, and Alpha. */
typedef struct
{
uint64_t r_offset; /* Address */
uint64_t r_info; /* Relocation type and symbol index */
} Elf64_Rel;
/* Relocation table entry with addend (in section of type SHT_RELA). */
typedef struct
{
uint32_t r_offset; /* Address */
uint32_t r_info; /* Relocation type and symbol index */
int32_t r_addend; /* Addend */
} Elf32_Rela;
typedef struct
{
uint64_t r_offset; /* Address */
uint64_t r_info; /* Relocation type and symbol index */
int64_t r_addend; /* Addend */
} Elf64_Rela;
/* How to extract and insert information held in the r_info field. */
#define ELF32_R_SYM(val) ((val) >> 8)
#define ELF32_R_TYPE(val) ((val) & 0xff)
#define ELF32_R_INFO(sym, type) (((sym) << 8) + ((type) & 0xff))
#define ELF64_R_SYM(i) ((i) >> 32)
#define ELF64_R_TYPE(i) ((i) & 0xffffffff)
#define ELF64_R_INFO(sym,type)((((uint64_t) (sym)) << 32) + (type))
#endif /* ELF_H */

View File

@ -1,125 +0,0 @@
/*
* Spu simulator library - ELF reader.
* AUTHORS: Antoine Labour, Robin Green
* DATE: 2003-Oct-16
*/
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include "readelf.h"
const Elf32_Sym *getSymbolByIndex(const ELF_t *elf,int idx)
{
if(!elf)
return NULL;
if(elf->symbolsSection<=0)
return NULL;
ELF_section_t *section=elf->sections+elf->symbolsSection;
if(!section->data)
return NULL;
if ((idx<0) || (idx>=(int)elf->symbolCount))
return NULL;
return(Elf32_Sym *)(section->data+section->header.sh_entsize*idx);
}
int lookupSymbol(const ELF_t *elf,const char *name)
{
unsigned int i;
if(!elf||!name)
return -1;
ELF_symbol_t *symbol=elf->symbols;
if(!symbol)
return -1;
for (i = 0; i < elf->symbolCount; ++i, ++symbol)
if (strcmp(name,symbol->name)==0)
return i;
return -1;
}
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 *findSectionInPlace(const char* memory, const char *name, size_t *sectionSize)
{
const Elf32_Ehdr *ehdr = (const Elf32_Ehdr*)memory;
//first get the string section header
const char *shstrtab = _getStringTable(ehdr);
//find the section
size_t sectionCount = ehdr->e_shnum;
const char *sectionHeaderStart = (const char*)ehdr + ehdr->e_shoff;
for (size_t i=0;i<sectionCount;i++)
{
const Elf32_Shdr *sectionHeader = (const Elf32_Shdr *)sectionHeaderStart + i;
const char *sectionName = shstrtab + sectionHeader->sh_name;
if (!strcmp(name,sectionName))
{
*sectionSize = sectionHeader->sh_size;
return (const char*)ehdr + sectionHeader->sh_offset;
}
}
return NULL;
}
const char *findSymbolSectionInPlace(const char *memory, size_t *symbolSize, size_t *symbolCount, const char **symbolstrtab)
{
const Elf32_Ehdr *ehdr = (const Elf32_Ehdr*)memory;
//find the section
size_t sectionCount = ehdr->e_shnum;
const char *sectionHeaderStart = (const char*)ehdr + ehdr->e_shoff;
for (size_t i = 0; i < sectionCount; i++)
{
const Elf32_Shdr *sectionHeader = (const Elf32_Shdr *)sectionHeaderStart + i;
if (sectionHeader->sh_type == SHT_SYMTAB)
{
*symbolSize = sectionHeader->sh_entsize;
*symbolCount = sectionHeader->sh_size / sectionHeader->sh_entsize;
const Elf32_Shdr *symbolStrHeader = (const Elf32_Shdr *)sectionHeaderStart + sectionHeader->sh_link;
*symbolstrtab = (const char*)ehdr + symbolStrHeader->sh_offset;
return (const char*)ehdr + sectionHeader->sh_offset;
}
}
return NULL;
}
int lookupSymbolValueInPlace(const char* symbolSection, size_t symbolSize, size_t symbolCount, const char *symbolstrtab, const char *name)
{
for (size_t i=0;i<symbolCount;i++)
{
Elf32_Sym* elf_sym = (Elf32_Sym*)symbolSection;
if (!strcmp(symbolstrtab + elf_sym->st_name, name))
return elf_sym->st_value;
symbolSection+= symbolSize;
}
return -1;
}
const char *getSymbolByIndexInPlace(const char* symbolSection, size_t symbolSize, size_t symbolCount, const char *symbolstrtab, int index)
{
Elf32_Sym* elf_sym = (Elf32_Sym*)symbolSection + index;
return symbolstrtab + elf_sym->st_name;
}

View File

@ -1,91 +0,0 @@
#ifndef READELF_H
#define READELF_H
#include "elf.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _ELF_section_t
{
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;
} ELF_segment_t;
typedef struct
{
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;
} ELF_t;
typedef struct
{
unsigned int relative;
unsigned int shift;
unsigned int size;
unsigned int position;
unsigned int mask;
} ELF_rel_type_t;
ELF_t* readElfFromFile(const char* filename);
ELF_t* readElfFromMemory(const char* memory,unsigned int size);
ELF_section_t* findSection(const ELF_t* elf,const char* name);
int lookupSymbol(const ELF_t* elf,const char* name);
int lookupResolvedSymbol(const ELF_t* elf,const char* name);
const Elf32_Sym* getSymbolByIndex(const ELF_t* elf,int idx);
int resolveElf(ELF_t* main_elf,ELF_t* elf);
int relocateSymbols(ELF_t* elf,unsigned int origin);
int loadSectionsToMemory(ELF_t* elf,char* memory,int memorySize,unsigned int origin);
void doRelocations(ELF_t* elf,char* memory,int memorySize,int origin,const ELF_rel_type_t* rel_types,unsigned int rel_types_count);
int loadElfToMemory(unsigned char* memory, unsigned int size, unsigned int load_address, ELF_t* elf);
void freeElf(ELF_t* elf);
//in place API
const char *findSectionInPlace(const char* memory, const char *name,size_t *sectionSize);
const char *findSymbolSectionInPlace(const char *memory, 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);
void spuDoRelocations(ELF_t* elf,char* memory,int memorySize,int origin);
uint16_t endian_half(int endian, uint16_t v);
uint32_t endian_word(int endian, uint32_t v);
#define endian_addr(e, v) endian_word(e, v)
#define endian_off(e, v) endian_word(e, v)
#define endian_size(e, v) endian_half(e, v)
#ifdef __cplusplus
}
#endif
#endif // READELF_H

View File

@ -1,63 +0,0 @@
/* RetroArch - A frontend for libretro.
* RGL - An OpenGL subset wrapper library.
* Copyright (C) 2012 - Hans-Kristian Arntzen
* Copyright (C) 2012 - Daniel De Matteis
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _RGL_H
#define _RGL_H
#include "../include/export/PSGL/psgl.h"
#include "../include/PSGL/Types.h"
#include "../include/PSGL/TypeUtils.h"
#include "../include/PSGL/private.h"
#include "../include/PSGL/Utils.h"
#include <string.h>
#include <math.h>
#include <limits.h>
#include <Cg/CgCommon.h>
// endian swapping of the fragment uniforms, if necessary
#define SWAP_IF_BIG_ENDIAN(arg) endianSwapWordByHalf(arg)
#ifdef __cplusplus
extern "C" {
#endif
void rglPsglPlatformInit (void *data);
void rglPsglPlatformExit (void);
RGL_EXPORT RGLdevice* rglPlatformCreateDeviceAuto( GLenum colorFormat, GLenum depthFormat, GLenum multisamplingMode );
RGL_EXPORT RGLdevice* rglPlatformCreateDeviceExtended (const void *data);
RGL_EXPORT GLfloat rglPlatformGetDeviceAspectRatio (const void *data);
GLboolean rglPlatformBufferObjectUnmapTextureReference (void *data);
GLboolean rglpCreateBufferObject (void *data);
GLboolean rglGcmFifoReferenceInUse (void *data, GLuint reference);
GLuint rglGcmFifoPutReference (void *data);
void rglGcmGetTileRegionInfo (void *data, GLuint *address, GLuint *size);
GLboolean rglGcmTryResizeTileRegion( GLuint address, GLuint size, void *data);
int32_t rglOutOfSpaceCallback (void *data, uint32_t spaceInWords);
void rglGcmFifoGlSetRenderTarget (const void *args);
void rglCreatePushBuffer (void *data);
void rglGcmFreeTiledSurface (GLuint bufferId);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,78 +0,0 @@
#ifndef _RGL_CG_H
#define _RGL_CG_H
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <Cg/cg.h>
#include <Cg/cgGL.h>
#include <Cg/CgCommon.h>
#include <Cg/cgBinary.h>
#include <Cg/CgInternal.h>
#include <Cg/CgProgramGroup.h>
#include <Cg/cgc.h>
#include "../include/export/PSGL/psgl.h"
#include "../include/PSGL/private.h"
#include "../include/PSGL/Types.h"
#include "../include/PSGL/Utils.h"
#include "libelf/readelf.h"
#include "cg/cgbtypes.h"
#include "cg/cgnv2rt.h"
#include "cg/cgbio.hpp"
#include "cg/nvbiimpl.hpp"
#include "cg/cgbutils.hpp"
#include "cg/cgbtypes.h"
typedef struct
{
const char* elfFile;
size_t elfFileSize;
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;
typedef struct
{
const char *texttab;
size_t texttabSize;
const char *paramtab;
size_t paramtabSize;
int index;
} CGELFProgram;
extern int rglpCopyProgram (void *src_data, void *dst_data);
extern int rglpGenerateFragmentProgram (void *data,
const CgProgramHeader *programHeader, const void *ucode,
const CgParameterTableHeader *parameterHeader,
const char *stringTable, const float *defaultValues );
extern int rglpGenerateVertexProgram (void *data,
const CgProgramHeader *programHeader, const void *ucode,
const CgParameterTableHeader *parameterHeader, const char *stringTable,
const float *defaultValues );
extern CGprogram rglpCgUpdateProgramAtIndex( CGprogramGroup group, int index,
int refcount );
extern void rglpProgramErase (void *data);
extern bool cgOpenElf( const void *ptr, size_t size, CGELFBinary *elfBinary );
extern bool cgGetElfProgramByIndex( CGELFBinary *elfBinary, int index, CGELFProgram *elfProgram );
extern CGprogram rglCgCreateProgram( CGcontext ctx, CGprofile profile, const CgProgramHeader *programHeader, const void *ucode, const CgParameterTableHeader *parameterHeader, const char *stringTable, const float *defaultValues );
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff