mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-31 14:52:11 +01:00
[d3d11] Resolve pipeline hazards when binding compute shader UAVs
This commit is contained in:
parent
c8c781c88b
commit
a36f056572
@ -2478,9 +2478,34 @@ namespace dxvk {
|
|||||||
const UINT* pUAVInitialCounts) {
|
const UINT* pUAVInitialCounts) {
|
||||||
D3D10DeviceLock lock = LockContext();
|
D3D10DeviceLock lock = LockContext();
|
||||||
|
|
||||||
uint32_t uavSlotId = computeUavBinding (DxbcProgramType::ComputeShader, StartSlot);
|
// Unbind previously bound conflicting UAVs
|
||||||
uint32_t ctrSlotId = computeUavCounterBinding(DxbcProgramType::ComputeShader, StartSlot);
|
uint32_t uavSlotId = computeUavBinding (DxbcProgramType::ComputeShader, 0);
|
||||||
|
uint32_t ctrSlotId = computeUavCounterBinding(DxbcProgramType::ComputeShader, 0);
|
||||||
|
|
||||||
|
int32_t uavId = m_state.cs.uavMask.findNext(0);
|
||||||
|
|
||||||
|
while (uavId >= 0) {
|
||||||
|
if (uint32_t(uavId) < StartSlot || uint32_t(uavId) >= StartSlot + NumUAVs) {
|
||||||
|
for (uint32_t i = 0; i < NumUAVs; i++) {
|
||||||
|
auto uav = static_cast<D3D11UnorderedAccessView*>(ppUnorderedAccessViews[i]);
|
||||||
|
|
||||||
|
if (CheckViewOverlap(uav, m_state.cs.unorderedAccessViews[uavId].ptr())) {
|
||||||
|
m_state.cs.unorderedAccessViews[uavId] = nullptr;
|
||||||
|
m_state.cs.uavMask.clr(uavId);
|
||||||
|
|
||||||
|
BindUnorderedAccessView(
|
||||||
|
uavSlotId + uavId, nullptr,
|
||||||
|
ctrSlotId + uavId, ~0u);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uavId = m_state.cs.uavMask.findNext(uavId + 1);
|
||||||
|
} else {
|
||||||
|
uavId = m_state.cs.uavMask.findNext(StartSlot + NumUAVs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Actually bind the given UAVs
|
||||||
for (uint32_t i = 0; i < NumUAVs; i++) {
|
for (uint32_t i = 0; i < NumUAVs; i++) {
|
||||||
auto uav = static_cast<D3D11UnorderedAccessView*>(ppUnorderedAccessViews[i]);
|
auto uav = static_cast<D3D11UnorderedAccessView*>(ppUnorderedAccessViews[i]);
|
||||||
auto ctr = pUAVInitialCounts ? pUAVInitialCounts[i] : ~0u;
|
auto ctr = pUAVInitialCounts ? pUAVInitialCounts[i] : ~0u;
|
||||||
@ -2490,8 +2515,8 @@ namespace dxvk {
|
|||||||
m_state.cs.uavMask.set(StartSlot + i, uav != nullptr);
|
m_state.cs.uavMask.set(StartSlot + i, uav != nullptr);
|
||||||
|
|
||||||
BindUnorderedAccessView(
|
BindUnorderedAccessView(
|
||||||
uavSlotId + i, uav,
|
uavSlotId + StartSlot + i, uav,
|
||||||
ctrSlotId + i, ctr);
|
ctrSlotId + StartSlot + i, ctr);
|
||||||
|
|
||||||
TestCsSrvHazards(uav);
|
TestCsSrvHazards(uav);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user