mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-31 14:52:11 +01:00
[d3d11] Move *SetShaderResources methods to D3D11CommonContext
This commit is contained in:
parent
bfaa21dccc
commit
3af5b3ba7b
@ -1284,19 +1284,6 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
void STDMETHODCALLTYPE D3D11DeviceContext::VSSetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView* const* ppShaderResourceViews) {
|
||||
D3D10DeviceLock lock = LockContext();
|
||||
|
||||
SetShaderResources<DxbcProgramType::VertexShader>(
|
||||
m_state.vs.shaderResources,
|
||||
StartSlot, NumViews,
|
||||
ppShaderResourceViews);
|
||||
}
|
||||
|
||||
|
||||
void STDMETHODCALLTYPE D3D11DeviceContext::VSSetSamplers(
|
||||
UINT StartSlot,
|
||||
UINT NumSamplers,
|
||||
@ -1310,17 +1297,6 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
void STDMETHODCALLTYPE D3D11DeviceContext::VSGetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView** ppShaderResourceViews) {
|
||||
D3D10DeviceLock lock = LockContext();
|
||||
|
||||
GetShaderResources(m_state.vs.shaderResources,
|
||||
StartSlot, NumViews, ppShaderResourceViews);
|
||||
}
|
||||
|
||||
|
||||
void STDMETHODCALLTYPE D3D11DeviceContext::VSGetSamplers(
|
||||
UINT StartSlot,
|
||||
UINT NumSamplers,
|
||||
@ -1332,19 +1308,6 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
void STDMETHODCALLTYPE D3D11DeviceContext::HSSetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView* const* ppShaderResourceViews) {
|
||||
D3D10DeviceLock lock = LockContext();
|
||||
|
||||
SetShaderResources<DxbcProgramType::HullShader>(
|
||||
m_state.hs.shaderResources,
|
||||
StartSlot, NumViews,
|
||||
ppShaderResourceViews);
|
||||
}
|
||||
|
||||
|
||||
void STDMETHODCALLTYPE D3D11DeviceContext::HSSetSamplers(
|
||||
UINT StartSlot,
|
||||
UINT NumSamplers,
|
||||
@ -1358,17 +1321,6 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
void STDMETHODCALLTYPE D3D11DeviceContext::HSGetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView** ppShaderResourceViews) {
|
||||
D3D10DeviceLock lock = LockContext();
|
||||
|
||||
GetShaderResources(m_state.hs.shaderResources,
|
||||
StartSlot, NumViews, ppShaderResourceViews);
|
||||
}
|
||||
|
||||
|
||||
void STDMETHODCALLTYPE D3D11DeviceContext::HSGetSamplers(
|
||||
UINT StartSlot,
|
||||
UINT NumSamplers,
|
||||
@ -1380,19 +1332,6 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
void STDMETHODCALLTYPE D3D11DeviceContext::DSSetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView* const* ppShaderResourceViews) {
|
||||
D3D10DeviceLock lock = LockContext();
|
||||
|
||||
SetShaderResources<DxbcProgramType::DomainShader>(
|
||||
m_state.ds.shaderResources,
|
||||
StartSlot, NumViews,
|
||||
ppShaderResourceViews);
|
||||
}
|
||||
|
||||
|
||||
void STDMETHODCALLTYPE D3D11DeviceContext::DSSetSamplers(
|
||||
UINT StartSlot,
|
||||
UINT NumSamplers,
|
||||
@ -1406,17 +1345,6 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
void STDMETHODCALLTYPE D3D11DeviceContext::DSGetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView** ppShaderResourceViews) {
|
||||
D3D10DeviceLock lock = LockContext();
|
||||
|
||||
GetShaderResources(m_state.ds.shaderResources,
|
||||
StartSlot, NumViews, ppShaderResourceViews);
|
||||
}
|
||||
|
||||
|
||||
void STDMETHODCALLTYPE D3D11DeviceContext::DSGetSamplers(
|
||||
UINT StartSlot,
|
||||
UINT NumSamplers,
|
||||
@ -1428,19 +1356,6 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
void STDMETHODCALLTYPE D3D11DeviceContext::GSSetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView* const* ppShaderResourceViews) {
|
||||
D3D10DeviceLock lock = LockContext();
|
||||
|
||||
SetShaderResources<DxbcProgramType::GeometryShader>(
|
||||
m_state.gs.shaderResources,
|
||||
StartSlot, NumViews,
|
||||
ppShaderResourceViews);
|
||||
}
|
||||
|
||||
|
||||
void STDMETHODCALLTYPE D3D11DeviceContext::GSSetSamplers(
|
||||
UINT StartSlot,
|
||||
UINT NumSamplers,
|
||||
@ -1454,17 +1369,6 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
void STDMETHODCALLTYPE D3D11DeviceContext::GSGetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView** ppShaderResourceViews) {
|
||||
D3D10DeviceLock lock = LockContext();
|
||||
|
||||
GetShaderResources(m_state.gs.shaderResources,
|
||||
StartSlot, NumViews, ppShaderResourceViews);
|
||||
}
|
||||
|
||||
|
||||
void STDMETHODCALLTYPE D3D11DeviceContext::GSGetSamplers(
|
||||
UINT StartSlot,
|
||||
UINT NumSamplers,
|
||||
@ -1476,19 +1380,6 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
void STDMETHODCALLTYPE D3D11DeviceContext::PSSetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView* const* ppShaderResourceViews) {
|
||||
D3D10DeviceLock lock = LockContext();
|
||||
|
||||
SetShaderResources<DxbcProgramType::PixelShader>(
|
||||
m_state.ps.shaderResources,
|
||||
StartSlot, NumViews,
|
||||
ppShaderResourceViews);
|
||||
}
|
||||
|
||||
|
||||
void STDMETHODCALLTYPE D3D11DeviceContext::PSSetSamplers(
|
||||
UINT StartSlot,
|
||||
UINT NumSamplers,
|
||||
@ -1502,17 +1393,6 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
void STDMETHODCALLTYPE D3D11DeviceContext::PSGetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView** ppShaderResourceViews) {
|
||||
D3D10DeviceLock lock = LockContext();
|
||||
|
||||
GetShaderResources(m_state.ps.shaderResources,
|
||||
StartSlot, NumViews, ppShaderResourceViews);
|
||||
}
|
||||
|
||||
|
||||
void STDMETHODCALLTYPE D3D11DeviceContext::PSGetSamplers(
|
||||
UINT StartSlot,
|
||||
UINT NumSamplers,
|
||||
@ -1524,19 +1404,6 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
void STDMETHODCALLTYPE D3D11DeviceContext::CSSetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView* const* ppShaderResourceViews) {
|
||||
D3D10DeviceLock lock = LockContext();
|
||||
|
||||
SetShaderResources<DxbcProgramType::ComputeShader>(
|
||||
m_state.cs.shaderResources,
|
||||
StartSlot, NumViews,
|
||||
ppShaderResourceViews);
|
||||
}
|
||||
|
||||
|
||||
void STDMETHODCALLTYPE D3D11DeviceContext::CSSetSamplers(
|
||||
UINT StartSlot,
|
||||
UINT NumSamplers,
|
||||
@ -1606,17 +1473,6 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
void STDMETHODCALLTYPE D3D11DeviceContext::CSGetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView** ppShaderResourceViews) {
|
||||
D3D10DeviceLock lock = LockContext();
|
||||
|
||||
GetShaderResources(m_state.cs.shaderResources,
|
||||
StartSlot, NumViews, ppShaderResourceViews);
|
||||
}
|
||||
|
||||
|
||||
void STDMETHODCALLTYPE D3D11DeviceContext::CSGetSamplers(
|
||||
UINT StartSlot,
|
||||
UINT NumSamplers,
|
||||
@ -2957,48 +2813,6 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
template<DxbcProgramType ShaderStage>
|
||||
void D3D11DeviceContext::SetShaderResources(
|
||||
D3D11ShaderResourceBindings& Bindings,
|
||||
UINT StartSlot,
|
||||
UINT NumResources,
|
||||
ID3D11ShaderResourceView* const* ppResources) {
|
||||
uint32_t slotId = computeSrvBinding(ShaderStage, StartSlot);
|
||||
|
||||
for (uint32_t i = 0; i < NumResources; i++) {
|
||||
auto resView = static_cast<D3D11ShaderResourceView*>(ppResources[i]);
|
||||
|
||||
if (Bindings.views[StartSlot + i] != resView) {
|
||||
if (unlikely(resView && resView->TestHazards())) {
|
||||
if (TestSrvHazards<ShaderStage>(resView))
|
||||
resView = nullptr;
|
||||
|
||||
// Only set if necessary, but don't reset it on every
|
||||
// bind as this would be more expensive than a few
|
||||
// redundant checks in OMSetRenderTargets and friends.
|
||||
Bindings.hazardous.set(StartSlot + i, resView);
|
||||
}
|
||||
|
||||
Bindings.views[StartSlot + i] = resView;
|
||||
BindShaderResource<ShaderStage>(slotId + i, resView);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void D3D11DeviceContext::GetShaderResources(
|
||||
const D3D11ShaderResourceBindings& Bindings,
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView** ppShaderResourceViews) {
|
||||
for (uint32_t i = 0; i < NumViews; i++) {
|
||||
ppShaderResourceViews[i] = StartSlot + i < Bindings.views.size()
|
||||
? Bindings.views[StartSlot + i].ref()
|
||||
: nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void D3D11DeviceContext::GetSamplers(
|
||||
const D3D11SamplerBindings& Bindings,
|
||||
UINT StartSlot,
|
||||
|
@ -208,111 +208,56 @@ namespace dxvk {
|
||||
ID3D11Buffer* pBufferForArgs,
|
||||
UINT AlignedByteOffsetForArgs);
|
||||
|
||||
void STDMETHODCALLTYPE VSSetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView* const* ppShaderResourceViews);
|
||||
|
||||
void STDMETHODCALLTYPE VSSetSamplers(
|
||||
UINT StartSlot,
|
||||
UINT NumSamplers,
|
||||
ID3D11SamplerState* const* ppSamplers);
|
||||
|
||||
void STDMETHODCALLTYPE VSGetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView** ppShaderResourceViews);
|
||||
|
||||
void STDMETHODCALLTYPE VSGetSamplers(
|
||||
UINT StartSlot,
|
||||
UINT NumSamplers,
|
||||
ID3D11SamplerState** ppSamplers);
|
||||
|
||||
void STDMETHODCALLTYPE HSSetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView* const* ppShaderResourceViews);
|
||||
|
||||
void STDMETHODCALLTYPE HSSetSamplers(
|
||||
UINT StartSlot,
|
||||
UINT NumSamplers,
|
||||
ID3D11SamplerState* const* ppSamplers);
|
||||
|
||||
void STDMETHODCALLTYPE HSGetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView** ppShaderResourceViews);
|
||||
|
||||
void STDMETHODCALLTYPE HSGetSamplers(
|
||||
UINT StartSlot,
|
||||
UINT NumSamplers,
|
||||
ID3D11SamplerState** ppSamplers);
|
||||
|
||||
void STDMETHODCALLTYPE DSSetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView* const* ppShaderResourceViews);
|
||||
|
||||
void STDMETHODCALLTYPE DSSetSamplers(
|
||||
UINT StartSlot,
|
||||
UINT NumSamplers,
|
||||
ID3D11SamplerState* const* ppSamplers);
|
||||
|
||||
void STDMETHODCALLTYPE DSGetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView** ppShaderResourceViews);
|
||||
|
||||
void STDMETHODCALLTYPE DSGetSamplers(
|
||||
UINT StartSlot,
|
||||
UINT NumSamplers,
|
||||
ID3D11SamplerState** ppSamplers);
|
||||
|
||||
void STDMETHODCALLTYPE GSSetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView* const* ppShaderResourceViews);
|
||||
|
||||
void STDMETHODCALLTYPE GSSetSamplers(
|
||||
UINT StartSlot,
|
||||
UINT NumSamplers,
|
||||
ID3D11SamplerState* const* ppSamplers);
|
||||
|
||||
void STDMETHODCALLTYPE GSGetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView** ppShaderResourceViews);
|
||||
|
||||
void STDMETHODCALLTYPE GSGetSamplers(
|
||||
UINT StartSlot,
|
||||
UINT NumSamplers,
|
||||
ID3D11SamplerState** ppSamplers);
|
||||
|
||||
void STDMETHODCALLTYPE PSSetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView* const* ppShaderResourceViews);
|
||||
|
||||
void STDMETHODCALLTYPE PSSetSamplers(
|
||||
UINT StartSlot,
|
||||
UINT NumSamplers,
|
||||
ID3D11SamplerState* const* ppSamplers);
|
||||
|
||||
void STDMETHODCALLTYPE PSGetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView** ppShaderResourceViews);
|
||||
|
||||
void STDMETHODCALLTYPE PSGetSamplers(
|
||||
UINT StartSlot,
|
||||
UINT NumSamplers,
|
||||
ID3D11SamplerState** ppSamplers);
|
||||
|
||||
void STDMETHODCALLTYPE CSSetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView* const* ppShaderResourceViews);
|
||||
|
||||
void STDMETHODCALLTYPE CSSetSamplers(
|
||||
UINT StartSlot,
|
||||
UINT NumSamplers,
|
||||
@ -324,11 +269,6 @@ namespace dxvk {
|
||||
ID3D11UnorderedAccessView* const* ppUnorderedAccessViews,
|
||||
const UINT* pUAVInitialCounts);
|
||||
|
||||
void STDMETHODCALLTYPE CSGetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView** ppShaderResourceViews);
|
||||
|
||||
void STDMETHODCALLTYPE CSGetSamplers(
|
||||
UINT StartSlot,
|
||||
UINT NumSamplers,
|
||||
@ -545,19 +485,6 @@ namespace dxvk {
|
||||
UINT NumSamplers,
|
||||
ID3D11SamplerState* const* ppSamplers);
|
||||
|
||||
template<DxbcProgramType ShaderStage>
|
||||
void SetShaderResources(
|
||||
D3D11ShaderResourceBindings& Bindings,
|
||||
UINT StartSlot,
|
||||
UINT NumResources,
|
||||
ID3D11ShaderResourceView* const* ppResources);
|
||||
|
||||
void GetShaderResources(
|
||||
const D3D11ShaderResourceBindings& Bindings,
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView** ppShaderResourceViews);
|
||||
|
||||
void GetSamplers(
|
||||
const D3D11SamplerBindings& Bindings,
|
||||
UINT StartSlot,
|
||||
|
@ -297,6 +297,20 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
template<typename ContextType>
|
||||
void STDMETHODCALLTYPE D3D11CommonContext<ContextType>::VSSetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView* const* ppShaderResourceViews) {
|
||||
D3D10DeviceLock lock = LockContext();
|
||||
|
||||
SetShaderResources<DxbcProgramType::VertexShader>(
|
||||
m_state.vs.shaderResources,
|
||||
StartSlot, NumViews,
|
||||
ppShaderResourceViews);
|
||||
}
|
||||
|
||||
|
||||
template<typename ContextType>
|
||||
void STDMETHODCALLTYPE D3D11CommonContext<ContextType>::VSGetShader(
|
||||
ID3D11VertexShader** ppVertexShader,
|
||||
@ -345,6 +359,18 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
template<typename ContextType>
|
||||
void STDMETHODCALLTYPE D3D11CommonContext<ContextType>::VSGetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView** ppShaderResourceViews) {
|
||||
D3D10DeviceLock lock = LockContext();
|
||||
|
||||
GetShaderResources(m_state.vs.shaderResources,
|
||||
StartSlot, NumViews, ppShaderResourceViews);
|
||||
}
|
||||
|
||||
|
||||
template<typename ContextType>
|
||||
void STDMETHODCALLTYPE D3D11CommonContext<ContextType>::HSSetShader(
|
||||
ID3D11HullShader* pHullShader,
|
||||
@ -397,6 +423,20 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
template<typename ContextType>
|
||||
void STDMETHODCALLTYPE D3D11CommonContext<ContextType>::HSSetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView* const* ppShaderResourceViews) {
|
||||
D3D10DeviceLock lock = LockContext();
|
||||
|
||||
SetShaderResources<DxbcProgramType::HullShader>(
|
||||
m_state.hs.shaderResources,
|
||||
StartSlot, NumViews,
|
||||
ppShaderResourceViews);
|
||||
}
|
||||
|
||||
|
||||
template<typename ContextType>
|
||||
void STDMETHODCALLTYPE D3D11CommonContext<ContextType>::HSGetShader(
|
||||
ID3D11HullShader** ppHullShader,
|
||||
@ -445,6 +485,18 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
template<typename ContextType>
|
||||
void STDMETHODCALLTYPE D3D11CommonContext<ContextType>::HSGetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView** ppShaderResourceViews) {
|
||||
D3D10DeviceLock lock = LockContext();
|
||||
|
||||
GetShaderResources(m_state.hs.shaderResources,
|
||||
StartSlot, NumViews, ppShaderResourceViews);
|
||||
}
|
||||
|
||||
|
||||
template<typename ContextType>
|
||||
void STDMETHODCALLTYPE D3D11CommonContext<ContextType>::DSSetShader(
|
||||
ID3D11DomainShader* pDomainShader,
|
||||
@ -497,6 +549,20 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
template<typename ContextType>
|
||||
void STDMETHODCALLTYPE D3D11CommonContext<ContextType>::DSSetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView* const* ppShaderResourceViews) {
|
||||
D3D10DeviceLock lock = LockContext();
|
||||
|
||||
SetShaderResources<DxbcProgramType::DomainShader>(
|
||||
m_state.ds.shaderResources,
|
||||
StartSlot, NumViews,
|
||||
ppShaderResourceViews);
|
||||
}
|
||||
|
||||
|
||||
template<typename ContextType>
|
||||
void STDMETHODCALLTYPE D3D11CommonContext<ContextType>::DSGetShader(
|
||||
ID3D11DomainShader** ppDomainShader,
|
||||
@ -545,6 +611,18 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
template<typename ContextType>
|
||||
void STDMETHODCALLTYPE D3D11CommonContext<ContextType>::DSGetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView** ppShaderResourceViews) {
|
||||
D3D10DeviceLock lock = LockContext();
|
||||
|
||||
GetShaderResources(m_state.ds.shaderResources,
|
||||
StartSlot, NumViews, ppShaderResourceViews);
|
||||
}
|
||||
|
||||
|
||||
template<typename ContextType>
|
||||
void STDMETHODCALLTYPE D3D11CommonContext<ContextType>::GSSetShader(
|
||||
ID3D11GeometryShader* pShader,
|
||||
@ -597,6 +675,20 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
template<typename ContextType>
|
||||
void STDMETHODCALLTYPE D3D11CommonContext<ContextType>::GSSetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView* const* ppShaderResourceViews) {
|
||||
D3D10DeviceLock lock = LockContext();
|
||||
|
||||
SetShaderResources<DxbcProgramType::GeometryShader>(
|
||||
m_state.gs.shaderResources,
|
||||
StartSlot, NumViews,
|
||||
ppShaderResourceViews);
|
||||
}
|
||||
|
||||
|
||||
template<typename ContextType>
|
||||
void STDMETHODCALLTYPE D3D11CommonContext<ContextType>::GSGetShader(
|
||||
ID3D11GeometryShader** ppGeometryShader,
|
||||
@ -645,6 +737,18 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
template<typename ContextType>
|
||||
void STDMETHODCALLTYPE D3D11CommonContext<ContextType>::GSGetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView** ppShaderResourceViews) {
|
||||
D3D10DeviceLock lock = LockContext();
|
||||
|
||||
GetShaderResources(m_state.gs.shaderResources,
|
||||
StartSlot, NumViews, ppShaderResourceViews);
|
||||
}
|
||||
|
||||
|
||||
template<typename ContextType>
|
||||
void STDMETHODCALLTYPE D3D11CommonContext<ContextType>::PSSetShader(
|
||||
ID3D11PixelShader* pPixelShader,
|
||||
@ -697,6 +801,20 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
template<typename ContextType>
|
||||
void STDMETHODCALLTYPE D3D11CommonContext<ContextType>::PSSetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView* const* ppShaderResourceViews) {
|
||||
D3D10DeviceLock lock = LockContext();
|
||||
|
||||
SetShaderResources<DxbcProgramType::PixelShader>(
|
||||
m_state.ps.shaderResources,
|
||||
StartSlot, NumViews,
|
||||
ppShaderResourceViews);
|
||||
}
|
||||
|
||||
|
||||
template<typename ContextType>
|
||||
void STDMETHODCALLTYPE D3D11CommonContext<ContextType>::PSGetShader(
|
||||
ID3D11PixelShader** ppPixelShader,
|
||||
@ -745,6 +863,18 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
template<typename ContextType>
|
||||
void STDMETHODCALLTYPE D3D11CommonContext<ContextType>::PSGetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView** ppShaderResourceViews) {
|
||||
D3D10DeviceLock lock = LockContext();
|
||||
|
||||
GetShaderResources(m_state.ps.shaderResources,
|
||||
StartSlot, NumViews, ppShaderResourceViews);
|
||||
}
|
||||
|
||||
|
||||
template<typename ContextType>
|
||||
void STDMETHODCALLTYPE D3D11CommonContext<ContextType>::CSSetShader(
|
||||
ID3D11ComputeShader* pComputeShader,
|
||||
@ -797,6 +927,20 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
template<typename ContextType>
|
||||
void STDMETHODCALLTYPE D3D11CommonContext<ContextType>::CSSetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView* const* ppShaderResourceViews) {
|
||||
D3D10DeviceLock lock = LockContext();
|
||||
|
||||
SetShaderResources<DxbcProgramType::ComputeShader>(
|
||||
m_state.cs.shaderResources,
|
||||
StartSlot, NumViews,
|
||||
ppShaderResourceViews);
|
||||
}
|
||||
|
||||
|
||||
template<typename ContextType>
|
||||
void STDMETHODCALLTYPE D3D11CommonContext<ContextType>::CSGetShader(
|
||||
ID3D11ComputeShader** ppComputeShader,
|
||||
@ -845,6 +989,18 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
template<typename ContextType>
|
||||
void STDMETHODCALLTYPE D3D11CommonContext<ContextType>::CSGetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView** ppShaderResourceViews) {
|
||||
D3D10DeviceLock lock = LockContext();
|
||||
|
||||
GetShaderResources(m_state.cs.shaderResources,
|
||||
StartSlot, NumViews, ppShaderResourceViews);
|
||||
}
|
||||
|
||||
|
||||
template<typename ContextType>
|
||||
void STDMETHODCALLTYPE D3D11CommonContext<ContextType>::OMSetRenderTargets(
|
||||
UINT NumViews,
|
||||
@ -1305,6 +1461,20 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
template<typename ContextType>
|
||||
void D3D11CommonContext<ContextType>::GetShaderResources(
|
||||
const D3D11ShaderResourceBindings& Bindings,
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView** ppShaderResourceViews) {
|
||||
for (uint32_t i = 0; i < NumViews; i++) {
|
||||
ppShaderResourceViews[i] = StartSlot + i < Bindings.views.size()
|
||||
? Bindings.views[StartSlot + i].ref()
|
||||
: nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<typename ContextType>
|
||||
template<DxbcProgramType ShaderStage, typename T>
|
||||
void D3D11CommonContext<ContextType>::ResolveSrvHazards(
|
||||
@ -1503,6 +1673,36 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
template<typename ContextType>
|
||||
template<DxbcProgramType ShaderStage>
|
||||
void D3D11CommonContext<ContextType>::SetShaderResources(
|
||||
D3D11ShaderResourceBindings& Bindings,
|
||||
UINT StartSlot,
|
||||
UINT NumResources,
|
||||
ID3D11ShaderResourceView* const* ppResources) {
|
||||
uint32_t slotId = computeSrvBinding(ShaderStage, StartSlot);
|
||||
|
||||
for (uint32_t i = 0; i < NumResources; i++) {
|
||||
auto resView = static_cast<D3D11ShaderResourceView*>(ppResources[i]);
|
||||
|
||||
if (Bindings.views[StartSlot + i] != resView) {
|
||||
if (unlikely(resView && resView->TestHazards())) {
|
||||
if (TestSrvHazards<ShaderStage>(resView))
|
||||
resView = nullptr;
|
||||
|
||||
// Only set if necessary, but don't reset it on every
|
||||
// bind as this would be more expensive than a few
|
||||
// redundant checks in OMSetRenderTargets and friends.
|
||||
Bindings.hazardous.set(StartSlot + i, resView);
|
||||
}
|
||||
|
||||
Bindings.views[StartSlot + i] = resView;
|
||||
BindShaderResource<ShaderStage>(slotId + i, resView);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<typename ContextType>
|
||||
void D3D11CommonContext<ContextType>::SetRenderTargetsAndUnorderedAccessViews(
|
||||
UINT NumRTVs,
|
||||
|
@ -138,6 +138,11 @@ namespace dxvk {
|
||||
const UINT* pFirstConstant,
|
||||
const UINT* pNumConstants);
|
||||
|
||||
void STDMETHODCALLTYPE VSSetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView* const* ppShaderResourceViews);
|
||||
|
||||
void STDMETHODCALLTYPE VSGetShader(
|
||||
ID3D11VertexShader** ppVertexShader,
|
||||
ID3D11ClassInstance** ppClassInstances,
|
||||
@ -155,6 +160,11 @@ namespace dxvk {
|
||||
UINT* pFirstConstant,
|
||||
UINT* pNumConstants);
|
||||
|
||||
void STDMETHODCALLTYPE VSGetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView** ppShaderResourceViews);
|
||||
|
||||
void STDMETHODCALLTYPE HSSetShader(
|
||||
ID3D11HullShader* pHullShader,
|
||||
ID3D11ClassInstance* const* ppClassInstances,
|
||||
@ -172,6 +182,11 @@ namespace dxvk {
|
||||
const UINT* pFirstConstant,
|
||||
const UINT* pNumConstants);
|
||||
|
||||
void STDMETHODCALLTYPE HSSetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView* const* ppShaderResourceViews);
|
||||
|
||||
void STDMETHODCALLTYPE HSGetShader(
|
||||
ID3D11HullShader** ppHullShader,
|
||||
ID3D11ClassInstance** ppClassInstances,
|
||||
@ -189,6 +204,11 @@ namespace dxvk {
|
||||
UINT* pFirstConstant,
|
||||
UINT* pNumConstants);
|
||||
|
||||
void STDMETHODCALLTYPE HSGetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView** ppShaderResourceViews);
|
||||
|
||||
void STDMETHODCALLTYPE DSSetShader(
|
||||
ID3D11DomainShader* pDomainShader,
|
||||
ID3D11ClassInstance* const* ppClassInstances,
|
||||
@ -206,6 +226,11 @@ namespace dxvk {
|
||||
const UINT* pFirstConstant,
|
||||
const UINT* pNumConstants);
|
||||
|
||||
void STDMETHODCALLTYPE DSSetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView* const* ppShaderResourceViews);
|
||||
|
||||
void STDMETHODCALLTYPE DSGetShader(
|
||||
ID3D11DomainShader** ppDomainShader,
|
||||
ID3D11ClassInstance** ppClassInstances,
|
||||
@ -223,6 +248,11 @@ namespace dxvk {
|
||||
UINT* pFirstConstant,
|
||||
UINT* pNumConstants);
|
||||
|
||||
void STDMETHODCALLTYPE DSGetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView** ppShaderResourceViews);
|
||||
|
||||
void STDMETHODCALLTYPE GSSetShader(
|
||||
ID3D11GeometryShader* pShader,
|
||||
ID3D11ClassInstance* const* ppClassInstances,
|
||||
@ -240,6 +270,11 @@ namespace dxvk {
|
||||
const UINT* pFirstConstant,
|
||||
const UINT* pNumConstants);
|
||||
|
||||
void STDMETHODCALLTYPE GSSetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView* const* ppShaderResourceViews);
|
||||
|
||||
void STDMETHODCALLTYPE GSGetShader(
|
||||
ID3D11GeometryShader** ppGeometryShader,
|
||||
ID3D11ClassInstance** ppClassInstances,
|
||||
@ -257,6 +292,11 @@ namespace dxvk {
|
||||
UINT* pFirstConstant,
|
||||
UINT* pNumConstants);
|
||||
|
||||
void STDMETHODCALLTYPE GSGetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView** ppShaderResourceViews);
|
||||
|
||||
void STDMETHODCALLTYPE PSSetShader(
|
||||
ID3D11PixelShader* pPixelShader,
|
||||
ID3D11ClassInstance* const* ppClassInstances,
|
||||
@ -274,6 +314,11 @@ namespace dxvk {
|
||||
const UINT* pFirstConstant,
|
||||
const UINT* pNumConstants);
|
||||
|
||||
void STDMETHODCALLTYPE PSSetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView* const* ppShaderResourceViews);
|
||||
|
||||
void STDMETHODCALLTYPE PSGetShader(
|
||||
ID3D11PixelShader** ppPixelShader,
|
||||
ID3D11ClassInstance** ppClassInstances,
|
||||
@ -291,6 +336,11 @@ namespace dxvk {
|
||||
UINT* pFirstConstant,
|
||||
UINT* pNumConstants);
|
||||
|
||||
void STDMETHODCALLTYPE PSGetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView** ppShaderResourceViews);
|
||||
|
||||
void STDMETHODCALLTYPE CSSetShader(
|
||||
ID3D11ComputeShader* pComputeShader,
|
||||
ID3D11ClassInstance* const* ppClassInstances,
|
||||
@ -308,6 +358,11 @@ namespace dxvk {
|
||||
const UINT* pFirstConstant,
|
||||
const UINT* pNumConstants);
|
||||
|
||||
void STDMETHODCALLTYPE CSSetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView* const* ppShaderResourceViews);
|
||||
|
||||
void STDMETHODCALLTYPE CSGetShader(
|
||||
ID3D11ComputeShader** ppComputeShader,
|
||||
ID3D11ClassInstance** ppClassInstances,
|
||||
@ -325,6 +380,11 @@ namespace dxvk {
|
||||
UINT* pFirstConstant,
|
||||
UINT* pNumConstants);
|
||||
|
||||
void STDMETHODCALLTYPE CSGetShaderResources(
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView** ppShaderResourceViews);
|
||||
|
||||
void STDMETHODCALLTYPE OMSetRenderTargets(
|
||||
UINT NumViews,
|
||||
ID3D11RenderTargetView* const* ppRenderTargetViews,
|
||||
@ -441,6 +501,12 @@ namespace dxvk {
|
||||
UINT* pFirstConstant,
|
||||
UINT* pNumConstants);
|
||||
|
||||
void GetShaderResources(
|
||||
const D3D11ShaderResourceBindings& Bindings,
|
||||
UINT StartSlot,
|
||||
UINT NumViews,
|
||||
ID3D11ShaderResourceView** ppShaderResourceViews);
|
||||
|
||||
template<DxbcProgramType ShaderStage, typename T>
|
||||
void ResolveSrvHazards(
|
||||
T* pView,
|
||||
@ -476,6 +542,13 @@ namespace dxvk {
|
||||
const UINT* pFirstConstant,
|
||||
const UINT* pNumConstants);
|
||||
|
||||
template<DxbcProgramType ShaderStage>
|
||||
void SetShaderResources(
|
||||
D3D11ShaderResourceBindings& Bindings,
|
||||
UINT StartSlot,
|
||||
UINT NumResources,
|
||||
ID3D11ShaderResourceView* const* ppResources);
|
||||
|
||||
void SetRenderTargetsAndUnorderedAccessViews(
|
||||
UINT NumRTVs,
|
||||
ID3D11RenderTargetView* const* ppRenderTargetViews,
|
||||
|
Loading…
x
Reference in New Issue
Block a user