Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - OddlyOrdinary

Pages: [1]
1
Graphics / Best method for using a texture pool?
« on: January 30, 2014, 07:28:18 pm »
Hi, I'm attempting to use a texture pool to display a 60fps video. I have a background thread that queues decoded frames that are 1080p, and is able to do so much faster than 60fps. I then seem to hit a bottleneck at the update texture operation. I'm using something like

VideoFrame frontFrame= vQueue->GetFrame();
if(frontFrame.frame)
{
      m_tex.update((sf::Uint8*)frontFrame.frame->data[0]);
}

If I have SFML running with setFrameLimit(0), and no vertical sync, I'm able to run really close to 60fps with some frames taking longer up to two frames. Just for info there is nothing else in this program besides the decode and the ten lines of SFML to update the texture and display it.

I'm currently trying to build a texture pool seperate from the main thread that rotates through 60 textures and calls the update on them. I'm using a single sprite to display them, and updating the texture the sprite points to each main loop.

sf::Texture* frameTexture = texturePool->GetFrameTexture();
if(frameTexture)
{
      renderHolder.setTexture(*frameTexture);   //renderHolder is a sf::sprite         
}      
window.draw(renderHolder);
 

This appears to be about the same performance as calling update directly. From the documentation I thought sf::Texture's update moved the pixel data to the gpu. So I was expecting the sprite updating to be much faster.

Any suggestions to increase performance?

Pages: [1]