Jump to content
  • Advertisement
Sign in to follow this  
Psychopathetica

DX11 Multiple RenderTargetViews Too Slow?

Recommended Posts

Posted (edited)

Hey guys. I'm in a bit of a pickle, so here it goes. I created for myself a simple Bloom effect in 2D using a blend of SpriteBatches with Shaders. Works great! But I feel that it is a bit slow. Problem is, I'm using a ton of rendertargetviews, mainly as a tool to output a resulted texture in the form of a rendertargetview. Even in the most simple of programs without the bloom and only using 3 rendertargetviews, you can see it bog down. Not that my computer is slow or anything. Its a nice NVidea GeForce 1060 gaming laptop. So I must be doing something wrong with the rendertargetviews.

Here is how I have bloom taking place, with each of these having its own rendertargetview, texture, and shaderresourceview:

1) Draw unscaled sprite

2) Draw unscaled exposure tone mapped / gamma corrected

Note that the unscaled 1) and 2) are separate from the actual bloom process, but 2) will be combined later with the scaled down bloomed texture

3) Draw scaled down sprite

4) Draw scaled down exposure tone mapped / gamma corrected

5) Draw scaled down bright filter (only revealing the brightest of colors at a certain bright filter)

6) Draw scaled down horizontal blur

7) Draw scaled down vertical blur

😎 Draw scaled down horizontal blur again

9) Draw scaled down vertical blur again

10) Draw contrast (this is scaled back to the original size)

11) Draw combined 2) and 10) onto the backbuffer

Wow that was a lot! Anyways, I haven't checked the framerate yet, but it seems like, from the looks of it, 20-30 fps, depending on the size of my gaussian kernel. Probably worse. Hell, even at a kernel of 1 is slow due to how many rendertargetviews I got going. Is there a better method of outputing the textures I need rather than using a dozen or so rendertargetviews? Note that in my program, nothing is deprecated. Im using the DirectXTK library. I'm not using .fx files, only hlsl files. I'm not using effects. Only pixel shaders, about 7 of them. All of my pointers are ComPtrs. And so on and so forth. Thanks in advance.

Edited by Psychopathetica

Share this post


Link to post
Share on other sites
Advertisement

Switching to a new render-target-view isn't especially expensive. You're unlikely to save much/any time if you manage to do the same amount of work except using less RTVs.

Add timestamp queries at the start/end of an RTV usage and/or use a real GPU profiling app to figure out how much time your shaders are taking (rather than focusing on RTV count).

Share this post


Link to post
Share on other sites

Ok so I did a Graphics Diagnostics. And it looks as though as I was wrong! My VSync was off, so running my simple bloom gave me a whopping 60-70+ frames a second. Having no bloom and just running one rendertargetview gave me what seemed like over 100 fps. So yea I did notice a 30-40 fps drop but in the wrong way. Weird!

Share this post


Link to post
Share on other sites
7 hours ago, Psychopathetica said:

Ok so I did a Graphics Diagnostics. And it looks as though as I was wrong! My VSync was off, so running my simple bloom gave me a whopping 60-70+ frames a second. Having no bloom and just running one rendertargetview gave me what seemed like over 100 fps. So yea I did notice a 30-40 fps drop but in the wrong way. Weird!

It's good to get into the habit of measuring the time that different bits of code take, rather than the frame rate. Frame-rate comparisons are easily misleading as they're non-linear. Frame-time comparisons are absolute :)

Dropping 30fps from 100fps to 70fps means that you've added 4ms to the time per frame.
Dropping 30fps from 70fps to 40fps means that you've added 11ms to the time per frame.
Dropping 30fps from 40fps to 10fps means that you've added 75ms to the time per frame.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!