(RGL) Tweaks
This commit is contained in:
parent
fd3ee5a9dd
commit
7fb25a76c8
|
@ -107,7 +107,7 @@ GLuint nvFenceCounter = 0;
|
|||
|
||||
#define DECLARE_TYPE(TYPE,CTYPE,MAXVAL) \
|
||||
typedef CTYPE type_##TYPE; \
|
||||
static inline type_##TYPE _RGLFloatTo_##TYPE(float v) { return (type_##TYPE)(_RGLClampf(v)*MAXVAL); } \
|
||||
static inline type_##TYPE _RGLFloatTo_##TYPE(float v) { return (type_##TYPE)((MAX(MIN(v, 1.f), 0.f)) * MAXVAL); } \
|
||||
static inline float _RGLFloatFrom_##TYPE(type_##TYPE v) { return ((float)v)/MAXVAL; }
|
||||
DECLARE_C_TYPES
|
||||
#undef DECLARE_TYPE
|
||||
|
@ -256,6 +256,7 @@ static inline void _RGLFifoGlVertexAttribPointer
|
|||
GLuint offset
|
||||
)
|
||||
{
|
||||
|
||||
switch(size)
|
||||
{
|
||||
case 0:
|
||||
|
@ -282,24 +283,19 @@ static inline void _RGLFifoGlVertexAttribPointer
|
|||
else
|
||||
gcmType = CELL_GCM_VERTEX_UB256;
|
||||
break;
|
||||
|
||||
case RGL_SHORT:
|
||||
gcmType = normalized ? CELL_GCM_VERTEX_S1 : CELL_GCM_VERTEX_S32K;
|
||||
break;
|
||||
|
||||
case RGL_FLOAT:
|
||||
gcmType = CELL_GCM_VERTEX_F;
|
||||
break;
|
||||
|
||||
case RGL_HALF_FLOAT:
|
||||
gcmType = CELL_GCM_VERTEX_SF;
|
||||
break;
|
||||
|
||||
case RGL_CMP:
|
||||
size = 1;
|
||||
gcmType = CELL_GCM_VERTEX_CMP;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -379,8 +375,10 @@ static void _RGLAttribSetDeleteBuffer( PSGLcontext *LContext, GLuint buffName )
|
|||
jsAttribSet *attribSet = bufferObject->attribSets[i];
|
||||
|
||||
for(GLuint j = 0; j < MAX_VERTEX_ATTRIBS; ++j)
|
||||
{
|
||||
if(attribSet->attribs.attrib[j].arrayBuffer == buffName)
|
||||
attribSet->attribs.attrib[j].arrayBuffer = 0;
|
||||
}
|
||||
|
||||
attribSet->dirty = GL_TRUE;
|
||||
}
|
||||
|
@ -432,6 +430,7 @@ static void _RGLFreeBufferObject( jsBufferObject *buffer )
|
|||
_RGLPlatformDestroyBufferObject( buffer );
|
||||
buffer->textureReferences.~Vector<jsTexture *>();
|
||||
buffer->attribSets.~Vector<jsAttribSet *>();
|
||||
|
||||
if(buffer != NULL)
|
||||
free( buffer );
|
||||
}
|
||||
|
@ -479,8 +478,10 @@ GLAPI void APIENTRY glDeleteBuffers(GLsizei n, const GLuint *buffers)
|
|||
if(buffers[i] )
|
||||
{
|
||||
GLuint name = buffers[i];
|
||||
|
||||
if(LContext->ArrayBuffer == name)
|
||||
LContext->ArrayBuffer = 0;
|
||||
|
||||
if(LContext->PixelUnpackBuffer == name)
|
||||
LContext->PixelUnpackBuffer = 0;
|
||||
|
||||
|
@ -504,11 +505,6 @@ GLAPI void APIENTRY glGenBuffers(GLsizei n, GLuint *buffers)
|
|||
_RGLTexNameSpaceGenNames( &LContext->bufferObjectNameSpace, n, buffers );
|
||||
}
|
||||
|
||||
static inline jsFramebuffer *_RGLGetFramebuffer(PSGLcontext *LContext, GLuint name)
|
||||
{
|
||||
return (jsFramebuffer *)LContext->framebufferNameSpace.data[name];
|
||||
}
|
||||
|
||||
static inline void _RGLTextureTouchFBOs(jsTexture *texture)
|
||||
{
|
||||
PSGLcontext *LContext = _CurrentContext;
|
||||
|
@ -516,9 +512,10 @@ static inline void _RGLTextureTouchFBOs(jsTexture *texture)
|
|||
return;
|
||||
|
||||
GLuint fbCount = texture->framebuffers.getCount();
|
||||
|
||||
if(fbCount > 0)
|
||||
{
|
||||
jsFramebuffer *contextFramebuffer = LContext->framebuffer ? _RGLGetFramebuffer( LContext, LContext->framebuffer ) : NULL;
|
||||
jsFramebuffer *contextFramebuffer = LContext->framebuffer ? (jsFramebuffer *)LContext->framebufferNameSpace.data[LContext->framebuffer] : NULL;
|
||||
|
||||
for (GLuint i = 0; i < fbCount; ++i)
|
||||
{
|
||||
|
@ -644,6 +641,7 @@ static void _RGLPlatformBufferObjectSetData( jsBufferObject* bufferObject, GLint
|
|||
unsigned int dstId = jsBuffer->bufferId;
|
||||
unsigned int pitch = jsBuffer->pitch;
|
||||
const char *src = (const char *)data;
|
||||
|
||||
switch ( bufferObject->usage )
|
||||
{
|
||||
case GL_STREAM_DRAW:
|
||||
|
@ -835,6 +833,7 @@ static void _RGLFramebufferGetAttachmentTexture(
|
|||
jsTexture** texture)
|
||||
{
|
||||
PSGLcontext* LContext = _CurrentContext;
|
||||
|
||||
switch ( attachment->type )
|
||||
{
|
||||
case FRAMEBUFFER_ATTACHMENT_NONE:
|
||||
|
@ -857,13 +856,16 @@ static GLboolean _RGLTextureIsValid( const jsTexture* texture )
|
|||
return GL_FALSE;
|
||||
if ( !texture->image )
|
||||
return GL_FALSE;
|
||||
|
||||
const jsImage* image = texture->image;
|
||||
|
||||
int width = image->width;
|
||||
int height = image->height;
|
||||
|
||||
GLenum format = image->format;
|
||||
GLenum type = image->type;
|
||||
GLenum internalFormat = image->internalFormat;
|
||||
|
||||
if (( internalFormat == 0 ) || ( format == 0 ) || ( type == 0 ) )
|
||||
return GL_FALSE;
|
||||
|
||||
|
@ -933,29 +935,36 @@ static GLenum _RGLPlatformFramebufferCheckStatus(jsFramebuffer* framebuffer)
|
|||
return GL_FRAMEBUFFER_COMPLETE_OES;
|
||||
}
|
||||
|
||||
enum _RGLTextureStrategy {
|
||||
_RGL_TEXTURE_STRATEGY_END,
|
||||
_RGL_TEXTURE_STRATEGY_UNTILED_ALLOC,
|
||||
_RGL_TEXTURE_STRATEGY_UNTILED_CLEAR,
|
||||
enum _RGLTextureStrategy
|
||||
{
|
||||
TEXTURE_STRATEGY_END,
|
||||
TEXTURE_STRATEGY_UNTILED_ALLOC,
|
||||
TEXTURE_STRATEGY_UNTILED_CLEAR,
|
||||
};
|
||||
|
||||
static enum _RGLTextureStrategy linearGPUStrategy[] =
|
||||
{
|
||||
_RGL_TEXTURE_STRATEGY_UNTILED_ALLOC,
|
||||
_RGL_TEXTURE_STRATEGY_UNTILED_CLEAR,
|
||||
_RGL_TEXTURE_STRATEGY_UNTILED_ALLOC,
|
||||
_RGL_TEXTURE_STRATEGY_END,
|
||||
TEXTURE_STRATEGY_UNTILED_ALLOC,
|
||||
TEXTURE_STRATEGY_UNTILED_CLEAR,
|
||||
TEXTURE_STRATEGY_UNTILED_ALLOC,
|
||||
TEXTURE_STRATEGY_END,
|
||||
};
|
||||
|
||||
static void _RGLImageAllocCPUStorage( jsImage *image )
|
||||
{
|
||||
if((image->storageSize > image->mallocStorageSize) || (!image->mallocData))
|
||||
{
|
||||
if ( image->mallocData ) free( image->mallocData );
|
||||
if(image->mallocData)
|
||||
free( image->mallocData );
|
||||
|
||||
image->mallocData = ( char * )malloc( image->storageSize + 128 );
|
||||
image->mallocStorageSize = image->storageSize;
|
||||
}
|
||||
image->data = _RGLPadPtr( image->mallocData, 128 );
|
||||
|
||||
intptr_t x = (intptr_t)image->mallocData;
|
||||
x = ( x + 128 - 1 ) / 128 * 128;
|
||||
image->data = (char*)x;
|
||||
|
||||
}
|
||||
|
||||
static inline int _RGLGetComponentCount( GLenum format )
|
||||
|
@ -1272,11 +1281,6 @@ int _RGLGetPixelSize( GLenum format, GLenum type )
|
|||
return _RGLGetComponentCount( format )*componentSize;
|
||||
}
|
||||
|
||||
static inline int _RGLGetStorageSize( GLenum format, GLenum type, GLsizei width, GLsizei height, GLsizei depth )
|
||||
{
|
||||
return _RGLGetPixelSize( format, type )*width*height*depth;
|
||||
}
|
||||
|
||||
static void _RGLPlatformChooseGPUFormatAndLayout(
|
||||
const jsTexture* texture,
|
||||
GLboolean forceLinear,
|
||||
|
@ -1289,18 +1293,20 @@ static void _RGLPlatformChooseGPUFormatAndLayout(
|
|||
newLayout->baseHeight = image->height;
|
||||
newLayout->internalFormat = ( RGLEnum )image->internalFormat;
|
||||
newLayout->pixelBits = _RGLPlatformGetBitsPerPixel( newLayout->internalFormat );
|
||||
newLayout->pitch = pitch ? pitch : _RGLPad( _RGLGetStorageSize( texture->image->format, texture->image->type, texture->image->width, 1, 1 ), 64 );
|
||||
newLayout->pitch = pitch ? pitch : _RGLPad( _RGLGetPixelSize( texture->image->format, texture->image->type )*texture->image->width, 64);
|
||||
}
|
||||
|
||||
void _RGLPlatformDropUnboundTextures(GLenum pool)
|
||||
{
|
||||
PSGLcontext* LContext = _CurrentContext;
|
||||
GLuint i, j;
|
||||
|
||||
for (i = 0; i < LContext->textureNameSpace.capacity; ++i)
|
||||
{
|
||||
GLboolean bound = GL_FALSE;
|
||||
jsTexture *texture = ( jsTexture * )LContext->textureNameSpace.data[i];
|
||||
if ( !texture || ( texture->referenceBuffer != 0 ) ) continue;
|
||||
if(!texture || (texture->referenceBuffer != 0))
|
||||
continue;
|
||||
|
||||
for (j = 0; j < _RGL_MAX_VERTEX_TEXTURE_IMAGE_UNITS; ++j)
|
||||
{
|
||||
|
@ -1355,7 +1361,7 @@ static void _RGLPlatformReallocateGcmTexture( jsTexture* texture )
|
|||
|
||||
switch ( *step++ )
|
||||
{
|
||||
case _RGL_TEXTURE_STRATEGY_UNTILED_ALLOC:
|
||||
case TEXTURE_STRATEGY_UNTILED_ALLOC:
|
||||
_RGLPlatformChooseGPUFormatAndLayout( texture, GL_TRUE, 0, &newLayout );
|
||||
size = _RGLPad( newLayout.baseHeight * newLayout.pitch, 1);
|
||||
|
||||
|
@ -1388,10 +1394,10 @@ static void _RGLPlatformReallocateGcmTexture( jsTexture* texture )
|
|||
}
|
||||
}
|
||||
break;
|
||||
case _RGL_TEXTURE_STRATEGY_UNTILED_CLEAR:
|
||||
case TEXTURE_STRATEGY_UNTILED_CLEAR:
|
||||
_RGLPlatformDropUnboundTextures(SURFACE_POOL_LINEAR);
|
||||
break;
|
||||
case _RGL_TEXTURE_STRATEGY_END:
|
||||
case TEXTURE_STRATEGY_END:
|
||||
_RGLSetError( GL_OUT_OF_MEMORY );
|
||||
done = GL_TRUE;
|
||||
break;
|
||||
|
@ -1558,6 +1564,7 @@ static void jsPlatformFramebuffer_validate( jsPlatformFramebuffer * fb, PSGLcont
|
|||
GLuint defaultPitch = 0;
|
||||
GLuint defaultId = GMM_ERROR;
|
||||
GLuint defaultIdOffset = 0;
|
||||
|
||||
for(int i = 0; i < RGL_SETRENDERTARGET_MAXCOUNT; ++i)
|
||||
{
|
||||
jsTexture* colorTexture = NULL;
|
||||
|
@ -1618,7 +1625,7 @@ static void _RGLValidateFramebuffer( void )
|
|||
|
||||
if(LContext->framebuffer)
|
||||
{
|
||||
jsPlatformFramebuffer* framebuffer = static_cast<jsPlatformFramebuffer *>( _RGLGetFramebuffer( LContext, LContext->framebuffer ) );
|
||||
jsPlatformFramebuffer* framebuffer = static_cast<jsPlatformFramebuffer *>((jsFramebuffer *)LContext->framebufferNameSpace.data[LContext->framebuffer] );
|
||||
|
||||
if ( framebuffer->needValidate )
|
||||
jsPlatformFramebuffer_validate( framebuffer, LContext );
|
||||
|
@ -1721,10 +1728,10 @@ GLAPI void APIENTRY glClearColor( GLclampf red, GLclampf green, GLclampf blue, G
|
|||
{
|
||||
PSGLcontext *LContext = _CurrentContext;
|
||||
|
||||
LContext->ClearColor.R = _RGLClampf( red );
|
||||
LContext->ClearColor.G = _RGLClampf( green );
|
||||
LContext->ClearColor.B = _RGLClampf( blue );
|
||||
LContext->ClearColor.A = _RGLClampf( alpha );
|
||||
LContext->ClearColor.R = MAX(MIN(red, 1.f), 0.f);
|
||||
LContext->ClearColor.G = MAX(MIN(green, 1.f), 0.f);
|
||||
LContext->ClearColor.B = MAX(MIN(blue, 1.f), 0.f);
|
||||
LContext->ClearColor.A = MAX(MIN(alpha, 1.f), 0.f);
|
||||
}
|
||||
|
||||
GLAPI void APIENTRY glBlendEquation( GLenum mode )
|
||||
|
@ -1738,15 +1745,14 @@ GLAPI void APIENTRY glBlendEquation( GLenum mode )
|
|||
GLAPI void APIENTRY glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
|
||||
{
|
||||
PSGLcontext* LContext = _CurrentContext;
|
||||
LContext->BlendColor.R = _RGLClampf( red );
|
||||
LContext->BlendColor.G = _RGLClampf( green );
|
||||
LContext->BlendColor.B = _RGLClampf( blue );
|
||||
LContext->BlendColor.A = _RGLClampf( alpha );
|
||||
LContext->BlendColor.R = MAX(MIN(red, 1.f), 0.f);
|
||||
LContext->BlendColor.G = MAX(MIN(green, 1.f), 0.f);
|
||||
LContext->BlendColor.B = MAX(MIN(blue, 1.f), 0.f);
|
||||
LContext->BlendColor.A = MAX(MIN(alpha, 1.f), 0.f);
|
||||
|
||||
LContext->needValidate |= PSGL_VALIDATE_BLENDING;
|
||||
}
|
||||
|
||||
|
||||
GLAPI void APIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor)
|
||||
{
|
||||
PSGLcontext *LContext = _CurrentContext;
|
||||
|
@ -1814,7 +1820,7 @@ GLAPI GLenum APIENTRY glCheckFramebufferStatusOES( GLenum target )
|
|||
|
||||
if ( LContext->framebuffer )
|
||||
{
|
||||
jsFramebuffer* framebuffer = _RGLGetFramebuffer( LContext, LContext->framebuffer );
|
||||
jsFramebuffer* framebuffer = (jsFramebuffer *)LContext->framebufferNameSpace.data[LContext->framebuffer];
|
||||
return _RGLPlatformFramebufferCheckStatus( framebuffer );
|
||||
}
|
||||
|
||||
|
@ -1825,7 +1831,7 @@ GLAPI void APIENTRY glFramebufferTexture2DOES( GLenum target, GLenum attachment,
|
|||
{
|
||||
PSGLcontext* LContext = _CurrentContext;
|
||||
|
||||
jsFramebuffer* framebuffer = _RGLGetFramebuffer( LContext, LContext->framebuffer );
|
||||
jsFramebuffer* framebuffer = (jsFramebuffer *)LContext->framebufferNameSpace.data[LContext->framebuffer];
|
||||
|
||||
jsFramebufferAttachment* attach = _RGLFramebufferGetAttachment( framebuffer, GL_COLOR_ATTACHMENT0_EXT );
|
||||
|
||||
|
@ -2095,10 +2101,7 @@ static uint32_t gmmInitFixedAllocator (void)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
static void gmmRemovePendingFree(
|
||||
GmmAllocator *pAllocator,
|
||||
GmmBlock *pBlock
|
||||
)
|
||||
static void gmmRemovePendingFree(GmmAllocator *pAllocator, GmmBlock *pBlock)
|
||||
{
|
||||
if (pBlock == pAllocator->pPendingFreeHead)
|
||||
pAllocator->pPendingFreeHead = pBlock->pNextFree;
|
||||
|
@ -3268,10 +3271,10 @@ template<int SIZE> inline static void swapandsetfp( int ucodeSize, unsigned int
|
|||
unsigned short count = *( ec++ );
|
||||
for ( unsigned long offsetIndex = 0; offsetIndex < count; ++offsetIndex )
|
||||
{
|
||||
void *pointer=NULL;
|
||||
void *ptr = NULL;
|
||||
const int paddedSIZE = (SIZE + 1) & ~1;
|
||||
cellGcmSetInlineTransferPointerInline( &_RGLState.fifo, gmmIdToOffset( loadProgramId ) + loadProgramOffset + *(ec++), paddedSIZE, &pointer);
|
||||
float *fp = (float*)pointer;
|
||||
cellGcmSetInlineTransferPointerInline( &_RGLState.fifo, gmmIdToOffset( loadProgramId ) + loadProgramOffset + *(ec++), paddedSIZE, &ptr);
|
||||
float *fp = (float*)ptr;
|
||||
float *src = (float*)v;
|
||||
for (uint32_t j=0; j<SIZE;j++)
|
||||
{
|
||||
|
@ -3294,6 +3297,7 @@ template<int SIZE> static void setVectorTypefp( CgRuntimeParameter* __restrict p
|
|||
CgParameterResource *parameterResource = _RGLGetParameterResource( ptr->program, ptr->parameterEntry );
|
||||
unsigned short resource = parameterResource->resource;
|
||||
unsigned short *ec = ( unsigned short * )( ptr->program->resources ) + resource + 1;
|
||||
|
||||
if ( RGL_LIKELY( *ec ) )
|
||||
{
|
||||
swapandsetfp<SIZE>(program->header.instructionCount*16, program->loadProgramId, program->loadProgramOffset, ec, (unsigned int *)data);
|
||||
|
@ -3408,10 +3412,9 @@ template <int ROWS, int COLS, int ORDER> static void setMatrixSharedvpIndex( CgR
|
|||
for ( long row = 0; row < ROWS; ++row )
|
||||
{
|
||||
for(long col = 0; col < COLS; ++col)
|
||||
{
|
||||
tmp[row*4 + col] = dst[row * 4 + col] = ( ORDER == ROW_MAJOR ) ? f[row * COLS + col] : f[col * ROWS + row];
|
||||
}
|
||||
for ( long col = COLS; col < 4; ++col ) tmp[row*4 + col] = dst[row*4+col];
|
||||
for(long col = COLS; col < 4; ++col)
|
||||
tmp[row*4 + col] = dst[row*4+col];
|
||||
}
|
||||
|
||||
cellGcmSetVertexProgramParameterBlockInline( &_RGLState.fifo, resource, ROWS, (const float*)tmp);
|
||||
|
@ -4407,13 +4410,6 @@ static void _RGLPlatformDestroyTexture( jsTexture* texture )
|
|||
_RGLTextureTouchFBOs( texture );
|
||||
}
|
||||
|
||||
// Get size of texture in GPU layout
|
||||
static inline GLuint _RGLPlatformTextureGetGPUSize( const jsTexture* texture )
|
||||
{
|
||||
RGLTexture *gcmTexture = ( RGLTexture * )texture->platformTexture;
|
||||
return _RGLPad( gcmTexture->gpuLayout.baseHeight * gcmTexture->gpuLayout.pitch, 1);
|
||||
}
|
||||
|
||||
#include <cell/gcm/gcm_method_data.h>
|
||||
|
||||
static void _RGLPlatformValidateTextureStage( int unit, jsTexture* texture )
|
||||
|
@ -4573,9 +4569,7 @@ static GLenum _RGLPlatformChooseInternalStorage( jsImage* image, GLenum internal
|
|||
image->internalFormat = platformInternalFormat;
|
||||
_RGLPlatformExpandInternalFormat( platformInternalFormat, &image->format, &image->type );
|
||||
|
||||
image->storageSize = _RGLGetStorageSize(
|
||||
image->format, image->type,
|
||||
image->width, image->height, 1 );
|
||||
image->storageSize = _RGLGetPixelSize(image->format, image->type) * image->width * image->height;
|
||||
|
||||
return GL_NO_ERROR;
|
||||
}
|
||||
|
@ -4662,9 +4656,7 @@ static GLboolean _RGLPlatformTexturePBOImage(
|
|||
if ( LContext->PixelUnpackBuffer == 0 )
|
||||
return GL_FALSE;
|
||||
|
||||
const GLuint pboPitch = _RGLPad(
|
||||
_RGLGetStorageSize( format, type, width, 1, 1 ),
|
||||
LContext->unpackAlignment );
|
||||
const GLuint pboPitch = _RGLPad(_RGLGetPixelSize(format, type) * width, LContext->unpackAlignment );
|
||||
if (( pboPitch&3 ) != 0 )
|
||||
{
|
||||
RARCH_WARN("PBO image pitch not a multiple of 4, using slow path.\n" );
|
||||
|
@ -4722,14 +4714,15 @@ static GLboolean _RGLPlatformTexturePBOImage(
|
|||
{
|
||||
gcmTexture->gpuLayout = newLayout;
|
||||
if ( gcmTexture->gpuAddressId != GMM_ERROR && gcmTexture->pbo == NULL )
|
||||
{
|
||||
_RGLPlatformFreeGcmTexture( texture );
|
||||
}
|
||||
|
||||
gcmTexture->pbo = bufferObject;
|
||||
gcmTexture->gpuAddressId = gpuId;
|
||||
gcmTexture->gpuAddressIdOffset = gpuIdOffset;
|
||||
gcmTexture->pool = SURFACE_POOL_LINEAR;
|
||||
gcmTexture->gpuSize = _RGLPlatformTextureGetGPUSize( texture );
|
||||
RGLTexture *gcmTexture = ( RGLTexture * )texture->platformTexture;
|
||||
// Get size of texture in GPU layout
|
||||
gcmTexture->gpuSize = _RGLPad( gcmTexture->gpuLayout.baseHeight * gcmTexture->gpuLayout.pitch, 1);
|
||||
++bufferObject->refCount;
|
||||
}
|
||||
else
|
||||
|
@ -6584,7 +6577,7 @@ static _CGprogram* _RGLCgProgramFindPrev( _CGcontext* ctx, _CGprogram* prog )
|
|||
{
|
||||
_CGprogram* ptr = ctx->programList;
|
||||
|
||||
while ( NULL != ptr && prog != ptr->next )
|
||||
while ( ptr != NULL && prog != ptr->next )
|
||||
ptr = ptr->next;
|
||||
|
||||
return ptr;
|
||||
|
@ -6838,7 +6831,9 @@ static CGprogram _RGLCgCreateProgram( CGcontext ctx, CGprofile profile, const Cg
|
|||
|
||||
// success! add the program to the program list in the context.
|
||||
_RGLCgProgramPushFront(prog->parentContext, prog);
|
||||
if ( _cgProgramCreateHook ) _cgProgramCreateHook( prog );
|
||||
|
||||
if(_cgProgramCreateHook)
|
||||
_cgProgramCreateHook(prog);
|
||||
|
||||
// everything worked.
|
||||
return id;
|
||||
|
@ -7235,7 +7230,8 @@ CG_API CGprogram cgCopyProgram( CGprogram program )
|
|||
|
||||
_RGLCgProgramPushFront(newprog->parentContext, newprog);
|
||||
|
||||
if ( _cgProgramCopyHook ) _cgProgramCopyHook( newprog, prog );
|
||||
if(_cgProgramCopyHook)
|
||||
_cgProgramCopyHook(newprog, prog);
|
||||
|
||||
return newprog->id;
|
||||
}
|
||||
|
@ -7248,7 +7244,9 @@ CG_API void cgDestroyProgram( CGprogram program )
|
|||
_RGLCgRaiseError( CG_INVALID_PROGRAM_HANDLE_ERROR );
|
||||
return;
|
||||
}
|
||||
|
||||
_CGprogram* ptr = _cgGetProgPtr( program );
|
||||
|
||||
if ( ptr == NULL )
|
||||
{
|
||||
_RGLCgRaiseError( CG_INVALID_PROGRAM_HANDLE_ERROR );
|
||||
|
@ -8109,12 +8107,6 @@ CGGL_API void cgGLEnableTextureParameter( CGparameter param )
|
|||
ptr->samplerSetter( ptr, NULL, 0 );
|
||||
}
|
||||
|
||||
static void _RGLCgContextZero( _CGcontext* p )
|
||||
{
|
||||
memset( p, 0, sizeof( *p ) );
|
||||
p->compileType = CG_UNKNOWN;
|
||||
}
|
||||
|
||||
static void _RGLCgContextPushFront(_CGcontext* ctx)
|
||||
{
|
||||
if(_CurrentContext->RGLcgContextHead)
|
||||
|
@ -8131,7 +8123,9 @@ static void destroy_context(_CGcontext*ctx)
|
|||
_cgContextDestroyHook(ctx);
|
||||
|
||||
_RGLEraseName( &_CurrentContext->cgContextNameSpace, ( jsName )ctx->id );
|
||||
_RGLCgContextZero( ctx );
|
||||
memset(ctx, 0, sizeof( *ctx ) );
|
||||
ctx->compileType = CG_UNKNOWN;
|
||||
|
||||
free( ctx );
|
||||
}
|
||||
|
||||
|
@ -8146,7 +8140,8 @@ CG_API CGcontext cgCreateContext(void)
|
|||
return ( CGcontext )NULL;
|
||||
}
|
||||
|
||||
_RGLCgContextZero( ptr );
|
||||
memset( ptr, 0, sizeof( *ptr ) );
|
||||
ptr->compileType = CG_UNKNOWN;
|
||||
|
||||
CGcontext result = ( CGcontext )_RGLCreateName( &_CurrentContext->cgContextNameSpace, ptr );
|
||||
if ( !result )
|
||||
|
|
|
@ -550,11 +550,6 @@ struct PSGLcontext
|
|||
#define RGL_LIKELY(COND) (COND)
|
||||
#define RGL_UNLIKELY(COND) (COND)
|
||||
|
||||
static inline float _RGLClampf( const float value )
|
||||
{
|
||||
return MAX( MIN( value, 1.f ), 0.f );
|
||||
}
|
||||
|
||||
static inline unsigned int endianSwapWord( unsigned int v )
|
||||
{
|
||||
return ( v&0xff ) << 24 | ( v&0xff00 ) << 8 |
|
||||
|
@ -577,13 +572,6 @@ static inline unsigned long _RGLPad(unsigned long x, unsigned long pad)
|
|||
return ( x + pad - 1 ) / pad*pad;
|
||||
}
|
||||
|
||||
static inline char* _RGLPadPtr(const char* p, unsigned int pad)
|
||||
{
|
||||
intptr_t x = (intptr_t)p;
|
||||
x = ( x + pad - 1 ) / pad * pad;
|
||||
return ( char* )x;
|
||||
}
|
||||
|
||||
typedef struct MemoryBlockManager_t_
|
||||
{
|
||||
char *memory;
|
||||
|
@ -927,7 +915,7 @@ static inline GLuint _RGLPlatformGetBitsPerPixel( GLenum internalFormat )
|
|||
}
|
||||
|
||||
|
||||
void static inline _RGLFifoGlViewport( GLint x, GLint y, GLsizei width, GLsizei height, GLclampf zNear = 0.0f, GLclampf zFar = 1.0f )
|
||||
static inline void _RGLFifoGlViewport( GLint x, GLint y, GLsizei width, GLsizei height, GLclampf zNear = 0.0f, GLclampf zFar = 1.0f )
|
||||
{
|
||||
RGLViewportState *vp = &_RGLState.state.viewport;
|
||||
RGLRenderTarget *rt = &_RGLState.renderTarget;
|
||||
|
|
Loading…
Reference in New Issue