Multiple Shader Resource Views on one Texture2DArray

Started by
0 comments, last by Nessi 4 years, 4 months ago

I have a weird problem that I'm struggling with. I am currently implementing a unit test using two render passes. The first pass renders into two render targets, which are two different slices of a Texture2DArray. This works so far.

Now I want the second pass to blend between those two outputs. Because of some internal prerequisites I am forced to use two separate Texture2Ds in the pixel shader. I now want to create two different shader resource views to the texture2darray, which was the output of the first pass, and set these as single texture2ds to the shader. Therefore I define the right arrayslice in the srv description under Texture2DArray.

_srvDesc.Texture2DArray.ArraySize = 1;
_srvDesc.Texture2DArray.FirstArraySlice = currLayer;

Is that even possible and the right way to do?

Debugging it in Nsight, the views look correct, and the bound textures also look correct. (Actually it's just the one Texture2DArray with the two SRVs).

But when sampling the two Texture2Ds I only get the first array slice.

If I set for testing the FirstArraySlice for both views to the same slice (either 0 or 1) it gives me the right slice when sampling the two textures. Only if they are different I always get the first.

newTexture->_srvDesc.Texture2DArray.ArraySize = 1;
newTexture->_srvDesc.Texture2DArray.FirstArraySlice = 0;

or

newTexture->_srvDesc.Texture2DArray.ArraySize = 1;
newTexture->_srvDesc.Texture2DArray.FirstArraySlice = 1;

So is there a general issue that I am not allowed to use two different views on one and the same texture or am I missing something else?

This topic is closed to new replies.

Advertisement