Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix d3d11 miss srv or uav for same resource. #22

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions source/platforms/sl.chi/d3d11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,7 @@ ComputeStatus D3D11::getTextureDriverData(Resource res, ResourceDriverDataD3D11&

ID3D11Resource* resource = (ID3D11Resource*)(res->native);

uint32_t hash = (mipOffset << 16) | mipLevels;
uint64_t hash = (((mipOffset << 16) | mipLevels) << 32 | kResourceHashTypeSrv);

auto it = m_resourceData.find(resource);
if (it == m_resourceData.end() || (*it).second.find(hash) == (*it).second.end())
Expand Down Expand Up @@ -974,7 +974,7 @@ ComputeStatus D3D11::getSurfaceDriverData(Resource res, ResourceDriverDataD3D11&

ID3D11Resource* resource = (ID3D11Resource*)(res->native);

uint32_t hash = mipOffset << 16;
uint32_t hash = ((mipOffset << 48) | kResourceHashTypeUav);

auto it = m_resourceData.find(resource);
if (it == m_resourceData.end() || (*it).second.find(hash) == (*it).second.end())
Expand Down
5 changes: 4 additions & 1 deletion source/platforms/sl.chi/d3d11.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ struct DispatchDataD3D11

class D3D11 : public Generic
{
static constexpr uint32_t kResourceHashTypeSrv = 0;
static constexpr uint32_t kResourceHashTypeUav = 1;

struct PerfData
{
ID3D11Query *queryBegin{};
Expand All @@ -92,7 +95,7 @@ class D3D11 : public Generic
ID3D11DeviceContext* m_immediateContext{};
UINT m_visibleNodeMask = 0;

std::map<ID3D11Resource*, std::map<uint32_t,ResourceDriverDataD3D11>> m_resourceData;
std::map<ID3D11Resource*, std::map<uint64_t,ResourceDriverDataD3D11>> m_resourceData;
ID3D11SamplerState* m_samplers[eSamplerCount];

thread::ThreadContext<DispatchDataD3D11> m_dispatchContext;
Expand Down