(RGL PS3) Cleanups

This commit is contained in:
twinaphex 2014-02-19 01:13:39 +01:00
parent 32604f0aa3
commit d836be0273
8 changed files with 331 additions and 367 deletions

View File

@ -20,7 +20,7 @@ extern "C" {
#define RGL_BOOLEAN_REGISTERS_COUNT 32
// parameter setter, prototype of functions called when a uniform is set.
typedef void(*_cgSetFunction) (void *, const void* _RGL_RESTRICT);
typedef void(*_cgSetFunction) (void *, const void*);
typedef void(*_cgSetArrayIndexFunction) (void *, const void*, const int index);
typedef struct _CgUniform

View File

@ -6,45 +6,44 @@
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)
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()
{
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 )
if (array)
{
unsigned int index = i - 1;
( array + index )->~T();
--count;
if ( count > index )
memmove( array + index, array + index + 1, ( count - index )*sizeof( T ) );
return;
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;
}
}
}
}
};
}

View File

@ -18,11 +18,7 @@
#define RGLGCM_BIG_ENDIAN
#if RGL_ENDIAN == RGL_BIG_ENDIAN
#define ENDIAN_32(X, F) ((F) ? endianSwapWord(X) : (X))
#else
#define ENDIAN_32(X, F) (X)
#endif
#define FRAGMENT_PROFILE_INDEX 1
#define RGLP_MAX_TEXTURE_SIZE 4096
@ -36,6 +32,9 @@
#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)
@ -457,198 +456,194 @@ extern "C" {
#define RGLBIT_FALSE(f,n) ((f) &= ~(1<<(n)))
#define RGLBIT_ASSIGN(f,n,val) do { if(val) RGLBIT_TRUE(f,n); else RGLBIT_FALSE(f,n); } while(0)
#define ALIGN16 __attribute__((aligned (16)))
#define _RGL_RESTRICT __restrict
typedef struct
{
GLfloat R, G, B, A;
} rglColorRGBAf;
typedef struct
{
GLfloat R, G, B, A;
} rglColorRGBAf;
typedef struct
{
int X, Y, XSize, YSize;
} rglViewPort;
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 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;
// 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;
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.
// 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
// 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;
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;
// 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;
typedef struct rglBufferObject rglBufferObject;
// Texture data structure
typedef struct
{
GLuint revalidate;
GLuint target;
// 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;
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;
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;
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;
rglBufferObject *referenceBuffer;
intptr_t offset;
RGL::Vector<rglFramebuffer *> framebuffers;
RGL::Vector<rglFramebuffer *> framebuffers;
GLuint imageCount;
rglImage* image;
void * platformTexture[]; // C99 flexible array member
} rglTexture;
GLuint imageCount;
rglImage* image;
void * platformTexture[]; // C99 flexible array member
} rglTexture;
typedef struct
{
GLboolean isSet;
void* platformFenceObject[];
} rglFenceObject;
typedef struct
{
GLboolean isSet;
void* platformFenceObject[];
} rglFenceObject;
// For now, we'll use a static array for lights
//
// For now, we'll use a static array for lights
//
// Texture image unit data structure
typedef struct
{
GLuint bound2D;
// Texture image unit data structure
typedef struct
{
GLuint bound2D;
rglTexture* default2D;
rglTexture* default2D;
GLboolean enable2D;
GLboolean enable2D;
// the current fragment program's target for this unit, if in use.
// this is invalid otherwise
GLenum fragmentTarget;
GLfloat lodBias;
// the current fragment program's target for this unit, if in use.
// this is invalid otherwise
GLenum fragmentTarget;
GLfloat lodBias;
rglTexture* currentTexture;
} rglTextureImageUnit;
rglTexture* currentTexture;
} rglTextureImageUnit;
enum
{
RGL_FRAMEBUFFER_ATTACHMENT_NONE,
RGL_FRAMEBUFFER_ATTACHMENT_RENDERBUFFER,
RGL_FRAMEBUFFER_ATTACHMENT_TEXTURE,
};
enum
{
RGL_FRAMEBUFFER_ATTACHMENT_NONE,
RGL_FRAMEBUFFER_ATTACHMENT_RENDERBUFFER,
RGL_FRAMEBUFFER_ATTACHMENT_TEXTURE,
};
struct RGLdevice
{
PSGLdeviceParameters deviceParameters;
struct RGLdevice
{
PSGLdeviceParameters deviceParameters;
GLvoid* rasterDriver;
char platformDevice[]; // C99 flexible array member
};
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;
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 (set by rglPlatformRequiresSlowPath):
// 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;
// internal draw parameters (set by rglPlatformRequiresSlowPath):
// 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 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
@ -666,161 +661,154 @@ extern "C" {
#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;
} ALIGN16 rglAttribute;
// 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];
// 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)
} ALIGN16 rglAttributeState;
// 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[];
};
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_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
#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
};
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;
#define rglELEMENTS_IN_MATRIX 16 // 4x4
typedef void *( *rglTexNameSpaceCreateFunction )( void );
typedef void( *rglTexNameSpaceDestroyFunction )( void * );
typedef struct rglNameSpace
{
void** data;
void** firstFree;
unsigned long capacity;
} rglNameSpace;
typedef struct rglTexNameSpace
{
void** data;
GLuint capacity;
rglTexNameSpaceCreateFunction create;
rglTexNameSpaceDestroyFunction destroy;
} rglTexNameSpace;
typedef void *( *rglTexNameSpaceCreateFunction )( void );
typedef void( *rglTexNameSpaceDestroyFunction )( void * );
struct RGLcontext
{
GLenum error;
typedef struct rglTexNameSpace
{
void** data;
GLuint capacity;
rglTexNameSpaceCreateFunction create;
rglTexNameSpaceDestroyFunction destroy;
} rglTexNameSpace;
rglViewPort ViewPort;
GLclampf DepthNear;
GLclampf DepthFar;
// There are 6 clock domains, each with a maximum of 4 experiments, plus 4 elapsed exp.
#define RGL_MAX_DPM_QUERIES (4 * 6 + 4)
rglAttributeState defaultAttribs0; // a default rglAttributeState, for bind = 0
rglAttributeState *attribs; // ptr to current rglAttributeState
struct RGLcontext
{
GLenum error;
// Frame buffer-related fields
//
GLenum DrawBuffer, ReadBuffer;
rglViewPort ViewPort;
GLclampf DepthNear;
GLclampf DepthFar;
GLboolean Blending; // enable for mrt color target 0
GLenum BlendEquationRGB;
GLenum BlendEquationAlpha;
GLenum BlendFactorSrcRGB;
GLenum BlendFactorDestRGB;
GLenum BlendFactorSrcAlpha;
GLenum BlendFactorDestAlpha;
rglColorRGBAf BlendColor;
rglAttributeState defaultAttribs0; // a default rglAttributeState, for bind = 0
rglAttributeState *attribs; // ptr to current rglAttributeState
GLboolean ColorLogicOp;
GLenum LogicOp;
// Frame buffer-related fields
//
GLenum DrawBuffer, ReadBuffer;
GLboolean Dithering;
GLboolean Blending; // enable for mrt color target 0
GLenum BlendEquationRGB;
GLenum BlendEquationAlpha;
GLenum BlendFactorSrcRGB;
GLenum BlendFactorDestRGB;
GLenum BlendFactorSrcAlpha;
GLenum BlendFactorDestAlpha;
rglColorRGBAf BlendColor;
GLuint TexCoordReplaceMask;
GLboolean ColorLogicOp;
GLenum LogicOp;
rglTexNameSpace textureNameSpace;
GLuint ActiveTexture;
rglTextureImageUnit TextureImageUnits[RGL_MAX_TEXTURE_IMAGE_UNITS];
rglTextureImageUnit* CurrentImageUnit;
GLboolean Dithering;
GLsizei packAlignment;
GLsizei unpackAlignment;
GLuint TexCoordReplaceMask;
rglTexNameSpace bufferObjectNameSpace;
GLuint ArrayBuffer;
GLuint PixelUnpackBuffer;
GLuint TextureBuffer;
rglTexNameSpace textureNameSpace;
GLuint ActiveTexture;
rglTextureImageUnit TextureImageUnits[RGL_MAX_TEXTURE_IMAGE_UNITS];
rglTextureImageUnit* CurrentImageUnit;
// framebuffer objects
GLuint framebuffer; // GL_FRAMEBUFFER_OES binding
rglTexNameSpace framebufferNameSpace;
GLsizei packAlignment;
GLsizei unpackAlignment;
GLboolean VertexProgram;
struct _CGprogram* BoundVertexProgram;
rglTexNameSpace bufferObjectNameSpace;
GLuint ArrayBuffer;
GLuint PixelUnpackBuffer;
GLuint TextureBuffer;
GLboolean FragmentProgram;
struct _CGprogram* BoundFragmentProgram;
unsigned int LastFPConstantModification;
// framebuffer objects
GLuint framebuffer; // GL_FRAMEBUFFER_OES binding
rglTexNameSpace framebufferNameSpace;
GLboolean VSync;
GLboolean SkipFirstVSync;
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;
};
GLuint needValidate;
GLboolean everAttached;
CGerror RGLcgLastError;
CGerrorCallbackFunc RGLcgErrorCallbackFunction;
// Cg containers
CGcontext RGLcgContextHead;
rglNameSpace cgContextNameSpace;
rglNameSpace cgProgramNameSpace;
rglNameSpace cgParameterNameSpace;
};
#ifdef __cplusplus
}

View File

@ -3,7 +3,6 @@
#include "Types.h"
#include "../export/RGL/export.h"
#include "platform.h"
#ifdef __cplusplus
extern "C" {
@ -22,16 +21,16 @@ extern "C" {
#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 )
static inline int rglLog2( unsigned int i )
{
int l = 0;
while ( i )
{
int l = 0;
while ( i )
{
++l;
i >>= 1;
}
return l -1;
++l;
i >>= 1;
}
return l -1;
}
#define rglIsPow2(i) (((i) & ((i) - 1 )) == 0)
// Pad argument x to the next multiple of argument pad.
@ -53,7 +52,6 @@ GLboolean rglTexNameSpaceIsName(void *data, GLuint name );
void rglTexNameSpaceDeleteNames(void *data, GLsizei n, const GLuint *names );
void rglTexNameSpaceReinit(void *saved, void *active);
#ifdef __cplusplus
}
#endif

View File

@ -1,12 +0,0 @@
#ifndef _PLATFORM_H
#define _PLATFORM_H
#include "../export/RGL/rgl.h"
#define RGL_LITTLE_ENDIAN 0x1234
#define RGL_BIG_ENDIAN 0x4321
#define RGL_ENDIAN RGL_BIG_ENDIAN
#define RGL_ALIGN_FAST_TRANSFER 128
#endif

View File

@ -2,6 +2,17 @@
#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 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
static inline GLuint rglPlatformGetBitsPerPixel (GLenum internalFormat)
{
switch (internalFormat)
@ -27,7 +38,8 @@ static inline GLuint rglPlatformGetBitsPerPixel (GLenum internalFormat)
}
}
static inline void rglGcmSetVertexProgramParameterBlock(struct CellGcmContextData *thisContext, uint32_t baseConst, uint32_t constCount, const float * __restrict value)
static inline void rglGcmSetVertexProgramParameterBlock(struct CellGcmContextData *thisContext,
uint32_t baseConst, uint32_t constCount, const float * __restrict value)
{
uint32_t blockCount, blockRemain, i;
@ -107,9 +119,6 @@ static inline void rglGcmSetInlineTransfer(struct CellGcmContextData *thisContex
}
}
#define SUBPIXEL_BITS 12
#define SUBPIXEL_ADJUST (0.5/(1<<SUBPIXEL_BITS))
#define rglGcmSwap16Float32(fp, f) \
{ \
union SwapF32_16 \
@ -728,7 +737,6 @@ static inline void rglGcmFifoGlViewport(void *data, GLclampf zNear, GLclampf zFa
clipY1 - clipY0, zNear, zFar, scale, offset );
}
#define BLOCKSIZE_MAX_DIMENSIONS 1024
static inline void rglGcmSetTransferImage(struct CellGcmContextData *thisContext, uint8_t mode, uint32_t dstOffset, uint32_t dstPitch, uint32_t dstX, uint32_t dstY, uint32_t srcOffset, uint32_t srcPitch, uint32_t srcX, uint32_t srcY, uint32_t width, uint32_t height, uint32_t bytesPerPixel)
{
@ -902,7 +910,6 @@ static inline void RGLGCM_CALC_COLOR_LE_ARGB8( GLuint *color0, const GLfloat r,
*color0 = ( a2 << 24 ) | ( r2 << 16 ) | ( g2 << 8 ) | ( b2 << 0 );
}
#define RGLGCM_UTIL_LABEL_INDEX 253
// Utility to let RSX wait for complete RSX pipeline idle
static inline void rglGcmUtilWaitForIdle (void)
@ -956,11 +963,6 @@ static inline void rglPrintFifoFromGet( unsigned int numWords )
rglPrintIt((( uint32_t* )rglGcmState_i.fifo.lastGetRead )[i] );
}
#define CL0039_MIN_PITCH -32768
#define CL0039_MAX_PITCH 32767
#define CL0039_MAX_LINES 0x3fffff
#define CL0039_MAX_ROWS 0x7ff
static inline void rglGcmTransferData
(
GLuint dstId,

View File

@ -30,13 +30,7 @@
#include <Cg/CgCommon.h>
// endian swapping of the fragment uniforms, if necessary
#if RGL_ENDIAN == RGL_BIG_ENDIAN
#define SWAP_IF_BIG_ENDIAN(arg) endianSwapWordByHalf(arg)
#elif RGL_ENDIAN == RGL_LITTLE_ENDIAN
#define SWAP_IF_BIG_ENDIAN(arg) arg
#else
#error include missing for endianness
#endif
void rglPsglPlatformInit (void *data);
void rglPsglPlatformExit (void);

View File

@ -16,7 +16,6 @@
#include <ppu_intrinsics.h>
#include <RGL/platform.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
@ -25,11 +24,7 @@
MEMORY MANAGER
============================================================ */
#if RGL_ENDIAN == RGL_BIG_ENDIAN
#define ENDIAN_32(X, F) ((F) ? endianSwapWord(X) : (X))
#else
#define ENDIAN_32(X, F) (X)
#endif
int _parameterAlloc = 0;
int _ucodeAlloc = 0;