Skip to content

Commit

Permalink
Layers/xrRenderDX11/dx11SH_Texture.cpp: aggregate CreateShaderResourc…
Browse files Browse the repository at this point in the history
…eView calls
  • Loading branch information
olefirenque committed Feb 3, 2024
1 parent 525d793 commit 6f1c24d
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions src/Layers/xrRenderDX11/dx11SH_Texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,23 +117,17 @@ void CTexture::surface_set(ID3DBaseTexture* surf)
_RELEASE(srv_all);
CHK_DX(HW.pDevice->CreateShaderResourceView(pSurface, &ViewDesc, &srv_all));

if (desc.SampleDesc.Count <= 1)
ViewDesc.Texture2DArray.ArraySize = desc.ArraySize;
else
ViewDesc.Texture2DMSArray.ArraySize = desc.ArraySize;

srv_per_slice.resize(desc.ArraySize);
for (u32 id = 0; id < desc.ArraySize; ++id)
{
_RELEASE(srv_per_slice[id]);
for (auto &x : srv_per_slice)
_RELEASE(x);

CHK_DX(HW.pDevice->CreateShaderResourceView(pSurface, &ViewDesc, srv_per_slice.data()));

if (desc.SampleDesc.Count <= 1)
{
ViewDesc.Texture2DArray.ArraySize = 1;
ViewDesc.Texture2DArray.FirstArraySlice = id;
}
else
{
ViewDesc.Texture2DMSArray.ArraySize = 1;
ViewDesc.Texture2DMSArray.FirstArraySlice = id;
}
CHK_DX(HW.pDevice->CreateShaderResourceView(pSurface, &ViewDesc, &srv_per_slice[id]));
}
set_slice(-1);
}
else
Expand Down

0 comments on commit 6f1c24d

Please sign in to comment.