(RGL PS3) Take out pushBack from RGLVector

This commit is contained in:
twinaphex 2014-02-18 01:58:49 +01:00
parent 346557c7d6
commit ac550dc1dc
2 changed files with 22 additions and 19 deletions

View File

@ -30,22 +30,6 @@ namespace RGL
array = 0;
}
inline unsigned int pushBack( const T &element )
{
uint32_t newCapacity = count + 1;
if (newCapacity > capacity)
{
if ( newCapacity > capacity )
newCapacity = ( newCapacity > capacity + increment ) ? newCapacity : ( capacity + increment );
array = (T*)realloc((void *)(array), sizeof(T) * newCapacity);
capacity = newCapacity;
}
new((void *)(array + count))T( element );
return ++count;
}
inline void removeElement( const T &element )
{
for ( unsigned int i = count; i > 0; --i )
@ -55,7 +39,8 @@ namespace RGL
unsigned int index = i - 1;
( array + index )->~T();
--count;
if ( count > index ) memmove( array + index, array + index + 1, ( count - index )*sizeof( T ) );
if ( count > index )
memmove( array + index, array + index + 1, ( count - index )*sizeof( T ) );
return;
}
}

View File

@ -3279,6 +3279,25 @@ GLAPI GLenum APIENTRY glCheckFramebufferStatusOES( GLenum target )
return GL_FRAMEBUFFER_COMPLETE_OES;
}
static inline void frameBuffer_pushBack(GLuint texture, rglFramebuffer *element)
{
RGLcontext* LContext = (RGLcontext*)_CurrentContext;
rglTexture *textureObject = (rglTexture*)LContext->textureNameSpace.data[texture];
uint32_t newCapacity = textureObject->framebuffers.count + 1;
if (newCapacity > textureObject->framebuffers.capacity)
{
if ( newCapacity > textureObject->framebuffers.capacity )
newCapacity = ( newCapacity > textureObject->framebuffers.capacity + textureObject->framebuffers.increment ) ? newCapacity : ( textureObject->framebuffers.capacity + textureObject->framebuffers.increment );
textureObject->framebuffers.array = (rglFramebuffer**)realloc((void *)(textureObject->framebuffers.array), sizeof(rglFramebuffer) * newCapacity);
textureObject->framebuffers.capacity = newCapacity;
}
new((void *)(textureObject->framebuffers.array + textureObject->framebuffers.count))rglFramebuffer((const rglFramebuffer&)element);
++textureObject->framebuffers.count;
}
GLAPI void APIENTRY glFramebufferTexture2DOES( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level )
{
RGLcontext* LContext = _CurrentContext;
@ -3299,8 +3318,7 @@ GLAPI void APIENTRY glFramebufferTexture2DOES( GLenum target, GLenum attachment,
if (texture)
{
attach->type = RGL_FRAMEBUFFER_ATTACHMENT_TEXTURE;
textureObject = (rglTexture*)LContext->textureNameSpace.data[texture];
textureObject->framebuffers.pushBack( framebuffer );
frameBuffer_pushBack(texture, framebuffer);
}
else
attach->type = RGL_FRAMEBUFFER_ATTACHMENT_NONE;