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

Author Topic: CPU Post-processing ?  (Read 1154 times)

0 Members and 1 Guest are viewing this topic.

Buanderie

  • Newbie
  • *
  • Posts: 1
    • View Profile
CPU Post-processing ?
« on: November 17, 2013, 07:26:43 pm »
Hello, I'm quite new to SFML, and I'm trying to:
- Render OpenGL to a RenderTexture
- Copy the result to an image
- Apply CPU post-proc operation to the image
- Update back the result to the texture

I know this should be slow... But the results I get are quite surprisingly slow.
Here is actually the code I use:

sf::Clock fpsclock;
                // GPU-CPU-GPU Ping-ponging test
                sf::Image pingimg = geometryBuffer.getTexture().copyToImage();
                        // normally some CPU processing
                sf::Texture pongtex = geometryBuffer.getTexture();
                pongtex.update( pingimg );
                double elapsed = fpsclock.getElapsedTime().asSeconds();
                std::cout << "elapsed=" << elapsed << " - fps=" << 1.0 / elapsed << std::endl;
 

where geometryBuffer is my sf::RenderTexture

The results I get (in seconds):
elapsed=1.70021 - fps=0.588162
elapsed=1.69644 - fps=0.589468
elapsed=1.70246 - fps=0.587385
elapsed=1.70338 - fps=0.587069

Has anybody ever tried this kind of thing, and if so, what should be the most efficient way to do it ?
I mean, the rendertexture is 800x600 RGBA... It shouldn't take 2sec to update, should it ?

Thanks in advance

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
AW: CPU Post-processing ?
« Reply #1 on: November 17, 2013, 10:01:05 pm »
Most efficent way: shader
Why do need to do things on the CPU when you can do the same thing a lot faster directly on the GPU?

What CPU, GPU and OS do you have? If the pipeline between CPU and GPU is small such times aren't surprising. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything