(RGL PS3) Cleanups
This commit is contained in:
parent
32604f0aa3
commit
d836be0273
|
@ -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
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
namespace RGL
|
||||
{
|
||||
|
||||
template<class T> class Vector
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -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,31 +456,28 @@ 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
|
||||
{
|
||||
typedef struct
|
||||
{
|
||||
GLfloat R, G, B, A;
|
||||
} rglColorRGBAf;
|
||||
} rglColorRGBAf;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct
|
||||
{
|
||||
int X, Y, XSize, YSize;
|
||||
} rglViewPort;
|
||||
} 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 {
|
||||
// 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_
|
||||
{
|
||||
// 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;
|
||||
|
@ -511,23 +507,22 @@ extern "C" {
|
|||
char *mallocData;
|
||||
GLsizei mallocStorageSize;
|
||||
GLenum dataState; // valid data location (see enum above)
|
||||
}
|
||||
rglImage;
|
||||
} 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
|
||||
{
|
||||
// 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;
|
||||
|
@ -537,17 +532,17 @@ extern "C" {
|
|||
GLsizei ystride;
|
||||
GLsizei zstride;
|
||||
void* data;
|
||||
} rglRaster;
|
||||
} 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
|
||||
{
|
||||
// Texture data structure
|
||||
typedef struct
|
||||
{
|
||||
GLuint revalidate;
|
||||
GLuint target;
|
||||
|
||||
|
@ -582,20 +577,20 @@ extern "C" {
|
|||
GLuint imageCount;
|
||||
rglImage* image;
|
||||
void * platformTexture[]; // C99 flexible array member
|
||||
} rglTexture;
|
||||
} rglTexture;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct
|
||||
{
|
||||
GLboolean isSet;
|
||||
void* platformFenceObject[];
|
||||
} rglFenceObject;
|
||||
} 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
|
||||
{
|
||||
// Texture image unit data structure
|
||||
typedef struct
|
||||
{
|
||||
GLuint bound2D;
|
||||
|
||||
rglTexture* default2D;
|
||||
|
@ -608,25 +603,25 @@ extern "C" {
|
|||
GLfloat lodBias;
|
||||
|
||||
rglTexture* currentTexture;
|
||||
} rglTextureImageUnit;
|
||||
} rglTextureImageUnit;
|
||||
|
||||
enum
|
||||
{
|
||||
enum
|
||||
{
|
||||
RGL_FRAMEBUFFER_ATTACHMENT_NONE,
|
||||
RGL_FRAMEBUFFER_ATTACHMENT_RENDERBUFFER,
|
||||
RGL_FRAMEBUFFER_ATTACHMENT_TEXTURE,
|
||||
};
|
||||
};
|
||||
|
||||
struct RGLdevice
|
||||
{
|
||||
struct RGLdevice
|
||||
{
|
||||
PSGLdeviceParameters deviceParameters;
|
||||
|
||||
GLvoid* rasterDriver;
|
||||
char platformDevice[]; // C99 flexible array member
|
||||
};
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct
|
||||
{
|
||||
// parameters to glDraw* calls
|
||||
GLenum mode;
|
||||
GLint firstVertex;
|
||||
|
@ -643,12 +638,12 @@ extern "C" {
|
|||
GLuint attribXferTotalSize;
|
||||
GLuint attribXferOffset[RGL_MAX_VERTEX_ATTRIBS];
|
||||
GLuint attribXferSize[RGL_MAX_VERTEX_ATTRIBS];
|
||||
} rglDrawParams;
|
||||
} 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,9 +661,9 @@ extern "C" {
|
|||
#define RGL_ATTRIB_TEX_COORD6_INDEX 14
|
||||
#define RGL_ATTRIB_TEX_COORD7_INDEX 15
|
||||
|
||||
// per-attribute descriptor and data
|
||||
typedef struct
|
||||
{
|
||||
// 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
|
||||
|
@ -678,13 +673,13 @@ extern "C" {
|
|||
GLfloat value[4]; // constant attribute value
|
||||
GLuint frequency; // instancing divisor
|
||||
GLboolean normalized;
|
||||
} ALIGN16 rglAttribute;
|
||||
} __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
|
||||
{
|
||||
// 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.
|
||||
|
@ -694,10 +689,10 @@ extern "C" {
|
|||
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;
|
||||
} __attribute__((aligned (16))) rglAttributeState;
|
||||
|
||||
struct rglBufferObject
|
||||
{
|
||||
struct rglBufferObject
|
||||
{
|
||||
GLuint refCount;
|
||||
GLsizeiptr size;
|
||||
GLboolean mapped;
|
||||
|
@ -706,7 +701,7 @@ extern "C" {
|
|||
GLuint height;
|
||||
RGL::Vector<rglTexture *> textureReferences;
|
||||
void *platformBufferObject[];
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
#define RGL_CONTEXT_RED_MASK 0x01
|
||||
|
@ -716,9 +711,8 @@ extern "C" {
|
|||
#define RGL_CONTEXT_DEPTH_MASK 0x10
|
||||
#define RGL_CONTEXT_COLOR_MASK 0x0F
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
enum
|
||||
{
|
||||
RGL_CONTEXT_ACTIVE_SURFACE_COLOR0,
|
||||
RGL_CONTEXT_ACTIVE_SURFACE_COLOR1,
|
||||
RGL_CONTEXT_ACTIVE_SURFACE_COLOR2,
|
||||
|
@ -726,33 +720,28 @@ extern "C" {
|
|||
RGL_CONTEXT_ACTIVE_SURFACE_DEPTH,
|
||||
RGL_CONTEXT_ACTIVE_SURFACE_STENCIL,
|
||||
RGL_CONTEXT_ACTIVE_SURFACES
|
||||
};
|
||||
};
|
||||
|
||||
#define rglELEMENTS_IN_MATRIX 16 // 4x4
|
||||
|
||||
typedef struct rglNameSpace
|
||||
{
|
||||
typedef struct rglNameSpace
|
||||
{
|
||||
void** data;
|
||||
void** firstFree;
|
||||
unsigned long capacity;
|
||||
} rglNameSpace;
|
||||
} rglNameSpace;
|
||||
|
||||
typedef void *( *rglTexNameSpaceCreateFunction )( void );
|
||||
typedef void( *rglTexNameSpaceDestroyFunction )( void * );
|
||||
typedef void *( *rglTexNameSpaceCreateFunction )( void );
|
||||
typedef void( *rglTexNameSpaceDestroyFunction )( void * );
|
||||
|
||||
typedef struct rglTexNameSpace
|
||||
{
|
||||
typedef struct rglTexNameSpace
|
||||
{
|
||||
void** data;
|
||||
GLuint capacity;
|
||||
rglTexNameSpaceCreateFunction create;
|
||||
rglTexNameSpaceDestroyFunction destroy;
|
||||
} rglTexNameSpace;
|
||||
} rglTexNameSpace;
|
||||
|
||||
// There are 6 clock domains, each with a maximum of 4 experiments, plus 4 elapsed exp.
|
||||
#define RGL_MAX_DPM_QUERIES (4 * 6 + 4)
|
||||
|
||||
struct RGLcontext
|
||||
{
|
||||
struct RGLcontext
|
||||
{
|
||||
GLenum error;
|
||||
|
||||
rglViewPort ViewPort;
|
||||
|
@ -819,8 +808,7 @@ extern "C" {
|
|||
rglNameSpace cgContextNameSpace;
|
||||
rglNameSpace cgProgramNameSpace;
|
||||
rglNameSpace cgParameterNameSpace;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
#include "Types.h"
|
||||
#include "../export/RGL/export.h"
|
||||
#include "platform.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -22,8 +21,8 @@ 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 )
|
||||
{
|
||||
|
@ -31,7 +30,7 @@ extern "C" {
|
|||
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
|
||||
|
|
|
@ -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
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue