Sign in to follow this  
satanir

Multiple render targets in DX10

Recommended Posts

satanir    1452
Hi, I just went through the CubeMapGS demo, and there is something that puzzles me in the whole MRT thing. According to the DX10 documentation, OMSetRenderTargets() accepts an array of RT views, but only one depth/stencil view. I explored a little more, and from what I understood, no matter how many RTs you use, you can have only one depth buffer. I than looked at the CubeMapGS code and saw that they create a texture 2D array of 6 buffers for the depth buffers, and create a single view for that resource. This implies that the depth buffer has to be one resource, but the array size must match the render target number. So my questions are: 1. Is the documentation wrong? Do you have to create a resource with array size == Number of RTs? 2. What if I want to use MRT, but have all of them work with the same depth buffer? Is there an explicit way to tell DX10 what I want? Thanks.

Share this post


Link to post
Share on other sites
Demirug    884
1. The documentation is right. But the sample can be easily read in a wrong way. When you render to all faces of cube at the same time you need to use a single render target view that maps to a array with the 6 sides. That’s equal to the depth stencil view. The sample does this in render to cube mode.
2. That’s the mode that Direct3D 10 always uses.

Share this post


Link to post
Share on other sites
ET3D    810
Here's the difference between MRT and a texture array (in this case the cube map):

MRT allows the pixel shader to output to several surfaces at a time. They can be different formats (though the same size), and you should write to all of them.

With a texture array the pixel shader is rendering each triangle to only one slice, but the slice can be selected in the geometry shader. To render to several slices, as happens in the sample, the GS needs to output a triangle for each of them. The pixel shader will run for each slice separately.

I hope this helps.

Share this post


Link to post
Share on other sites
satanir    1452
Just to make sure I got it:
The sample doesn't use MRT? It works with textures instead?
The GS outputs SV_RenderTargetArrayIndex, so I assumed it uses MRT.
Also, when calling OmSetRenderTarget(), the number of render targets views is 6, so it's can't be just one RT, or is it?

As you can see, I am still confused...
Can someone explain it more deeply?

Thanks

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