Hello, I met some trouble while working with view instancing in d3d12.
Create PSO with D3D12_VIEW_INSTANCING_DESC, such as below
ViewInstanceCount = 4,
pViewInstanceLocations = {
{ViewportArrayIndex=0, RenderTargetArrayIndex=0},
{0, 1},
{0, 2},
{0, 3},
}
and set render target array that has 4 slices.
Each slice has rendered, but the order is not correct.
I’ve checked if a variable of SV_ViewID is equal to another variable of SV_RenderTargetArrayIndex, and those are not equal some cases.
- 0 (ViewID), 0 (RenderTargetArrayIndex )
- 1, 3 → Different
- 2, 2
- 3, 1 → Different
If ViewInstanceCount is 3 and Locations are {0, 0}, {0, 1}, and {0, 2}, then SV_RenderTargetArrayIndex is each given as 0, 2, 1.
Also I tried with both SV_ViewportArrayIndex and SV_RenderTargetArrayIndex,
ViewInstanceCount = 4,
pViewInstanceLocations = {
{ViewportArrayIndex=0, RenderTargetArrayIndex=0},
{1, 1},
{2, 2},
{3, 3},
}
The result of SV_RenderTargetArrayIndex is still wiered, but the SV_ViewportArrayIndex is equal with SV_ViewID as I set.
- 0 (ViewID), 0 (ViewportArrayIndex), 0 (RenderTargetArrayIndex)
- 1, 1, 3 → Different
- 2, 2, 2
- 3, 3, 1 → Different
So I set the RenderTargetArrayIndex such as below, and finally get an increasing order of RenderTargetArrayIndex.
ViewInstanceCount = 4,
pViewInstanceLocations = {
{ViewportArrayIndex=0, RenderTargetArrayIndex=0},
{0, 3},
{0, 2},
{0, 1},
}
However, can’t find proper description why I should code such that.