Skip to content

Commit

Permalink
Fix the wrong barrier number in buffer read back
Browse files Browse the repository at this point in the history
  • Loading branch information
StarsX committed Oct 10, 2023
1 parent 8f09dfb commit a278c2b
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 8 deletions.
5 changes: 0 additions & 5 deletions XUSG/Core/XUSG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,3 @@ uint8_t XUSG::CalculateMipLevels(uint64_t width, uint32_t height, uint32_t depth
{
return CalculateMipLevels(static_cast<uint32_t>(width), height, depth);
}

uint32_t XUSG::CalculateSubresource(uint8_t mipSlice, uint8_t numMips, uint32_t arraySlice, uint32_t arraySize, uint8_t planeSlice)
{
return mipSlice + arraySlice * numMips + planeSlice * numMips * arraySize;
}
2 changes: 0 additions & 2 deletions XUSG/Core/XUSG.h
Original file line number Diff line number Diff line change
Expand Up @@ -2320,6 +2320,4 @@ namespace XUSG
XUSG_INTERFACE uint8_t Log2(uint32_t value);
XUSG_INTERFACE uint8_t CalculateMipLevels(uint32_t width, uint32_t height, uint32_t depth = 1);
XUSG_INTERFACE uint8_t CalculateMipLevels(uint64_t width, uint32_t height, uint32_t depth = 1);

XUSG_INTERFACE uint32_t CalculateSubresource(uint8_t mipSlice, uint8_t numMips, uint32_t arraySlice, uint32_t arraySize, uint8_t planeSlice);
}
2 changes: 1 addition & 1 deletion XUSG/Core/XUSGResource_DX12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1862,7 +1862,7 @@ bool Buffer_DX12::ReadBack(CommandList* pCommandList, Buffer* pReadBuffer, size_
const auto pGraphicsCommandList = static_cast<ID3D12GraphicsCommandList*>(pCommandList->GetHandle());
pGraphicsCommandList->CopyBufferRegion(readResource.get(), dstOffset, m_resource.get(), srcOffset, readSize);

numBarriers = SetBarrier(&barrier, dstState, numBarriers, XUSG_BARRIER_ALL_SUBRESOURCES, BarrierFlag::NONE, threadIdx);
numBarriers = SetBarrier(&barrier, dstState, 0, XUSG_BARRIER_ALL_SUBRESOURCES, BarrierFlag::NONE, threadIdx);
pCommandList->Barrier(numBarriers, &barrier);

return true;
Expand Down

0 comments on commit a278c2b

Please sign in to comment.