Jump to content

  • Log In with Google      Sign In   
  • Create Account

Render to Texture Array, seeing nothing


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 Funkymunky   Members   -  Reputation: 686

Like
0Likes
Like

Posted 12 January 2014 - 02:43 PM

As per the title, I am having trouble rendering to a texture array.  I have successfully rendered to one using MRT.  I called CreateTexture2D with a D3D11_TEXTURE2D_DESC that specified an ArraySize of 4, called CreateShaderResourceView with a D3D11_SHADER_RESOURCE_VIEW_DESC that had 4 for its Texture2DArray.ArraySize parameter, and made a call to CreateRenderTargetView for each render target (i created an array of them) with a D3D11_RENDER_TARGET_VIEW_DESC specifying 1 for its Texture2DArray.ArraySize and an index offset for its Texture2DArray.FirstArraySlice.  In the pixel shader I then wrote to SV_TARGET0, SV_TARGET1 etc.  When I call OMSetRenderTargets, I set it to render 4 render targets and pass my array.

 

That works fine.

 

Now I want to render to a texture array, but use the geometry shader to specify which slice to render to via SV_RenderTargetArrayIndex.  So I set up the same as above; 4 layers specified to CreateTexture2D, 4 layers specified to CreateShaderResourceView.  But this time I set up the D3D11_RENDER_TARGET_VIEW_DESC to have 4 layers in its Texture2DArray.ArraySize, and called CreateRenderTargetView only once.  I draw 4 instanced copies, and my geometry shader sets SV_RenderTargetArrayIndex and the associated pixel shader outputs to SV_TARGET. I call OMSetRenderTargets for 1 render target,  I see nothing.

 

If I change the D3D11_RENDER_TARGET_VIEW_DESC to have 1 layer, I see all my instanced renderings output to the first slice of the texture.  But setting it to 4 means I see nothing.  The device clears each layer of the array properly, but I can't seem to render to them.

 

What could I be missing?



Sponsor:

#2 Funkymunky   Members   -  Reputation: 686

Like
1Likes
Like

Posted 12 January 2014 - 11:01 PM

Ah, I solved it.  For an MRT set up, I was only using a single depth buffer.  For an array of render targets, I need an array of depth buffers.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS