(RGL PS3) Get rid of pushBack in RGLVector

This commit is contained in:
twinaphex 2014-02-18 01:36:49 +01:00
parent dc98252d82
commit 346557c7d6
2 changed files with 23 additions and 4 deletions

View File

@ -25,10 +25,8 @@ namespace RGL
for ( unsigned int i = 0;i < count;++i )
( array + i )->~T();
count = 0;
}
if (array)
free(array);
}
array = 0;
}

View File

@ -2515,6 +2515,26 @@ GLenum rglPlatformChooseInternalStorage (void *data, GLenum internalFormat )
return GL_NO_ERROR;
}
static inline void textureReferences_pushBack(rglTexture *element)
{
RGLcontext* LContext = (RGLcontext*)_CurrentContext;
rglTexture *texture = (rglTexture*)rglGetCurrentTexture( LContext->CurrentImageUnit, GL_TEXTURE_2D );
rglBufferObject *bufferObject = (rglBufferObject*)LContext->bufferObjectNameSpace.data[LContext->TextureBuffer];
uint32_t newCapacity = bufferObject->textureReferences.count + 1;
if (newCapacity > bufferObject->textureReferences.capacity)
{
if ( newCapacity > bufferObject->textureReferences.capacity )
newCapacity = ( newCapacity > bufferObject->textureReferences.capacity + bufferObject->textureReferences.increment ) ? newCapacity : ( bufferObject->textureReferences.capacity + bufferObject->textureReferences.increment );
bufferObject->textureReferences.array = (rglTexture**)realloc((void *)(bufferObject->textureReferences.array), sizeof(rglTexture) * newCapacity);
bufferObject->textureReferences.capacity = newCapacity;
}
new((void *)(bufferObject->textureReferences.array + bufferObject->textureReferences.count))rglTexture((const rglTexture&)element);
++bufferObject->textureReferences.count;
}
GLAPI void APIENTRY glTextureReferenceSCE( GLenum target, GLuint levels,
GLuint baseWidth, GLuint baseHeight, GLuint baseDepth, GLenum internalFormat, GLuint pitch, GLintptr offset )
{
@ -2594,7 +2614,8 @@ GLAPI void APIENTRY glTextureReferenceSCE( GLenum target, GLuint levels,
texture->revalidate |= RGL_TEXTURE_REVALIDATE_PARAMETERS;
rglTextureTouchFBOs( texture );
bufferObject->textureReferences.pushBack( texture );
textureReferences_pushBack(texture);
texture->referenceBuffer = bufferObject;
texture->offset = offset;
rglTextureTouchFBOs( texture );