mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-27 13:16:14 +00:00
(RGL) More cleanups pt. 2
This commit is contained in:
parent
4a45ead07e
commit
e6de786756
@ -1,6 +1,5 @@
|
||||
#ifndef _RGLPrivate_h
|
||||
#define _RGLPrivate_h
|
||||
|
||||
#ifndef _RGL_PRIVATE_H
|
||||
#define _RGL_PRIVATE_H
|
||||
|
||||
#include "../export/RGL/rgl.h"
|
||||
#include "Types.h"
|
||||
@ -12,23 +11,13 @@
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define _RGL_EXTERN_C extern "C"
|
||||
#else
|
||||
#define _RGL_EXTERN_C
|
||||
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
|
||||
@ -40,258 +29,238 @@ extern "C"
|
||||
#define GL_UNSIGNED_BYTE_2_2_2_2_REV 0x4A07
|
||||
|
||||
#define GL_FLOAT_RGBA32 0x888B
|
||||
//------------------------------------------------------------------------
|
||||
// Function prototypes
|
||||
//------------------------------------------------------------------------
|
||||
//----------------------------------------
|
||||
// RGL.c
|
||||
//----------------------------------------
|
||||
typedef void( * RGLcontextHookFunction )( RGLcontext *context );
|
||||
extern RGL_EXPORT RGLcontextHookFunction rglContextCreateHook;
|
||||
extern RGL_EXPORT RGLcontextHookFunction rglContextDestroyHook;
|
||||
|
||||
extern RGLcontext* rglContextCreate();
|
||||
extern void rglContextFree( RGLcontext* LContext );
|
||||
extern void rglSetError( GLenum error );
|
||||
extern GLuint rglValidateStates( GLuint mask );
|
||||
void rglAttachContext( RGLdevice *device, RGLcontext* context );
|
||||
void rglDetachContext( RGLdevice *device, RGLcontext* context );
|
||||
void rglInvalidateAllStates (void *data);
|
||||
void rglResetAttributeState( rglAttributeState* as );
|
||||
void rglSetFlipHandler(void (*handler)(const GLuint head), RGLdevice *device);
|
||||
void rglSetVBlankHandler(void (*handler)(const GLuint head), RGLdevice *device);
|
||||
typedef void( * RGLcontextHookFunction )( RGLcontext *context );
|
||||
extern RGL_EXPORT RGLcontextHookFunction rglContextCreateHook;
|
||||
extern RGL_EXPORT RGLcontextHookFunction rglContextDestroyHook;
|
||||
|
||||
//----------------------------------------
|
||||
// Texture.c
|
||||
//----------------------------------------
|
||||
rglTexture *rglAllocateTexture (void);
|
||||
void rglFreeTexture (void *data);
|
||||
void rglTextureUnbind( RGLcontext* context, GLuint name );
|
||||
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 GLboolean rglTextureIsValid( const rglTexture* texture );
|
||||
GLenum rglGetEnabledTextureMode( const rglTextureImageUnit *unit );
|
||||
extern rglTexture *rglGetCurrentTexture( const rglTextureImageUnit *unit, GLenum target );
|
||||
RGL_EXPORT void rglUpdateCurrentTextureCache( rglTextureImageUnit *unit );
|
||||
void rglReallocateImages( rglTexture *texture, GLint level, GLsizei dimension );
|
||||
extern int rglGetImage( GLenum target, GLint level, rglTexture **texture, rglImage **image, GLsizei reallocateSize );
|
||||
static inline rglTexture* rglGetTexture( RGLcontext *LContext, GLuint name )
|
||||
extern RGLcontext* rglContextCreate();
|
||||
extern void rglContextFree( RGLcontext* LContext );
|
||||
extern void rglSetError( GLenum error );
|
||||
extern GLuint rglValidateStates( GLuint mask );
|
||||
void rglAttachContext( RGLdevice *device, RGLcontext* context );
|
||||
void rglDetachContext( RGLdevice *device, RGLcontext* context );
|
||||
void rglInvalidateAllStates (void *data);
|
||||
void rglResetAttributeState( rglAttributeState* as );
|
||||
void rglSetFlipHandler(void (*handler)(const GLuint head), RGLdevice *device);
|
||||
void rglSetVBlankHandler(void (*handler)(const GLuint head), RGLdevice *device);
|
||||
|
||||
//----------------------------------------
|
||||
// Texture.c
|
||||
//----------------------------------------
|
||||
rglTexture *rglAllocateTexture (void);
|
||||
void rglFreeTexture (void *data);
|
||||
void rglTextureUnbind (void *data, GLuint name );
|
||||
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 GLboolean rglTextureIsValid( const rglTexture* texture );
|
||||
GLenum rglGetEnabledTextureMode (const void *data);
|
||||
extern rglTexture *rglGetCurrentTexture (const void *data, GLenum target);
|
||||
RGL_EXPORT void rglUpdateCurrentTextureCache (void *data);
|
||||
void rglReallocateImages (void *data, GLint level, GLsizei dimension);
|
||||
extern int rglGetImage( GLenum target, GLint level, rglTexture **texture, rglImage **image, GLsizei reallocateSize );
|
||||
|
||||
static inline rglTexture* rglGetTexture (RGLcontext *LContext, GLuint name)
|
||||
{
|
||||
return ( rglTexture* )LContext->textureNameSpace.data[name];
|
||||
}
|
||||
|
||||
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 = _CurrentContext;
|
||||
|
||||
if (!LContext )
|
||||
return; // may be called in psglDestroyContext
|
||||
|
||||
// check if bound to any framebuffer
|
||||
GLuint fbCount = texture->framebuffers.getCount();
|
||||
if ( fbCount > 0 )
|
||||
{
|
||||
return ( rglTexture* )LContext->textureNameSpace.data[name];
|
||||
}
|
||||
|
||||
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 );
|
||||
inline static void rglTextureTouchFBOs( rglTexture *texture )
|
||||
{
|
||||
RGLcontext *LContext = _CurrentContext;
|
||||
if ( !LContext ) return; // may be called in psglDestroyContext
|
||||
// check if bound to any framebuffer
|
||||
GLuint fbCount = texture->framebuffers.getCount();
|
||||
if ( fbCount > 0 )
|
||||
rglFramebuffer *contextFramebuffer = LContext->framebuffer ? rglGetFramebuffer( LContext, LContext->framebuffer ) : NULL;
|
||||
for ( GLuint i = 0;i < fbCount;++i )
|
||||
{
|
||||
rglFramebuffer *contextFramebuffer = LContext->framebuffer ? rglGetFramebuffer( LContext, LContext->framebuffer ) : NULL;
|
||||
for ( GLuint i = 0;i < fbCount;++i )
|
||||
{
|
||||
rglFramebuffer* framebuffer = texture->framebuffers[i];
|
||||
framebuffer->needValidate = GL_TRUE;
|
||||
if ( RGL_UNLIKELY( framebuffer == contextFramebuffer ) ) LContext->needValidate |= PSGL_VALIDATE_SCISSOR_BOX | PSGL_VALIDATE_FRAMEBUFFER;
|
||||
}
|
||||
rglFramebuffer* framebuffer = texture->framebuffers[i];
|
||||
framebuffer->needValidate = GL_TRUE;
|
||||
if (RGL_UNLIKELY( framebuffer == contextFramebuffer))
|
||||
LContext->needValidate |= PSGL_VALIDATE_SCISSOR_BOX | 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 void rglSetImage( rglImage* image, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei alignment, GLenum format, GLenum type, const GLvoid* pixels );
|
||||
extern void rglSetSubImage( GLenum target, GLint level, rglTexture *texture, rglImage* image, GLint x, GLint y, GLint z, GLsizei width, GLsizei height, GLsizei depth, GLsizei alignment, GLenum format, GLenum type, const GLvoid* pixels );
|
||||
extern int rglGetPixelSize( GLenum format, GLenum type );
|
||||
static inline int rglGetStorageSize( GLenum format, GLenum type, GLsizei width, GLsizei height, GLsizei depth )
|
||||
{
|
||||
return rglGetPixelSize( format, type )*width*height*depth;
|
||||
}
|
||||
//----------------------------------------
|
||||
// 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 void rglSetImage( rglImage* image, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei alignment, GLenum format, GLenum type, const GLvoid* pixels );
|
||||
extern void rglSetSubImage( GLenum target, GLint level, rglTexture *texture, rglImage* image, GLint x, GLint y, GLint z, GLsizei width, GLsizei height, GLsizei depth, GLsizei alignment, GLenum format, GLenum type, const GLvoid* pixels );
|
||||
extern int rglGetPixelSize( GLenum format, GLenum type );
|
||||
|
||||
extern int rglGetTypeSize( GLenum type );
|
||||
extern int rglGetMaxBitSize( GLenum type );
|
||||
extern int rglGetStorageSize( GLenum format, GLenum type, GLsizei width, GLsizei height, GLsizei depth );
|
||||
extern void rglImageToRaster( const rglImage* image, rglRaster* raster, GLuint x, GLuint y, GLuint z );
|
||||
extern void rglRasterToImage( const rglRaster* raster, rglImage* image, GLuint x, GLuint y, GLuint z );
|
||||
extern void rglRawRasterToImage (const void *in_data, void *out_data, GLuint x, GLuint y, GLuint z);
|
||||
void rglResampleImage3D( rglImage* src, rglImage* dst );
|
||||
static inline int rglGetStorageSize( GLenum format, GLenum type, GLsizei width, GLsizei height, GLsizei depth )
|
||||
{
|
||||
return rglGetPixelSize( format, type )*width*height*depth;
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
// Sync.c
|
||||
//----------------------------------------
|
||||
rglFenceObject *rglCreateFenceObject();
|
||||
void rglFreeFenceObject( rglFenceObject *fence );
|
||||
static inline rglFenceObject *rglGetFenceObject( RGLcontext *LContext, GLuint name )
|
||||
{
|
||||
return ( rglFenceObject * )LContext->fenceObjectNameSpace.data[name];
|
||||
}
|
||||
extern int rglGetTypeSize( GLenum type );
|
||||
extern int rglGetMaxBitSize( GLenum type );
|
||||
extern int rglGetStorageSize( GLenum format, GLenum type, GLsizei width, GLsizei height, GLsizei depth );
|
||||
extern void rglImageToRaster( const rglImage* image, rglRaster* raster, GLuint x, GLuint y, GLuint z );
|
||||
extern void rglRasterToImage( const rglRaster* raster, rglImage* image, GLuint x, GLuint y, GLuint z );
|
||||
extern void rglRawRasterToImage (const void *in_data, void *out_data, GLuint x, GLuint y, GLuint z);
|
||||
|
||||
//----------------------------------------
|
||||
// FramebufferObject.c
|
||||
//----------------------------------------
|
||||
rglFramebuffer *rglCreateFramebuffer( void );
|
||||
void rglDestroyFramebuffer( rglFramebuffer *framebuffer );
|
||||
static inline rglFramebuffer *rglGetFramebuffer( RGLcontext *LContext, GLuint name )
|
||||
{
|
||||
return ( rglFramebuffer * )LContext->framebufferNameSpace.data[name];
|
||||
}
|
||||
//----------------------------------------
|
||||
// FramebufferObject.c
|
||||
//----------------------------------------
|
||||
rglFramebuffer *rglCreateFramebuffer( void );
|
||||
void rglDestroyFramebuffer( rglFramebuffer *framebuffer );
|
||||
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;
|
||||
}
|
||||
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( rglFramebuffer* framebuffer );
|
||||
GLboolean rglPlatformGenerateMipmap( rglTexture* texture, GLuint face );
|
||||
void rglPlatformFramebufferGetParameteriv( GLenum pname, GLint* params );
|
||||
void rglPlatformResolveFramebuffer();
|
||||
void rglGetFramebufferSize( GLuint* width, GLuint* height );
|
||||
void rglFramebufferGetAttachmentTexture( RGLcontext* LContext, const rglFramebufferAttachment* attachment, rglTexture** texture, GLuint* face );
|
||||
GLenum rglPlatformFramebufferCheckStatus( rglFramebuffer* framebuffer );
|
||||
GLboolean rglPlatformGenerateMipmap( rglTexture* texture, GLuint face );
|
||||
void rglPlatformFramebufferGetParameteriv( GLenum pname, GLint* params );
|
||||
void rglPlatformResolveFramebuffer();
|
||||
void rglGetFramebufferSize( GLuint* width, GLuint* height );
|
||||
|
||||
//----------------------------------------
|
||||
// VertexArray.c
|
||||
//----------------------------------------
|
||||
void rglVertexAttrib1fNV( GLuint index, GLfloat x );
|
||||
void rglVertexAttrib1fvNV( GLuint index, const GLfloat* v );
|
||||
void rglVertexAttrib2fNV( GLuint index, GLfloat x, GLfloat y );
|
||||
void rglVertexAttrib2fvNV( GLuint index, const GLfloat* v );
|
||||
void rglVertexAttrib3fNV( GLuint index, GLfloat x, GLfloat y, GLfloat z );
|
||||
void rglVertexAttrib3fvNV( GLuint index, const GLfloat* v );
|
||||
void rglVertexAttrib4fNV( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w );
|
||||
void rglVertexAttrib4fvNV( GLuint index, const GLfloat* v );
|
||||
void rglVertexAttribPointerNV( GLuint index, GLint fsize, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* pointer );
|
||||
void rglVertexAttribElementFunc( GLuint index, GLenum func, GLuint frequency );
|
||||
void rglEnableVertexAttribArrayNV( GLuint index );
|
||||
void rglDisableVertexAttribArrayNV( GLuint index );
|
||||
GLint rglConvertStream( rglAttributeState* asDst, const rglAttributeState* asSrc, GLuint index,
|
||||
GLint skip, GLint first, GLint count,
|
||||
const void* indices, GLenum indexType );
|
||||
void rglComputeMinMaxIndices( RGLcontext* LContext, GLuint* min, GLuint* max, const void* indices, GLenum indexType, GLsizei count );
|
||||
//----------------------------------------
|
||||
// VertexArray.c
|
||||
//----------------------------------------
|
||||
void rglVertexAttrib1fNV( GLuint index, GLfloat x );
|
||||
void rglVertexAttrib1fvNV( GLuint index, const GLfloat* v );
|
||||
void rglVertexAttrib2fNV( GLuint index, GLfloat x, GLfloat y );
|
||||
void rglVertexAttrib2fvNV( GLuint index, const GLfloat* v );
|
||||
void rglVertexAttrib3fNV( GLuint index, GLfloat x, GLfloat y, GLfloat z );
|
||||
void rglVertexAttrib3fvNV( GLuint index, const GLfloat* v );
|
||||
void rglVertexAttrib4fNV( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w );
|
||||
void rglVertexAttrib4fvNV( GLuint index, const GLfloat* v );
|
||||
void rglVertexAttribPointerNV( GLuint index, GLint fsize, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* pointer );
|
||||
void rglVertexAttribElementFunc( GLuint index, GLenum func, GLuint frequency );
|
||||
void rglEnableVertexAttribArrayNV( GLuint index );
|
||||
void rglDisableVertexAttribArrayNV( GLuint index );
|
||||
GLint rglConvertStream( rglAttributeState* asDst, const rglAttributeState* asSrc, GLuint index,
|
||||
GLint skip, GLint first, GLint count,
|
||||
const void* indices, GLenum indexType );
|
||||
void rglComputeMinMaxIndices( RGLcontext* LContext, GLuint* min, GLuint* max, const void* indices, GLenum indexType, GLsizei count );
|
||||
|
||||
//----------------------------------------
|
||||
// Platform/Init.c
|
||||
//----------------------------------------
|
||||
extern void rglPlatformInit (PSGLinitOptions* options);
|
||||
extern void rglPlatformExit (void);
|
||||
//----------------------------------------
|
||||
// Platform/Init.c
|
||||
//----------------------------------------
|
||||
extern void rglPlatformInit (void *data);
|
||||
extern void rglPlatformExit (void);
|
||||
|
||||
//----------------------------------------
|
||||
// Device/Device.c
|
||||
//----------------------------------------
|
||||
extern void rglDeviceInit (PSGLinitOptions* options);
|
||||
extern void rglDeviceExit (void);
|
||||
extern PSGLdeviceParameters * rglShadowDeviceParameters (void);
|
||||
//----------------------------------------
|
||||
// Device/Device.c
|
||||
//----------------------------------------
|
||||
extern void rglDeviceInit (void *data);
|
||||
extern void rglDeviceExit (void);
|
||||
extern PSGLdeviceParameters * rglShadowDeviceParameters (void);
|
||||
|
||||
|
||||
//----------------------------------------
|
||||
// Device/.../PlatformDevice.c
|
||||
//----------------------------------------
|
||||
extern GLboolean rglPlatformDeviceInit (PSGLinitOptions* options);
|
||||
extern void rglPlatformDeviceExit (void);
|
||||
extern int rglPlatformDeviceSize (void);
|
||||
extern int rglPlatformCreateDevice (void *data);
|
||||
extern void rglPlatformDestroyDevice (void *data);
|
||||
extern void rglPlatformMakeCurrent (void *data);
|
||||
extern void rglPlatformSwapBuffers (void *data);
|
||||
extern const GLvoid* rglPlatformGetProcAddress (const char *funcName);
|
||||
//----------------------------------------
|
||||
// Device/.../PlatformDevice.c
|
||||
//----------------------------------------
|
||||
extern GLboolean rglPlatformDeviceInit (PSGLinitOptions* options);
|
||||
extern void rglPlatformDeviceExit (void);
|
||||
extern int rglPlatformDeviceSize (void);
|
||||
extern int rglPlatformCreateDevice (void *data);
|
||||
extern void rglPlatformDestroyDevice (void *data);
|
||||
extern void rglPlatformMakeCurrent (void *data);
|
||||
extern void rglPlatformSwapBuffers (void *data);
|
||||
extern const GLvoid* rglPlatformGetProcAddress (const char *funcName);
|
||||
|
||||
//----------------------------------------
|
||||
// Raster/.../PlatformRaster.c
|
||||
//----------------------------------------
|
||||
void* rglPlatformRasterInit (void);
|
||||
void rglPlatformRasterExit (void* data);
|
||||
void rglPlatformRasterDestroyResources (void);
|
||||
void rglPlatformDraw (rglDrawParams* dparams);
|
||||
GLboolean rglPlatformNeedsConversion (const rglAttributeState* as, GLuint index);
|
||||
// [YLIN] Try to avoid LHS inside this function.
|
||||
// In oringinal implementation, indexType and indexCount will be stored right before this function
|
||||
// and since we will load them right after enter this function, there are LHS.
|
||||
GLboolean rglPlatformRequiresSlowPath( rglDrawParams* dparams, const GLenum indexType, uint32_t indexCount);
|
||||
void rglPlatformRasterGetIntegerv( GLenum pname, GLint* params );
|
||||
void rglPlatformRasterFlush (void);
|
||||
void rglPlatformRasterFinish (void);
|
||||
void rglValidateFragmentProgram (void);
|
||||
void rglValidateFragmentProgramSharedConstants (void);
|
||||
void rglValidateClipPlanes (void);
|
||||
void rglInvalidateAttributes (void);
|
||||
GLuint rglValidateAttributes (const void* indices, GLboolean *isMain);
|
||||
GLuint rglValidateAttributesSlow (rglDrawParams *dparams, GLboolean *isMain);
|
||||
//----------------------------------------
|
||||
// Raster/.../PlatformRaster.c
|
||||
//----------------------------------------
|
||||
void* rglPlatformRasterInit (void);
|
||||
void rglPlatformRasterExit (void* data);
|
||||
void rglPlatformRasterDestroyResources (void);
|
||||
void rglPlatformDraw (rglDrawParams* dparams);
|
||||
GLboolean rglPlatformNeedsConversion (const rglAttributeState* as, GLuint index);
|
||||
// [YLIN] Try to avoid LHS inside this function.
|
||||
// In oringinal implementation, indexType and indexCount will be stored right before this function
|
||||
// and since we will load them right after enter this function, there are LHS.
|
||||
GLboolean rglPlatformRequiresSlowPath( rglDrawParams* dparams, const GLenum indexType, uint32_t indexCount);
|
||||
void rglPlatformRasterGetIntegerv( GLenum pname, GLint* params );
|
||||
void rglPlatformRasterFlush (void);
|
||||
void rglPlatformRasterFinish (void);
|
||||
void rglValidateFragmentProgram (void);
|
||||
void rglValidateFragmentProgramSharedConstants (void);
|
||||
void rglValidateClipPlanes (void);
|
||||
void rglInvalidateAttributes (void);
|
||||
GLuint rglValidateAttributes (const void* indices, GLboolean *isMain);
|
||||
GLuint rglValidateAttributesSlow (rglDrawParams *dparams, GLboolean *isMain);
|
||||
|
||||
//----------------------------------------
|
||||
// Raster/.../PlatformTexture.c
|
||||
//----------------------------------------
|
||||
extern int rglPlatformTextureSize (void);
|
||||
extern int rglPlatformTextureMaxUnits (void);
|
||||
extern void rglPlatformCreateTexture( rglTexture* texture );
|
||||
extern void rglPlatformDestroyTexture( rglTexture* texture );
|
||||
extern void rglPlatformValidateTextureStage (int unit, void *data);
|
||||
void rglPlatformValidateVertexTextures (void);
|
||||
extern GLenum rglPlatformChooseInternalStorage (void *data, GLenum internalformat);
|
||||
extern GLenum rglPlatformTranslateTextureFormat( GLenum internalFormat );
|
||||
extern void rglPlatformCopyTexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height );
|
||||
GLenum rglPlatformChooseInternalFormat( GLenum internalformat );
|
||||
void rglPlatformExpandInternalFormat( GLenum internalformat, GLenum *format, GLenum *type );
|
||||
void rglPlatformGetImageData( GLenum target, GLint level, rglTexture *texture, rglImage *image );
|
||||
GLboolean rglPlatformTextureReference (void *data, GLuint pitch, rglBufferObject *bufferObject, GLintptr offset);
|
||||
//----------------------------------------
|
||||
// Raster/.../PlatformTexture.c
|
||||
//----------------------------------------
|
||||
extern int rglPlatformTextureSize (void);
|
||||
extern int rglPlatformTextureMaxUnits (void);
|
||||
extern void rglPlatformCreateTexture( rglTexture* texture );
|
||||
extern void rglPlatformDestroyTexture( rglTexture* texture );
|
||||
extern void rglPlatformValidateTextureStage (int unit, void *data);
|
||||
void rglPlatformValidateVertexTextures (void);
|
||||
extern GLenum rglPlatformChooseInternalStorage (void *data, GLenum internalformat);
|
||||
extern GLenum rglPlatformTranslateTextureFormat( GLenum internalFormat );
|
||||
extern void rglPlatformCopyTexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height );
|
||||
GLenum rglPlatformChooseInternalFormat( GLenum internalformat );
|
||||
void rglPlatformExpandInternalFormat( GLenum internalformat, GLenum *format, GLenum *type );
|
||||
void rglPlatformGetImageData( GLenum target, GLint level, rglTexture *texture, rglImage *image );
|
||||
GLboolean rglPlatformTextureReference (void *data, GLuint pitch, rglBufferObject *bufferObject, GLintptr offset);
|
||||
|
||||
//----------------------------------------
|
||||
// Raster/.../PlatformFBops.c
|
||||
//----------------------------------------
|
||||
extern void rglFBClear( GLbitfield mask );
|
||||
extern void rglValidateFramebuffer( void );
|
||||
extern void rglValidateFFXVertexProgram();
|
||||
extern void rglValidateFFXFragmentProgram();
|
||||
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/.../PlatformFBops.c
|
||||
//----------------------------------------
|
||||
extern void rglFBClear( GLbitfield mask );
|
||||
extern void rglValidateFramebuffer( void );
|
||||
extern void rglValidateFFXVertexProgram (void);
|
||||
extern void rglValidateFFXFragmentProgram (void);
|
||||
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/.../PlatformTNL.c
|
||||
//----------------------------------------
|
||||
void rglValidateNormalize();
|
||||
void rglValidateVertexProgram();
|
||||
void rglValidateVertexConstants();
|
||||
//----------------------------------------
|
||||
// Raster/.../PlatformTNL.c
|
||||
//----------------------------------------
|
||||
void rglValidateVertexProgram (void);
|
||||
void rglValidateVertexConstants (void);
|
||||
|
||||
//----------------------------------------
|
||||
// Raster/.../PlatformBuffer.c
|
||||
//----------------------------------------
|
||||
int rglPlatformBufferObjectSize();
|
||||
GLboolean rglPlatformCreateBufferObject( rglBufferObject* bufferObject );
|
||||
void rglPlatformDestroyBufferObject( rglBufferObject* bufferObject );
|
||||
void rglPlatformBufferObjectSetData( rglBufferObject* bufferObject, GLintptr offset, GLsizeiptr size, const GLvoid *data, GLboolean tryImmediateCopy );
|
||||
GLvoid rglPlatformBufferObjectCopyData (void *dst, void *src);
|
||||
// map / unmap buffers. Internally refcounted
|
||||
char *rglPlatformBufferObjectMap( rglBufferObject* bufferObject, GLenum access );
|
||||
GLboolean rglPlatformBufferObjectUnmap( rglBufferObject* bufferObject );
|
||||
void rglPlatformGetBufferParameteriv( rglBufferObject *bufferObject, GLenum pname, int *params );
|
||||
//----------------------------------------
|
||||
// Raster/.../PlatformBuffer.c
|
||||
//----------------------------------------
|
||||
int rglPlatformBufferObjectSize (void);
|
||||
GLboolean rglPlatformCreateBufferObject( rglBufferObject* bufferObject );
|
||||
void rglPlatformDestroyBufferObject( rglBufferObject* bufferObject );
|
||||
void rglPlatformBufferObjectSetData( rglBufferObject* bufferObject, GLintptr offset, GLsizeiptr size, const GLvoid *data, GLboolean tryImmediateCopy );
|
||||
GLvoid rglPlatformBufferObjectCopyData (void *dst, void *src);
|
||||
// map / unmap buffers. Internally refcounted
|
||||
char *rglPlatformBufferObjectMap( rglBufferObject* bufferObject, GLenum access );
|
||||
GLboolean rglPlatformBufferObjectUnmap( rglBufferObject* bufferObject );
|
||||
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);
|
||||
void rglBindVertexTextureInternal( GLuint unit, GLuint name );
|
||||
|
||||
//----------------------------------------
|
||||
// Raster/.../PlatformSync.c
|
||||
//----------------------------------------
|
||||
int rglPlatformFenceObjectSize();
|
||||
GLboolean rglPlatformCreateFenceObject( rglFenceObject* fenceObject );
|
||||
void rglPlatformDestroyFenceObject( rglFenceObject* fenceObject );
|
||||
void rglPlatformSetFence( rglFenceObject* fenceObject );
|
||||
GLboolean rglPlatformTestFence( rglFenceObject* fenceObject );
|
||||
void rglPlatformFinishFence( rglFenceObject* fenceObject );
|
||||
// this is shared in glBindTexture and cgGL code
|
||||
RGL_EXPORT void rglBindTextureInternal (void *data, GLuint name, GLenum target);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // Close scope of 'extern "C"' declaration that encloses file.
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _RGLPrivate_h
|
||||
#endif
|
||||
|
@ -14,37 +14,36 @@
|
||||
#include <sdk_version.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct PSGLdevice PSGLdevice;
|
||||
typedef struct PSGLcontext PSGLcontext;
|
||||
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;
|
||||
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
|
||||
@ -68,28 +67,28 @@ extern "C"
|
||||
#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;
|
||||
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;
|
||||
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
|
||||
@ -99,29 +98,27 @@ extern "C"
|
||||
#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 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;
|
||||
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
|
||||
@ -151,8 +148,7 @@ extern "C"
|
||||
#define RGL_DEVICE_PARAMETERS_RESC_INTERLACE_MODE 0x0400
|
||||
#define RGL_DEVICE_PARAMETERS_RESC_ADJUST_ASPECT_RATIO 0x0800
|
||||
|
||||
|
||||
// mask for validation
|
||||
// mask for validation
|
||||
#define PSGL_VALIDATE_NONE 0x00000000
|
||||
#define PSGL_VALIDATE_FRAMEBUFFER 0x00000001
|
||||
#define PSGL_VALIDATE_TEXTURES_USED 0x00000002
|
||||
@ -222,33 +218,33 @@ extern "C"
|
||||
#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;
|
||||
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;
|
||||
// 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
|
||||
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;
|
||||
// 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
|
||||
@ -260,7 +256,7 @@ extern "C"
|
||||
#define PSGL_INIT_HOST_MEMORY_SIZE 0x0040
|
||||
#define PSGL_INIT_USE_PMQUERIES 0x0080
|
||||
|
||||
/* spoof as PSGL */
|
||||
/* spoof as PSGL */
|
||||
#define RGL_INIT_MAX_SPUS 0x0001
|
||||
#define RGL_INIT_INITIALIZE_SPUS 0x0002
|
||||
#define RGL_INIT_PERSISTENT_MEMORY_SIZE 0x0004
|
||||
@ -270,97 +266,55 @@ extern "C"
|
||||
#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;
|
||||
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 );
|
||||
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( PSGLinitOptions* options );
|
||||
extern PSGL_EXPORT void psglExit();
|
||||
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 PSGLdeviceParameters *parameters );
|
||||
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( PSGLdevice* device );
|
||||
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();
|
||||
PSGL_EXPORT void psglDestroyContext( PSGLcontext* LContext );
|
||||
PSGL_EXPORT void psglResetCurrentContext();
|
||||
PSGL_EXPORT PSGLcontext* psglGetCurrentContext();
|
||||
PSGL_EXPORT PSGLdevice* psglGetCurrentDevice();
|
||||
PSGL_EXPORT void psglSwap( void );
|
||||
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);
|
||||
|
||||
PSGL_EXPORT void psglLoadShaderLibrary( const char *filename );
|
||||
static inline PSGL_EXPORT void psglRescAdjustAspectRatio( const float horizontalScale, const float verticalScale )
|
||||
{
|
||||
cellRescAdjustAspectRatio( horizontalScale, verticalScale );
|
||||
}
|
||||
|
||||
PSGL_EXPORT void psglSetFlipHandler( void( *handler )( const GLuint head ) );
|
||||
PSGL_EXPORT void psglSetVBlankHandler( void( *handler )( const GLuint head ) );
|
||||
|
||||
PSGL_EXPORT GLboolean psglSetAllocatorFuncs( PSGLmallocFunc mallocFunc, PSGLmemalignFunc memalignFunc, PSGLreallocFunc reallocFunc, PSGLfreeFunc freeFunc );
|
||||
|
||||
PSGL_EXPORT void psglAddressToOffset(const void *address, GLuint *offset);
|
||||
PSGL_EXPORT void psglSetVertexProgramRegister(GLuint reg, const void * __restrict value);
|
||||
PSGL_EXPORT void psglSetVertexProgramRegisterBlock(GLuint reg, GLuint count, const void * __restrict value);
|
||||
PSGL_EXPORT void psglSetVertexProgramTransformBranchBits(GLuint values);
|
||||
PSGL_EXPORT void psglSetVertexProgramConfiguration(const CellCgbVertexProgramConfiguration *conf, const void *ucodeStorageAddress);
|
||||
|
||||
PSGL_EXPORT void psglSetFragmentProgramEmbeddedConstant(const GLuint offset, const GLfloat *value, const GLuint sizeInWords);
|
||||
PSGL_EXPORT void psglSetFragmentProgramConfiguration(const CellCgbFragmentProgramConfiguration *conf);
|
||||
|
||||
PSGL_EXPORT void psglSetFragmentProgramEmbeddedConstantMemoryLocation(const GLuint offset, const GLfloat *value, const GLuint sizeInWords, bool inLocalMemory);
|
||||
PSGL_EXPORT void psglSetFragmentProgramConfigurationMemoryLocation(const CellCgbFragmentProgramConfiguration *conf, bool inLocalMemory);
|
||||
|
||||
PSGL_EXPORT void psglSetUserClipPlanes( const GLuint userClipControlMask, const GLuint vertexOutputAttributeMask );
|
||||
|
||||
static inline PSGL_EXPORT void psglRescAdjustAspectRatio( const float horizontalScale, const float verticalScale )
|
||||
{ cellRescAdjustAspectRatio( horizontalScale, verticalScale ); }
|
||||
|
||||
#define PSGL_ADD_RETURN true
|
||||
#define PSGL_DO_NOT_ADD_RETURN false
|
||||
|
||||
#define PSGL_STALL true
|
||||
#define PSGL_DO_NOT_STALL false
|
||||
|
||||
// This funciton validates states specified in mask
|
||||
// mask - specify states to be validated
|
||||
// returns mask of states which was NOT validated
|
||||
PSGL_EXPORT GLuint psglValidateStates( GLuint mask );
|
||||
// This function invalidates states specified in mask
|
||||
// mask - specify states to be invalidateted
|
||||
PSGL_EXPORT void psglInvalidateStates( GLuint mask );
|
||||
|
||||
// This funciton validates attributes with index buffer at specified offset
|
||||
// indices - specify offset to index buffer object
|
||||
// isMain - true will be set if index buffer object is on main memory, false for local memory
|
||||
// returns RSX offset of index buffer
|
||||
PSGL_EXPORT GLuint psglValidateAttributes( const GLvoid* indices, GLboolean *isMain );
|
||||
// This function invalidates all attributes
|
||||
PSGL_EXPORT void psglInvalidateAttributes();
|
||||
|
||||
/* hw cursor error code */
|
||||
/* 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
|
||||
} // Close scope of 'extern "C"' declaration which encloses file.
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* RGL_EXPORT_H */
|
||||
|
@ -22,7 +22,7 @@
|
||||
BUFFERS
|
||||
============================================================ */
|
||||
|
||||
static rglBufferObject *rglCreateBufferObject(void)
|
||||
static rglBufferObject *rglCreateBufferObject (void)
|
||||
{
|
||||
GLuint size = sizeof( rglBufferObject ) + rglpBufferObjectSize();
|
||||
rglBufferObject *buffer = (rglBufferObject*)malloc(size);
|
||||
@ -1114,7 +1114,8 @@ RGLcontext* psglCreateContext(void)
|
||||
|
||||
rglResetContext( LContext );
|
||||
|
||||
if ( rglContextCreateHook ) rglContextCreateHook( LContext );
|
||||
if (rglContextCreateHook)
|
||||
rglContextCreateHook( LContext );
|
||||
|
||||
return( LContext );
|
||||
}
|
||||
@ -1131,8 +1132,9 @@ RGLcontext *psglGetCurrentContext(void)
|
||||
return _CurrentContext;
|
||||
}
|
||||
|
||||
void RGL_EXPORT psglDestroyContext( RGLcontext* LContext )
|
||||
void RGL_EXPORT psglDestroyContext (void *data)
|
||||
{
|
||||
RGLcontext *LContext = (RGLcontext*)data;
|
||||
if ( _CurrentContext == LContext )
|
||||
rglpFifoGlFinish();
|
||||
|
||||
@ -1161,9 +1163,7 @@ void RGL_EXPORT psglDestroyContext( RGLcontext* LContext )
|
||||
rglTexNameSpaceFree( &LContext->framebufferNameSpace );
|
||||
|
||||
if ( _CurrentContext == LContext )
|
||||
{
|
||||
psglMakeCurrent( NULL, NULL );
|
||||
}
|
||||
|
||||
free( LContext );
|
||||
}
|
||||
@ -1175,9 +1175,9 @@ void rglInvalidateAllStates (void *data)
|
||||
context->attribs->DirtyMask = ( 1 << RGL_MAX_VERTEX_ATTRIBS ) - 1;
|
||||
}
|
||||
|
||||
void rglAttachContext( RGLdevice *device, RGLcontext* context )
|
||||
void rglAttachContext (RGLdevice *device, RGLcontext* context)
|
||||
{
|
||||
if ( !context->everAttached )
|
||||
if (!context->everAttached)
|
||||
{
|
||||
context->ViewPort.XSize = device->deviceParameters.width;
|
||||
context->ViewPort.YSize = device->deviceParameters.height;
|
||||
@ -1289,9 +1289,11 @@ GLAPI void APIENTRY glDisableClientState( GLenum array )
|
||||
|
||||
GLAPI void APIENTRY glFlush(void)
|
||||
{
|
||||
RGLcontext* LContext = _CurrentContext;
|
||||
RGLcontext * LContext = _CurrentContext;
|
||||
|
||||
if (RGL_UNLIKELY(LContext->needValidate))
|
||||
rglValidateStates( RGL_VALIDATE_ALL );
|
||||
|
||||
rglPlatformRasterFlush();
|
||||
}
|
||||
|
||||
@ -1315,8 +1317,9 @@ GLAPI const GLubyte* APIENTRY glGetString( GLenum name )
|
||||
}
|
||||
}
|
||||
|
||||
void psglInit( RGLinitOptions* options )
|
||||
void psglInit (void *data)
|
||||
{
|
||||
RGLinitOptions *options = (RGLinitOptions*)data;
|
||||
rglPsglPlatformInit(options);
|
||||
}
|
||||
|
||||
@ -1346,8 +1349,8 @@ GLAPI void APIENTRY glViewport( GLint x, GLint y, GLsizei width, GLsizei height
|
||||
|
||||
rglTexture *rglAllocateTexture(void)
|
||||
{
|
||||
GLuint size = sizeof( rglTexture ) + rglPlatformTextureSize();
|
||||
rglTexture *texture = ( rglTexture * )malloc( size );
|
||||
GLuint size = sizeof(rglTexture) + rglPlatformTextureSize();
|
||||
rglTexture *texture = (rglTexture*)malloc(size);
|
||||
memset( texture, 0, size );
|
||||
texture->target = 0;
|
||||
texture->minFilter = GL_NEAREST_MIPMAP_LINEAR;
|
||||
@ -1396,10 +1399,12 @@ void rglFreeTexture (void *data)
|
||||
free( texture );
|
||||
}
|
||||
|
||||
void rglTextureUnbind( RGLcontext* context, GLuint name )
|
||||
void rglTextureUnbind (void *data, GLuint name )
|
||||
{
|
||||
RGLcontext *context = (RGLcontext*)data;
|
||||
int unit;
|
||||
for ( unit = 0;unit < RGL_MAX_TEXTURE_IMAGE_UNITS;++unit )
|
||||
|
||||
for ( unit = 0; unit < RGL_MAX_TEXTURE_IMAGE_UNITS; ++unit)
|
||||
{
|
||||
rglTextureImageUnit *tu = context->TextureImageUnits + unit;
|
||||
GLboolean dirty = GL_FALSE;
|
||||
@ -1442,10 +1447,14 @@ GLboolean rglTextureIsValid (const void *data)
|
||||
}
|
||||
|
||||
// Reallocate images held by a texture
|
||||
void rglReallocateImages( rglTexture *texture, GLint level, GLsizei dimension )
|
||||
void rglReallocateImages (void *data, GLint level, GLsizei dimension )
|
||||
{
|
||||
rglTexture *texture = (rglTexture*)data;
|
||||
GLuint oldCount = texture->imageCount;
|
||||
if ( dimension <= 0 ) dimension = 1;
|
||||
|
||||
if (dimension <= 0)
|
||||
dimension = 1;
|
||||
|
||||
GLuint n = level + 1 + rglLog2( dimension );
|
||||
n = MAX( n, oldCount );
|
||||
|
||||
@ -1457,8 +1466,9 @@ void rglReallocateImages( rglTexture *texture, GLint level, GLsizei dimension )
|
||||
}
|
||||
|
||||
// Get an enabled texture mode of a texture image unit
|
||||
GLenum rglGetEnabledTextureMode( const rglTextureImageUnit *unit )
|
||||
GLenum rglGetEnabledTextureMode (const void *data)
|
||||
{
|
||||
const rglTextureImageUnit *unit = (const rglTextureImageUnit*)data;
|
||||
// here, if fragment program is enabled and a valid program is set, get the enabled
|
||||
// units from the program instead of the texture units.
|
||||
if ( _CurrentContext->BoundFragmentProgram != NULL && _CurrentContext->FragmentProgram != GL_FALSE)
|
||||
@ -1469,8 +1479,9 @@ GLenum rglGetEnabledTextureMode( const rglTextureImageUnit *unit )
|
||||
return 0;
|
||||
}
|
||||
|
||||
rglTexture *rglGetCurrentTexture( const rglTextureImageUnit *unit, GLenum target )
|
||||
rglTexture *rglGetCurrentTexture (const void *data, GLenum target)
|
||||
{
|
||||
const rglTextureImageUnit *unit = (const rglTextureImageUnit*)data;
|
||||
RGLcontext* LContext = _CurrentContext;
|
||||
GLuint name = 0;
|
||||
rglTexture *defaultTexture = NULL;
|
||||
@ -1489,8 +1500,9 @@ rglTexture *rglGetCurrentTexture( const rglTextureImageUnit *unit, GLenum target
|
||||
return defaultTexture;
|
||||
}
|
||||
|
||||
void rglUpdateCurrentTextureCache( rglTextureImageUnit *unit )
|
||||
void rglUpdateCurrentTextureCache (void *data)
|
||||
{
|
||||
rglTextureImageUnit *unit = (rglTextureImageUnit*)data;
|
||||
GLenum target = rglGetEnabledTextureMode( unit );
|
||||
unit->currentTexture = rglGetCurrentTexture( unit, target );
|
||||
}
|
||||
@ -1526,12 +1538,13 @@ void rglBindTextureInternal (void *data, GLuint name, GLenum target )
|
||||
rglTextureImageUnit *unit = (rglTextureImageUnit*)data;
|
||||
RGLcontext* LContext = _CurrentContext;
|
||||
rglTexture *texture = NULL;
|
||||
if ( name )
|
||||
|
||||
if (name)
|
||||
{
|
||||
rglTexNameSpaceCreateNameLazy( &LContext->textureNameSpace, name );
|
||||
texture = ( rglTexture * )LContext->textureNameSpace.data[name];
|
||||
|
||||
if ( !texture->target )
|
||||
if (!texture->target)
|
||||
{
|
||||
texture->target = target;
|
||||
texture->faceCount = 1;
|
||||
@ -1568,10 +1581,13 @@ GLAPI void APIENTRY glGenTextures( GLsizei n, GLuint *textures )
|
||||
GLAPI void APIENTRY glDeleteTextures( GLsizei n, const GLuint *textures )
|
||||
{
|
||||
RGLcontext* LContext = _CurrentContext;
|
||||
|
||||
for ( int i = 0;i < n;++i )
|
||||
{
|
||||
if ( textures[i] ) rglTextureUnbind( LContext, textures[i] );
|
||||
if (textures[i])
|
||||
rglTextureUnbind( LContext, textures[i] );
|
||||
}
|
||||
|
||||
rglTexNameSpaceDeleteNames( &LContext->textureNameSpace, n, textures );
|
||||
}
|
||||
|
||||
@ -1763,12 +1779,12 @@ void rglVertexAttribPointerNV(
|
||||
GLenum type,
|
||||
GLboolean normalized,
|
||||
GLsizei stride,
|
||||
const GLvoid* pointer )
|
||||
const void* pointer)
|
||||
{
|
||||
RGLcontext* LContext = _CurrentContext;
|
||||
|
||||
GLsizei defaultStride = 0;
|
||||
switch ( type )
|
||||
switch (type)
|
||||
{
|
||||
case GL_FLOAT:
|
||||
case GL_HALF_FLOAT_ARB:
|
||||
@ -1791,7 +1807,7 @@ void rglVertexAttribPointerNV(
|
||||
attrib->clientSize = fsize;
|
||||
attrib->clientType = type;
|
||||
attrib->clientStride = stride ? stride : defaultStride;
|
||||
attrib->clientData = ( void* )pointer;
|
||||
attrib->clientData = (void*)pointer;
|
||||
attrib->arrayBuffer = LContext->ArrayBuffer;
|
||||
attrib->normalized = normalized;
|
||||
RGLBIT_ASSIGN( as->HasVBOMask, index, attrib->arrayBuffer != 0 );
|
||||
@ -1799,27 +1815,24 @@ void rglVertexAttribPointerNV(
|
||||
RGLBIT_TRUE( as->DirtyMask, index );
|
||||
}
|
||||
|
||||
void rglEnableVertexAttribArrayNV( GLuint index )
|
||||
void rglEnableVertexAttribArrayNV (GLuint index)
|
||||
{
|
||||
RGLcontext *LContext = _CurrentContext;
|
||||
|
||||
RGLBIT_TRUE( LContext->attribs->EnabledMask, index );
|
||||
RGLBIT_TRUE( LContext->attribs->DirtyMask, index );
|
||||
|
||||
}
|
||||
|
||||
void rglDisableVertexAttribArrayNV( GLuint index )
|
||||
void rglDisableVertexAttribArrayNV (GLuint index)
|
||||
{
|
||||
RGLcontext *LContext = _CurrentContext;
|
||||
|
||||
RGLBIT_FALSE( LContext->attribs->EnabledMask, index );
|
||||
RGLBIT_TRUE( LContext->attribs->DirtyMask, index );
|
||||
|
||||
}
|
||||
|
||||
void rglVertexAttrib1fNV( GLuint index, GLfloat x )
|
||||
void rglVertexAttrib1fNV (GLuint index, GLfloat x)
|
||||
{
|
||||
|
||||
RGLcontext* LContext = _CurrentContext;
|
||||
|
||||
rglAttribute* attrib = LContext->attribs->attrib + index;
|
||||
@ -1828,7 +1841,6 @@ void rglVertexAttrib1fNV( GLuint index, GLfloat x )
|
||||
attrib->value[2] = 0.0f;
|
||||
attrib->value[3] = 1.0f;
|
||||
RGLBIT_TRUE( LContext->attribs->DirtyMask, index );
|
||||
|
||||
}
|
||||
|
||||
void rglVertexAttrib2fNV( GLuint index, GLfloat x, GLfloat y )
|
||||
@ -1888,7 +1900,7 @@ void rglVertexAttrib4fvNV( GLuint index, const GLfloat* v )
|
||||
rglVertexAttrib4fNV( index, v[0], v[1], v[2], v[3] );
|
||||
}
|
||||
|
||||
GLAPI void APIENTRY glDrawArrays( GLenum mode, GLint first, GLsizei count )
|
||||
GLAPI void APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count)
|
||||
{
|
||||
RGLcontext* LContext = _CurrentContext;
|
||||
|
||||
@ -1920,9 +1932,10 @@ GLAPI void APIENTRY glDrawArrays( GLenum mode, GLint first, GLsizei count )
|
||||
|
||||
RGLdevice *_CurrentDevice = NULL;
|
||||
|
||||
void rglDeviceInit( RGLinitOptions* options )
|
||||
void rglDeviceInit (void *data)
|
||||
{
|
||||
rglPlatformDeviceInit( options );
|
||||
RGLinitOptions *options = (RGLinitOptions*)data;
|
||||
rglPlatformDeviceInit(options);
|
||||
}
|
||||
|
||||
void rglDeviceExit(void)
|
||||
@ -1935,39 +1948,45 @@ RGL_EXPORT RGLdevice* psglCreateDeviceAuto( GLenum colorFormat, GLenum depthForm
|
||||
return rglPlatformCreateDeviceAuto(colorFormat, depthFormat, multisamplingMode);
|
||||
}
|
||||
|
||||
RGL_EXPORT RGLdevice* psglCreateDeviceExtended( const RGLdeviceParameters *parameters )
|
||||
RGL_EXPORT RGLdevice* psglCreateDeviceExtended (const void *data)
|
||||
{
|
||||
const RGLdeviceParameters *parameters = (const RGLdeviceParameters*)data;
|
||||
return rglPlatformCreateDeviceExtended(parameters);
|
||||
}
|
||||
|
||||
RGL_EXPORT GLfloat psglGetDeviceAspectRatio( const RGLdevice * device )
|
||||
RGL_EXPORT GLfloat psglGetDeviceAspectRatio (const void *data)
|
||||
{
|
||||
const RGLdevice *device = (const RGLdevice*)data;
|
||||
return rglPlatformGetDeviceAspectRatio(device);
|
||||
}
|
||||
|
||||
RGL_EXPORT void psglGetDeviceDimensions( const RGLdevice * device, GLuint *width, GLuint *height )
|
||||
RGL_EXPORT void psglGetDeviceDimensions (const RGLdevice * device, GLuint *width, GLuint *height)
|
||||
{
|
||||
*width = device->deviceParameters.width;
|
||||
*height = device->deviceParameters.height;
|
||||
}
|
||||
|
||||
RGL_EXPORT void psglGetRenderBufferDimensions( const RGLdevice * device, GLuint *width, GLuint *height )
|
||||
RGL_EXPORT void psglGetRenderBufferDimensions (const RGLdevice * device, GLuint *width, GLuint *height)
|
||||
{
|
||||
*width = device->deviceParameters.renderWidth;
|
||||
*height = device->deviceParameters.renderHeight;
|
||||
}
|
||||
|
||||
RGL_EXPORT void psglDestroyDevice( RGLdevice *device )
|
||||
RGL_EXPORT void psglDestroyDevice (void *data)
|
||||
{
|
||||
if ( _CurrentDevice == device ) psglMakeCurrent( NULL, NULL );
|
||||
RGLdevice *device = (RGLdevice*)data;
|
||||
if (_CurrentDevice == device)
|
||||
psglMakeCurrent( NULL, NULL );
|
||||
|
||||
if (device->rasterDriver)
|
||||
rglPlatformRasterExit( device->rasterDriver );
|
||||
|
||||
if ( device->rasterDriver ) rglPlatformRasterExit( device->rasterDriver );
|
||||
rglPlatformDestroyDevice( device );
|
||||
|
||||
free( device );
|
||||
}
|
||||
|
||||
void RGL_EXPORT psglMakeCurrent( RGLcontext *context, RGLdevice *device )
|
||||
void RGL_EXPORT psglMakeCurrent (RGLcontext *context, RGLdevice *device)
|
||||
{
|
||||
if ( context && device )
|
||||
{
|
||||
@ -1988,13 +2007,13 @@ void RGL_EXPORT psglMakeCurrent( RGLcontext *context, RGLdevice *device )
|
||||
}
|
||||
}
|
||||
|
||||
RGLdevice *psglGetCurrentDevice(void)
|
||||
RGLdevice *psglGetCurrentDevice (void)
|
||||
{
|
||||
return _CurrentDevice;
|
||||
}
|
||||
|
||||
GLAPI void RGL_EXPORT psglSwap( void )
|
||||
GLAPI void RGL_EXPORT psglSwap (void)
|
||||
{
|
||||
if ( _CurrentDevice != NULL )
|
||||
if ( _CurrentDevice != NULL)
|
||||
rglPlatformSwapBuffers( _CurrentDevice );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user