Why render to texture is so slow?

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
motorfreak
Posts: 21
Joined: Thu Feb 20, 2014 7:39 pm

Why render to texture is so slow?

Post by motorfreak »

I have been experimenting with deferred shading and it seems that render to texture creates a huge performance hit. It is also after a certain number of layers that performance slows down to a crawl. It does not happen with 1-2 textures but any more than that and I can see a noticible hit on frame rate.

Questions:
Is there a way to make sure that no data is ever copied back from fast video memory into slow memory after rendering a framebuffer? Not that I think it does but could something like this be a problem?

How can I speed up render to texture? Is there a way to profile it to see what's taking so long?

Why is irrlicht never using hardware vertex / index buffers? Is it bad for scenes that have small number of vertices per mesh buffer? For my simple house it only calls draw primitives and never creates hardware buffer regardless of whether I set the hardware hint to STATIC.

I have noticed that Irrlicht calls OnSetConstants a gazillion times for each frame even for a simple scene. Does irrlicht not sort mesh buffers after material in order to avoid context switching?

I'm also looking for some good tools for profiling glsl. I would be glad to hear any tips.
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Why render to texture is so slow?

Post by Nadro »

RTT performance depends on RT settings eg. texture resolution, type, count (MRTs) etc. If your card support FBO Irrlicht will use this feature for fast RTT.

You can enable hardware buffers for vertices and indices via 'setHardwareMappingHint' method.

Irrlicht uses material sorting and OpenGL states cache (in trunk). OnSetConstants is called once per node and it's properly behaviour because each node has different world matrix etc. Anyway you can use some cache here too if you don't want to update each uniforms per frame. Irrlicht is flexible in this case.

I use AMD gDEBugger and I can say that it's great tool.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Why render to texture is so slow?

Post by hendu »

What do you mean by "layers"? MRT?

If so, that's known to be slow the more you add, Nvidia recommends not to use more than 3.
motorfreak
Posts: 21
Joined: Thu Feb 20, 2014 7:39 pm

Re: Why render to texture is so slow?

Post by motorfreak »

hendu wrote:What do you mean by "layers"? MRT?

If so, that's known to be slow the more you add, Nvidia recommends not to use more than 3.
Yes I meant MRT. I still need to get glBlend to work so I can do the same thing in fewer passes.
Post Reply