diff --git a/ps3/rgl/include/RGL/Base.h b/ps3/rgl/include/RGL/Base.h index 4fe78de686..25addaf320 100644 --- a/ps3/rgl/include/RGL/Base.h +++ b/ps3/rgl/include/RGL/Base.h @@ -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; } } diff --git a/ps3/rgl/src/rgl_ps3.cpp b/ps3/rgl/src/rgl_ps3.cpp index 5f4bff75be..56e44a418a 100644 --- a/ps3/rgl/src/rgl_ps3.cpp +++ b/ps3/rgl/src/rgl_ps3.cpp @@ -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;