mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-31 05:52:11 +01:00
[d3d11] Move CSSetUnorderedAccessViews to D3D11CommonContext
This commit is contained in:
parent
159eed825f
commit
f664e87749
@ -1284,76 +1284,6 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
void STDMETHODCALLTYPE D3D11DeviceContext::CSSetUnorderedAccessViews(
|
||||
UINT StartSlot,
|
||||
UINT NumUAVs,
|
||||
ID3D11UnorderedAccessView* const* ppUnorderedAccessViews,
|
||||
const UINT* pUAVInitialCounts) {
|
||||
D3D10DeviceLock lock = LockContext();
|
||||
|
||||
if (TestRtvUavHazards(0, nullptr, NumUAVs, ppUnorderedAccessViews))
|
||||
return;
|
||||
|
||||
// Unbind previously bound conflicting UAVs
|
||||
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<DxbcProgramType::ComputeShader>(
|
||||
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++) {
|
||||
auto uav = static_cast<D3D11UnorderedAccessView*>(ppUnorderedAccessViews[i]);
|
||||
auto ctr = pUAVInitialCounts ? pUAVInitialCounts[i] : ~0u;
|
||||
|
||||
if (m_state.cs.unorderedAccessViews[StartSlot + i] != uav || ctr != ~0u) {
|
||||
m_state.cs.unorderedAccessViews[StartSlot + i] = uav;
|
||||
m_state.cs.uavMask.set(StartSlot + i, uav != nullptr);
|
||||
|
||||
BindUnorderedAccessView<DxbcProgramType::ComputeShader>(
|
||||
uavSlotId + StartSlot + i, uav,
|
||||
ctrSlotId + StartSlot + i, ctr);
|
||||
|
||||
ResolveCsSrvHazards(uav);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void STDMETHODCALLTYPE D3D11DeviceContext::CSGetUnorderedAccessViews(
|
||||
UINT StartSlot,
|
||||
UINT NumUAVs,
|
||||
ID3D11UnorderedAccessView** ppUnorderedAccessViews) {
|
||||
D3D10DeviceLock lock = LockContext();
|
||||
|
||||
for (uint32_t i = 0; i < NumUAVs; i++) {
|
||||
ppUnorderedAccessViews[i] = StartSlot + i < m_state.cs.unorderedAccessViews.size()
|
||||
? m_state.cs.unorderedAccessViews[StartSlot + i].ref()
|
||||
: nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void STDMETHODCALLTYPE D3D11DeviceContext::RSSetState(ID3D11RasterizerState* pRasterizerState) {
|
||||
D3D10DeviceLock lock = LockContext();
|
||||
|
||||
|
@ -208,17 +208,6 @@ namespace dxvk {
|
||||
ID3D11Buffer* pBufferForArgs,
|
||||
UINT AlignedByteOffsetForArgs);
|
||||
|
||||
void STDMETHODCALLTYPE CSSetUnorderedAccessViews(
|
||||
UINT StartSlot,
|
||||
UINT NumUAVs,
|
||||
ID3D11UnorderedAccessView* const* ppUnorderedAccessViews,
|
||||
const UINT* pUAVInitialCounts);
|
||||
|
||||
void STDMETHODCALLTYPE CSGetUnorderedAccessViews(
|
||||
UINT StartSlot,
|
||||
UINT NumUAVs,
|
||||
ID3D11UnorderedAccessView** ppUnorderedAccessViews);
|
||||
|
||||
void STDMETHODCALLTYPE RSSetState(
|
||||
ID3D11RasterizerState* pRasterizerState);
|
||||
|
||||
|
@ -1085,6 +1085,63 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
template<typename ContextType>
|
||||
void STDMETHODCALLTYPE D3D11CommonContext<ContextType>::CSSetUnorderedAccessViews(
|
||||
UINT StartSlot,
|
||||
UINT NumUAVs,
|
||||
ID3D11UnorderedAccessView* const* ppUnorderedAccessViews,
|
||||
const UINT* pUAVInitialCounts) {
|
||||
D3D10DeviceLock lock = LockContext();
|
||||
|
||||
if (TestRtvUavHazards(0, nullptr, NumUAVs, ppUnorderedAccessViews))
|
||||
return;
|
||||
|
||||
// Unbind previously bound conflicting UAVs
|
||||
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<DxbcProgramType::ComputeShader>(
|
||||
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++) {
|
||||
auto uav = static_cast<D3D11UnorderedAccessView*>(ppUnorderedAccessViews[i]);
|
||||
auto ctr = pUAVInitialCounts ? pUAVInitialCounts[i] : ~0u;
|
||||
|
||||
if (m_state.cs.unorderedAccessViews[StartSlot + i] != uav || ctr != ~0u) {
|
||||
m_state.cs.unorderedAccessViews[StartSlot + i] = uav;
|
||||
m_state.cs.uavMask.set(StartSlot + i, uav != nullptr);
|
||||
|
||||
BindUnorderedAccessView<DxbcProgramType::ComputeShader>(
|
||||
uavSlotId + StartSlot + i, uav,
|
||||
ctrSlotId + StartSlot + i, ctr);
|
||||
|
||||
ResolveCsSrvHazards(uav);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<typename ContextType>
|
||||
void STDMETHODCALLTYPE D3D11CommonContext<ContextType>::CSGetShader(
|
||||
ID3D11ComputeShader** ppComputeShader,
|
||||
@ -1157,6 +1214,21 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
template<typename ContextType>
|
||||
void STDMETHODCALLTYPE D3D11CommonContext<ContextType>::CSGetUnorderedAccessViews(
|
||||
UINT StartSlot,
|
||||
UINT NumUAVs,
|
||||
ID3D11UnorderedAccessView** ppUnorderedAccessViews) {
|
||||
D3D10DeviceLock lock = LockContext();
|
||||
|
||||
for (uint32_t i = 0; i < NumUAVs; i++) {
|
||||
ppUnorderedAccessViews[i] = StartSlot + i < m_state.cs.unorderedAccessViews.size()
|
||||
? m_state.cs.unorderedAccessViews[StartSlot + i].ref()
|
||||
: nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<typename ContextType>
|
||||
void STDMETHODCALLTYPE D3D11CommonContext<ContextType>::OMSetRenderTargets(
|
||||
UINT NumViews,
|
||||
|
@ -418,6 +418,12 @@ namespace dxvk {
|
||||
UINT NumSamplers,
|
||||
ID3D11SamplerState* const* ppSamplers);
|
||||
|
||||
void STDMETHODCALLTYPE CSSetUnorderedAccessViews(
|
||||
UINT StartSlot,
|
||||
UINT NumUAVs,
|
||||
ID3D11UnorderedAccessView* const* ppUnorderedAccessViews,
|
||||
const UINT* pUAVInitialCounts);
|
||||
|
||||
void STDMETHODCALLTYPE CSGetShader(
|
||||
ID3D11ComputeShader** ppComputeShader,
|
||||
ID3D11ClassInstance** ppClassInstances,
|
||||
@ -445,6 +451,11 @@ namespace dxvk {
|
||||
UINT NumSamplers,
|
||||
ID3D11SamplerState** ppSamplers);
|
||||
|
||||
void STDMETHODCALLTYPE CSGetUnorderedAccessViews(
|
||||
UINT StartSlot,
|
||||
UINT NumUAVs,
|
||||
ID3D11UnorderedAccessView** ppUnorderedAccessViews);
|
||||
|
||||
void STDMETHODCALLTYPE OMSetRenderTargets(
|
||||
UINT NumViews,
|
||||
ID3D11RenderTargetView* const* ppRenderTargetViews,
|
||||
|
Loading…
x
Reference in New Issue
Block a user