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 df2b8ae
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions src/Layers/xrRenderDX11/dx11SH_Texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,23 +117,19 @@ 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)
for (auto &x : srv_per_slice)
{
_RELEASE(srv_per_slice[id]);

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]));
x->Release();
x = nullptr;
}
CHK_DX(HW.pDevice->CreateShaderResourceView(pSurface, &ViewDesc, srv_per_slice.data()));

set_slice(-1);
}
else
Expand Down

0 comments on commit df2b8ae

Please sign in to comment.