1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-03-01 10:54:14 +01:00

[d3d11] Template all functions that take ShaderStage as an argument

Basically what D9VK does. Doesn't seem to affect performance, but why not.
This commit is contained in:
Philip Rebohle 2019-06-20 22:09:02 +02:00
parent 138dde6c3d
commit 3141467c37
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 78 additions and 116 deletions

View File

@ -1700,9 +1700,7 @@ namespace dxvk {
if (m_state.vs.shader != shader) { if (m_state.vs.shader != shader) {
m_state.vs.shader = shader; m_state.vs.shader = shader;
BindShader( BindShader<DxbcProgramType::VertexShader>(GetCommonShader(shader));
DxbcProgramType::VertexShader,
GetCommonShader(shader));
} }
} }
@ -1713,8 +1711,7 @@ namespace dxvk {
ID3D11Buffer* const* ppConstantBuffers) { ID3D11Buffer* const* ppConstantBuffers) {
D3D10DeviceLock lock = LockContext(); D3D10DeviceLock lock = LockContext();
SetConstantBuffers( SetConstantBuffers<DxbcProgramType::VertexShader>(
DxbcProgramType::VertexShader,
m_state.vs.constantBuffers, m_state.vs.constantBuffers,
StartSlot, NumBuffers, StartSlot, NumBuffers,
ppConstantBuffers); ppConstantBuffers);
@ -1729,8 +1726,7 @@ namespace dxvk {
const UINT* pNumConstants) { const UINT* pNumConstants) {
D3D10DeviceLock lock = LockContext(); D3D10DeviceLock lock = LockContext();
SetConstantBuffers1( SetConstantBuffers1<DxbcProgramType::VertexShader>(
DxbcProgramType::VertexShader,
m_state.vs.constantBuffers, m_state.vs.constantBuffers,
StartSlot, NumBuffers, StartSlot, NumBuffers,
ppConstantBuffers, ppConstantBuffers,
@ -1745,8 +1741,7 @@ namespace dxvk {
ID3D11ShaderResourceView* const* ppShaderResourceViews) { ID3D11ShaderResourceView* const* ppShaderResourceViews) {
D3D10DeviceLock lock = LockContext(); D3D10DeviceLock lock = LockContext();
SetShaderResources( SetShaderResources<DxbcProgramType::VertexShader>(
DxbcProgramType::VertexShader,
m_state.vs.shaderResources, m_state.vs.shaderResources,
StartSlot, NumViews, StartSlot, NumViews,
ppShaderResourceViews); ppShaderResourceViews);
@ -1759,8 +1754,7 @@ namespace dxvk {
ID3D11SamplerState* const* ppSamplers) { ID3D11SamplerState* const* ppSamplers) {
D3D10DeviceLock lock = LockContext(); D3D10DeviceLock lock = LockContext();
SetSamplers( SetSamplers<DxbcProgramType::VertexShader>(
DxbcProgramType::VertexShader,
m_state.vs.samplers, m_state.vs.samplers,
StartSlot, NumSamplers, StartSlot, NumSamplers,
ppSamplers); ppSamplers);
@ -1848,9 +1842,7 @@ namespace dxvk {
if (m_state.hs.shader != shader) { if (m_state.hs.shader != shader) {
m_state.hs.shader = shader; m_state.hs.shader = shader;
BindShader( BindShader<DxbcProgramType::HullShader>(GetCommonShader(shader));
DxbcProgramType::HullShader,
GetCommonShader(shader));
} }
} }
@ -1861,8 +1853,7 @@ namespace dxvk {
ID3D11ShaderResourceView* const* ppShaderResourceViews) { ID3D11ShaderResourceView* const* ppShaderResourceViews) {
D3D10DeviceLock lock = LockContext(); D3D10DeviceLock lock = LockContext();
SetShaderResources( SetShaderResources<DxbcProgramType::HullShader>(
DxbcProgramType::HullShader,
m_state.hs.shaderResources, m_state.hs.shaderResources,
StartSlot, NumViews, StartSlot, NumViews,
ppShaderResourceViews); ppShaderResourceViews);
@ -1875,8 +1866,7 @@ namespace dxvk {
ID3D11Buffer* const* ppConstantBuffers) { ID3D11Buffer* const* ppConstantBuffers) {
D3D10DeviceLock lock = LockContext(); D3D10DeviceLock lock = LockContext();
SetConstantBuffers( SetConstantBuffers<DxbcProgramType::HullShader>(
DxbcProgramType::HullShader,
m_state.hs.constantBuffers, m_state.hs.constantBuffers,
StartSlot, NumBuffers, StartSlot, NumBuffers,
ppConstantBuffers); ppConstantBuffers);
@ -1891,8 +1881,7 @@ namespace dxvk {
const UINT* pNumConstants) { const UINT* pNumConstants) {
D3D10DeviceLock lock = LockContext(); D3D10DeviceLock lock = LockContext();
SetConstantBuffers1( SetConstantBuffers1<DxbcProgramType::HullShader>(
DxbcProgramType::HullShader,
m_state.hs.constantBuffers, m_state.hs.constantBuffers,
StartSlot, NumBuffers, StartSlot, NumBuffers,
ppConstantBuffers, ppConstantBuffers,
@ -1907,8 +1896,7 @@ namespace dxvk {
ID3D11SamplerState* const* ppSamplers) { ID3D11SamplerState* const* ppSamplers) {
D3D10DeviceLock lock = LockContext(); D3D10DeviceLock lock = LockContext();
SetSamplers( SetSamplers<DxbcProgramType::HullShader>(
DxbcProgramType::HullShader,
m_state.hs.samplers, m_state.hs.samplers,
StartSlot, NumSamplers, StartSlot, NumSamplers,
ppSamplers); ppSamplers);
@ -1996,9 +1984,7 @@ namespace dxvk {
if (m_state.ds.shader != shader) { if (m_state.ds.shader != shader) {
m_state.ds.shader = shader; m_state.ds.shader = shader;
BindShader( BindShader<DxbcProgramType::DomainShader>(GetCommonShader(shader));
DxbcProgramType::DomainShader,
GetCommonShader(shader));
} }
} }
@ -2009,8 +1995,7 @@ namespace dxvk {
ID3D11ShaderResourceView* const* ppShaderResourceViews) { ID3D11ShaderResourceView* const* ppShaderResourceViews) {
D3D10DeviceLock lock = LockContext(); D3D10DeviceLock lock = LockContext();
SetShaderResources( SetShaderResources<DxbcProgramType::DomainShader>(
DxbcProgramType::DomainShader,
m_state.ds.shaderResources, m_state.ds.shaderResources,
StartSlot, NumViews, StartSlot, NumViews,
ppShaderResourceViews); ppShaderResourceViews);
@ -2023,8 +2008,7 @@ namespace dxvk {
ID3D11Buffer* const* ppConstantBuffers) { ID3D11Buffer* const* ppConstantBuffers) {
D3D10DeviceLock lock = LockContext(); D3D10DeviceLock lock = LockContext();
SetConstantBuffers( SetConstantBuffers<DxbcProgramType::DomainShader>(
DxbcProgramType::DomainShader,
m_state.ds.constantBuffers, m_state.ds.constantBuffers,
StartSlot, NumBuffers, StartSlot, NumBuffers,
ppConstantBuffers); ppConstantBuffers);
@ -2039,8 +2023,7 @@ namespace dxvk {
const UINT* pNumConstants) { const UINT* pNumConstants) {
D3D10DeviceLock lock = LockContext(); D3D10DeviceLock lock = LockContext();
SetConstantBuffers1( SetConstantBuffers1<DxbcProgramType::DomainShader>(
DxbcProgramType::DomainShader,
m_state.ds.constantBuffers, m_state.ds.constantBuffers,
StartSlot, NumBuffers, StartSlot, NumBuffers,
ppConstantBuffers, ppConstantBuffers,
@ -2055,8 +2038,7 @@ namespace dxvk {
ID3D11SamplerState* const* ppSamplers) { ID3D11SamplerState* const* ppSamplers) {
D3D10DeviceLock lock = LockContext(); D3D10DeviceLock lock = LockContext();
SetSamplers( SetSamplers<DxbcProgramType::DomainShader>(
DxbcProgramType::DomainShader,
m_state.ds.samplers, m_state.ds.samplers,
StartSlot, NumSamplers, StartSlot, NumSamplers,
ppSamplers); ppSamplers);
@ -2144,9 +2126,7 @@ namespace dxvk {
if (m_state.gs.shader != shader) { if (m_state.gs.shader != shader) {
m_state.gs.shader = shader; m_state.gs.shader = shader;
BindShader( BindShader<DxbcProgramType::GeometryShader>(GetCommonShader(shader));
DxbcProgramType::GeometryShader,
GetCommonShader(shader));
} }
} }
@ -2157,8 +2137,7 @@ namespace dxvk {
ID3D11Buffer* const* ppConstantBuffers) { ID3D11Buffer* const* ppConstantBuffers) {
D3D10DeviceLock lock = LockContext(); D3D10DeviceLock lock = LockContext();
SetConstantBuffers( SetConstantBuffers<DxbcProgramType::GeometryShader>(
DxbcProgramType::GeometryShader,
m_state.gs.constantBuffers, m_state.gs.constantBuffers,
StartSlot, NumBuffers, StartSlot, NumBuffers,
ppConstantBuffers); ppConstantBuffers);
@ -2173,8 +2152,7 @@ namespace dxvk {
const UINT* pNumConstants) { const UINT* pNumConstants) {
D3D10DeviceLock lock = LockContext(); D3D10DeviceLock lock = LockContext();
SetConstantBuffers1( SetConstantBuffers1<DxbcProgramType::GeometryShader>(
DxbcProgramType::GeometryShader,
m_state.gs.constantBuffers, m_state.gs.constantBuffers,
StartSlot, NumBuffers, StartSlot, NumBuffers,
ppConstantBuffers, ppConstantBuffers,
@ -2189,8 +2167,7 @@ namespace dxvk {
ID3D11ShaderResourceView* const* ppShaderResourceViews) { ID3D11ShaderResourceView* const* ppShaderResourceViews) {
D3D10DeviceLock lock = LockContext(); D3D10DeviceLock lock = LockContext();
SetShaderResources( SetShaderResources<DxbcProgramType::GeometryShader>(
DxbcProgramType::GeometryShader,
m_state.gs.shaderResources, m_state.gs.shaderResources,
StartSlot, NumViews, StartSlot, NumViews,
ppShaderResourceViews); ppShaderResourceViews);
@ -2203,8 +2180,7 @@ namespace dxvk {
ID3D11SamplerState* const* ppSamplers) { ID3D11SamplerState* const* ppSamplers) {
D3D10DeviceLock lock = LockContext(); D3D10DeviceLock lock = LockContext();
SetSamplers( SetSamplers<DxbcProgramType::GeometryShader>(
DxbcProgramType::GeometryShader,
m_state.gs.samplers, m_state.gs.samplers,
StartSlot, NumSamplers, StartSlot, NumSamplers,
ppSamplers); ppSamplers);
@ -2292,9 +2268,7 @@ namespace dxvk {
if (m_state.ps.shader != shader) { if (m_state.ps.shader != shader) {
m_state.ps.shader = shader; m_state.ps.shader = shader;
BindShader( BindShader<DxbcProgramType::PixelShader>(GetCommonShader(shader));
DxbcProgramType::PixelShader,
GetCommonShader(shader));
} }
} }
@ -2305,8 +2279,7 @@ namespace dxvk {
ID3D11Buffer* const* ppConstantBuffers) { ID3D11Buffer* const* ppConstantBuffers) {
D3D10DeviceLock lock = LockContext(); D3D10DeviceLock lock = LockContext();
SetConstantBuffers( SetConstantBuffers<DxbcProgramType::PixelShader>(
DxbcProgramType::PixelShader,
m_state.ps.constantBuffers, m_state.ps.constantBuffers,
StartSlot, NumBuffers, StartSlot, NumBuffers,
ppConstantBuffers); ppConstantBuffers);
@ -2321,8 +2294,7 @@ namespace dxvk {
const UINT* pNumConstants) { const UINT* pNumConstants) {
D3D10DeviceLock lock = LockContext(); D3D10DeviceLock lock = LockContext();
SetConstantBuffers1( SetConstantBuffers1<DxbcProgramType::PixelShader>(
DxbcProgramType::PixelShader,
m_state.ps.constantBuffers, m_state.ps.constantBuffers,
StartSlot, NumBuffers, StartSlot, NumBuffers,
ppConstantBuffers, ppConstantBuffers,
@ -2337,8 +2309,7 @@ namespace dxvk {
ID3D11ShaderResourceView* const* ppShaderResourceViews) { ID3D11ShaderResourceView* const* ppShaderResourceViews) {
D3D10DeviceLock lock = LockContext(); D3D10DeviceLock lock = LockContext();
SetShaderResources( SetShaderResources<DxbcProgramType::PixelShader>(
DxbcProgramType::PixelShader,
m_state.ps.shaderResources, m_state.ps.shaderResources,
StartSlot, NumViews, StartSlot, NumViews,
ppShaderResourceViews); ppShaderResourceViews);
@ -2351,8 +2322,7 @@ namespace dxvk {
ID3D11SamplerState* const* ppSamplers) { ID3D11SamplerState* const* ppSamplers) {
D3D10DeviceLock lock = LockContext(); D3D10DeviceLock lock = LockContext();
SetSamplers( SetSamplers<DxbcProgramType::PixelShader>(
DxbcProgramType::PixelShader,
m_state.ps.samplers, m_state.ps.samplers,
StartSlot, NumSamplers, StartSlot, NumSamplers,
ppSamplers); ppSamplers);
@ -2440,9 +2410,7 @@ namespace dxvk {
if (m_state.cs.shader != shader) { if (m_state.cs.shader != shader) {
m_state.cs.shader = shader; m_state.cs.shader = shader;
BindShader( BindShader<DxbcProgramType::ComputeShader>(GetCommonShader(shader));
DxbcProgramType::ComputeShader,
GetCommonShader(shader));
} }
} }
@ -2453,8 +2421,7 @@ namespace dxvk {
ID3D11Buffer* const* ppConstantBuffers) { ID3D11Buffer* const* ppConstantBuffers) {
D3D10DeviceLock lock = LockContext(); D3D10DeviceLock lock = LockContext();
SetConstantBuffers( SetConstantBuffers<DxbcProgramType::ComputeShader>(
DxbcProgramType::ComputeShader,
m_state.cs.constantBuffers, m_state.cs.constantBuffers,
StartSlot, NumBuffers, StartSlot, NumBuffers,
ppConstantBuffers); ppConstantBuffers);
@ -2469,8 +2436,7 @@ namespace dxvk {
const UINT* pNumConstants) { const UINT* pNumConstants) {
D3D10DeviceLock lock = LockContext(); D3D10DeviceLock lock = LockContext();
SetConstantBuffers1( SetConstantBuffers1<DxbcProgramType::ComputeShader>(
DxbcProgramType::ComputeShader,
m_state.cs.constantBuffers, m_state.cs.constantBuffers,
StartSlot, NumBuffers, StartSlot, NumBuffers,
ppConstantBuffers, ppConstantBuffers,
@ -2485,8 +2451,7 @@ namespace dxvk {
ID3D11ShaderResourceView* const* ppShaderResourceViews) { ID3D11ShaderResourceView* const* ppShaderResourceViews) {
D3D10DeviceLock lock = LockContext(); D3D10DeviceLock lock = LockContext();
SetShaderResources( SetShaderResources<DxbcProgramType::ComputeShader>(
DxbcProgramType::ComputeShader,
m_state.cs.shaderResources, m_state.cs.shaderResources,
StartSlot, NumViews, StartSlot, NumViews,
ppShaderResourceViews); ppShaderResourceViews);
@ -2499,8 +2464,7 @@ namespace dxvk {
ID3D11SamplerState* const* ppSamplers) { ID3D11SamplerState* const* ppSamplers) {
D3D10DeviceLock lock = LockContext(); D3D10DeviceLock lock = LockContext();
SetSamplers( SetSamplers<DxbcProgramType::ComputeShader>(
DxbcProgramType::ComputeShader,
m_state.cs.samplers, m_state.cs.samplers,
StartSlot, NumSamplers, StartSlot, NumSamplers,
ppSamplers); ppSamplers);
@ -2514,8 +2478,7 @@ namespace dxvk {
const UINT* pUAVInitialCounts) { const UINT* pUAVInitialCounts) {
D3D10DeviceLock lock = LockContext(); D3D10DeviceLock lock = LockContext();
SetUnorderedAccessViews( SetUnorderedAccessViews<DxbcProgramType::ComputeShader>(
DxbcProgramType::ComputeShader,
m_state.cs.unorderedAccessViews, m_state.cs.unorderedAccessViews,
StartSlot, NumUAVs, StartSlot, NumUAVs,
ppUnorderedAccessViews, ppUnorderedAccessViews,
@ -2635,8 +2598,7 @@ namespace dxvk {
// UAVs are made available to all shader stages in // UAVs are made available to all shader stages in
// the graphics pipeline even though this code may // the graphics pipeline even though this code may
// suggest that they are limited to the pixel shader. // suggest that they are limited to the pixel shader.
SetUnorderedAccessViews( SetUnorderedAccessViews<DxbcProgramType::PixelShader>(
DxbcProgramType::PixelShader,
m_state.ps.unorderedAccessViews, m_state.ps.unorderedAccessViews,
UAVStartSlot, NumUAVs, UAVStartSlot, NumUAVs,
ppUnorderedAccessViews, ppUnorderedAccessViews,
@ -3181,8 +3143,8 @@ namespace dxvk {
} }
template<DxbcProgramType ShaderStage>
void D3D11DeviceContext::BindShader( void D3D11DeviceContext::BindShader(
DxbcProgramType ShaderStage,
const D3D11CommonShader* pShaderModule) { const D3D11CommonShader* pShaderModule) {
// Bind the shader and the ICB at once // Bind the shader and the ICB at once
uint32_t slotId = computeConstantBufferBinding(ShaderStage, uint32_t slotId = computeConstantBufferBinding(ShaderStage,
@ -3426,8 +3388,8 @@ namespace dxvk {
} }
template<DxbcProgramType ShaderStage>
void D3D11DeviceContext::SetConstantBuffers( void D3D11DeviceContext::SetConstantBuffers(
DxbcProgramType ShaderStage,
D3D11ConstantBufferBindings& Bindings, D3D11ConstantBufferBindings& Bindings,
UINT StartSlot, UINT StartSlot,
UINT NumBuffers, UINT NumBuffers,
@ -3454,8 +3416,8 @@ namespace dxvk {
} }
template<DxbcProgramType ShaderStage>
void D3D11DeviceContext::SetConstantBuffers1( void D3D11DeviceContext::SetConstantBuffers1(
DxbcProgramType ShaderStage,
D3D11ConstantBufferBindings& Bindings, D3D11ConstantBufferBindings& Bindings,
UINT StartSlot, UINT StartSlot,
UINT NumBuffers, UINT NumBuffers,
@ -3510,8 +3472,8 @@ namespace dxvk {
} }
template<DxbcProgramType ShaderStage>
void D3D11DeviceContext::SetSamplers( void D3D11DeviceContext::SetSamplers(
DxbcProgramType ShaderStage,
D3D11SamplerBindings& Bindings, D3D11SamplerBindings& Bindings,
UINT StartSlot, UINT StartSlot,
UINT NumSamplers, UINT NumSamplers,
@ -3529,8 +3491,8 @@ namespace dxvk {
} }
template<DxbcProgramType ShaderStage>
void D3D11DeviceContext::SetShaderResources( void D3D11DeviceContext::SetShaderResources(
DxbcProgramType ShaderStage,
D3D11ShaderResourceBindings& Bindings, D3D11ShaderResourceBindings& Bindings,
UINT StartSlot, UINT StartSlot,
UINT NumResources, UINT NumResources,
@ -3548,8 +3510,8 @@ namespace dxvk {
} }
template<DxbcProgramType ShaderStage>
void D3D11DeviceContext::SetUnorderedAccessViews( void D3D11DeviceContext::SetUnorderedAccessViews(
DxbcProgramType ShaderStage,
D3D11UnorderedAccessBindings& Bindings, D3D11UnorderedAccessBindings& Bindings,
UINT StartSlot, UINT StartSlot,
UINT NumUAVs, UINT NumUAVs,
@ -3615,12 +3577,12 @@ namespace dxvk {
void D3D11DeviceContext::RestoreState() { void D3D11DeviceContext::RestoreState() {
BindFramebuffer(false); BindFramebuffer(false);
BindShader(DxbcProgramType::VertexShader, GetCommonShader(m_state.vs.shader.ptr())); BindShader<DxbcProgramType::VertexShader> (GetCommonShader(m_state.vs.shader.ptr()));
BindShader(DxbcProgramType::HullShader, GetCommonShader(m_state.hs.shader.ptr())); BindShader<DxbcProgramType::HullShader> (GetCommonShader(m_state.hs.shader.ptr()));
BindShader(DxbcProgramType::DomainShader, GetCommonShader(m_state.ds.shader.ptr())); BindShader<DxbcProgramType::DomainShader> (GetCommonShader(m_state.ds.shader.ptr()));
BindShader(DxbcProgramType::GeometryShader, GetCommonShader(m_state.gs.shader.ptr())); BindShader<DxbcProgramType::GeometryShader> (GetCommonShader(m_state.gs.shader.ptr()));
BindShader(DxbcProgramType::PixelShader, GetCommonShader(m_state.ps.shader.ptr())); BindShader<DxbcProgramType::PixelShader> (GetCommonShader(m_state.ps.shader.ptr()));
BindShader(DxbcProgramType::ComputeShader, GetCommonShader(m_state.cs.shader.ptr())); BindShader<DxbcProgramType::ComputeShader> (GetCommonShader(m_state.cs.shader.ptr()));
ApplyInputLayout(); ApplyInputLayout();
ApplyPrimitiveTopology(); ApplyPrimitiveTopology();
@ -3650,34 +3612,34 @@ namespace dxvk {
for (uint32_t i = 0; i < m_state.so.targets.size(); i++) for (uint32_t i = 0; i < m_state.so.targets.size(); i++)
BindXfbBuffer(i, m_state.so.targets[i].buffer.ptr(), ~0u); BindXfbBuffer(i, m_state.so.targets[i].buffer.ptr(), ~0u);
RestoreConstantBuffers(DxbcProgramType::VertexShader, m_state.vs.constantBuffers); RestoreConstantBuffers<DxbcProgramType::VertexShader> (m_state.vs.constantBuffers);
RestoreConstantBuffers(DxbcProgramType::HullShader, m_state.hs.constantBuffers); RestoreConstantBuffers<DxbcProgramType::HullShader> (m_state.hs.constantBuffers);
RestoreConstantBuffers(DxbcProgramType::DomainShader, m_state.ds.constantBuffers); RestoreConstantBuffers<DxbcProgramType::DomainShader> (m_state.ds.constantBuffers);
RestoreConstantBuffers(DxbcProgramType::GeometryShader, m_state.gs.constantBuffers); RestoreConstantBuffers<DxbcProgramType::GeometryShader> (m_state.gs.constantBuffers);
RestoreConstantBuffers(DxbcProgramType::PixelShader, m_state.ps.constantBuffers); RestoreConstantBuffers<DxbcProgramType::PixelShader> (m_state.ps.constantBuffers);
RestoreConstantBuffers(DxbcProgramType::ComputeShader, m_state.cs.constantBuffers); RestoreConstantBuffers<DxbcProgramType::ComputeShader> (m_state.cs.constantBuffers);
RestoreSamplers(DxbcProgramType::VertexShader, m_state.vs.samplers); RestoreSamplers<DxbcProgramType::VertexShader> (m_state.vs.samplers);
RestoreSamplers(DxbcProgramType::HullShader, m_state.hs.samplers); RestoreSamplers<DxbcProgramType::HullShader> (m_state.hs.samplers);
RestoreSamplers(DxbcProgramType::DomainShader, m_state.ds.samplers); RestoreSamplers<DxbcProgramType::DomainShader> (m_state.ds.samplers);
RestoreSamplers(DxbcProgramType::GeometryShader, m_state.gs.samplers); RestoreSamplers<DxbcProgramType::GeometryShader>(m_state.gs.samplers);
RestoreSamplers(DxbcProgramType::PixelShader, m_state.ps.samplers); RestoreSamplers<DxbcProgramType::PixelShader> (m_state.ps.samplers);
RestoreSamplers(DxbcProgramType::ComputeShader, m_state.cs.samplers); RestoreSamplers<DxbcProgramType::ComputeShader> (m_state.cs.samplers);
RestoreShaderResources(DxbcProgramType::VertexShader, m_state.vs.shaderResources); RestoreShaderResources<DxbcProgramType::VertexShader> (m_state.vs.shaderResources);
RestoreShaderResources(DxbcProgramType::HullShader, m_state.hs.shaderResources); RestoreShaderResources<DxbcProgramType::HullShader> (m_state.hs.shaderResources);
RestoreShaderResources(DxbcProgramType::DomainShader, m_state.ds.shaderResources); RestoreShaderResources<DxbcProgramType::DomainShader> (m_state.ds.shaderResources);
RestoreShaderResources(DxbcProgramType::GeometryShader, m_state.gs.shaderResources); RestoreShaderResources<DxbcProgramType::GeometryShader> (m_state.gs.shaderResources);
RestoreShaderResources(DxbcProgramType::PixelShader, m_state.ps.shaderResources); RestoreShaderResources<DxbcProgramType::PixelShader> (m_state.ps.shaderResources);
RestoreShaderResources(DxbcProgramType::ComputeShader, m_state.cs.shaderResources); RestoreShaderResources<DxbcProgramType::ComputeShader> (m_state.cs.shaderResources);
RestoreUnorderedAccessViews(DxbcProgramType::PixelShader, m_state.ps.unorderedAccessViews); RestoreUnorderedAccessViews<DxbcProgramType::PixelShader> (m_state.ps.unorderedAccessViews);
RestoreUnorderedAccessViews(DxbcProgramType::ComputeShader, m_state.cs.unorderedAccessViews); RestoreUnorderedAccessViews<DxbcProgramType::ComputeShader> (m_state.cs.unorderedAccessViews);
} }
template<DxbcProgramType Stage>
void D3D11DeviceContext::RestoreConstantBuffers( void D3D11DeviceContext::RestoreConstantBuffers(
DxbcProgramType Stage,
D3D11ConstantBufferBindings& Bindings) { D3D11ConstantBufferBindings& Bindings) {
uint32_t slotId = computeConstantBufferBinding(Stage, 0); uint32_t slotId = computeConstantBufferBinding(Stage, 0);
@ -3686,8 +3648,8 @@ namespace dxvk {
} }
template<DxbcProgramType Stage>
void D3D11DeviceContext::RestoreSamplers( void D3D11DeviceContext::RestoreSamplers(
DxbcProgramType Stage,
D3D11SamplerBindings& Bindings) { D3D11SamplerBindings& Bindings) {
uint32_t slotId = computeSamplerBinding(Stage, 0); uint32_t slotId = computeSamplerBinding(Stage, 0);
@ -3696,8 +3658,8 @@ namespace dxvk {
} }
template<DxbcProgramType Stage>
void D3D11DeviceContext::RestoreShaderResources( void D3D11DeviceContext::RestoreShaderResources(
DxbcProgramType Stage,
D3D11ShaderResourceBindings& Bindings) { D3D11ShaderResourceBindings& Bindings) {
uint32_t slotId = computeSrvBinding(Stage, 0); uint32_t slotId = computeSrvBinding(Stage, 0);
@ -3706,8 +3668,8 @@ namespace dxvk {
} }
template<DxbcProgramType Stage>
void D3D11DeviceContext::RestoreUnorderedAccessViews( void D3D11DeviceContext::RestoreUnorderedAccessViews(
DxbcProgramType Stage,
D3D11UnorderedAccessBindings& Bindings) { D3D11UnorderedAccessBindings& Bindings) {
uint32_t uavSlotId = computeUavBinding (Stage, 0); uint32_t uavSlotId = computeUavBinding (Stage, 0);
uint32_t ctrSlotId = computeUavCounterBinding(Stage, 0); uint32_t ctrSlotId = computeUavCounterBinding(Stage, 0);

View File

@ -679,8 +679,8 @@ namespace dxvk {
void ApplyViewportState(); void ApplyViewportState();
template<DxbcProgramType ShaderStage>
void BindShader( void BindShader(
DxbcProgramType ShaderStage,
const D3D11CommonShader* pShaderModule); const D3D11CommonShader* pShaderModule);
void BindFramebuffer( void BindFramebuffer(
@ -734,15 +734,15 @@ namespace dxvk {
ID3D11Buffer* pBufferForArgs, ID3D11Buffer* pBufferForArgs,
ID3D11Buffer* pBufferForCount); ID3D11Buffer* pBufferForCount);
template<DxbcProgramType ShaderStage>
void SetConstantBuffers( void SetConstantBuffers(
DxbcProgramType ShaderStage,
D3D11ConstantBufferBindings& Bindings, D3D11ConstantBufferBindings& Bindings,
UINT StartSlot, UINT StartSlot,
UINT NumBuffers, UINT NumBuffers,
ID3D11Buffer* const* ppConstantBuffers); ID3D11Buffer* const* ppConstantBuffers);
template<DxbcProgramType ShaderStage>
void SetConstantBuffers1( void SetConstantBuffers1(
DxbcProgramType ShaderStage,
D3D11ConstantBufferBindings& Bindings, D3D11ConstantBufferBindings& Bindings,
UINT StartSlot, UINT StartSlot,
UINT NumBuffers, UINT NumBuffers,
@ -750,22 +750,22 @@ namespace dxvk {
const UINT* pFirstConstant, const UINT* pFirstConstant,
const UINT* pNumConstants); const UINT* pNumConstants);
template<DxbcProgramType ShaderStage>
void SetSamplers( void SetSamplers(
DxbcProgramType ShaderStage,
D3D11SamplerBindings& Bindings, D3D11SamplerBindings& Bindings,
UINT StartSlot, UINT StartSlot,
UINT NumSamplers, UINT NumSamplers,
ID3D11SamplerState* const* ppSamplers); ID3D11SamplerState* const* ppSamplers);
template<DxbcProgramType ShaderStage>
void SetShaderResources( void SetShaderResources(
DxbcProgramType ShaderStage,
D3D11ShaderResourceBindings& Bindings, D3D11ShaderResourceBindings& Bindings,
UINT StartSlot, UINT StartSlot,
UINT NumResources, UINT NumResources,
ID3D11ShaderResourceView* const* ppResources); ID3D11ShaderResourceView* const* ppResources);
template<DxbcProgramType ShaderStage>
void SetUnorderedAccessViews( void SetUnorderedAccessViews(
DxbcProgramType ShaderStage,
D3D11UnorderedAccessBindings& Bindings, D3D11UnorderedAccessBindings& Bindings,
UINT StartSlot, UINT StartSlot,
UINT NumUAVs, UINT NumUAVs,
@ -787,20 +787,20 @@ namespace dxvk {
void RestoreState(); void RestoreState();
template<DxbcProgramType Stage>
void RestoreConstantBuffers( void RestoreConstantBuffers(
DxbcProgramType Stage,
D3D11ConstantBufferBindings& Bindings); D3D11ConstantBufferBindings& Bindings);
template<DxbcProgramType Stage>
void RestoreSamplers( void RestoreSamplers(
DxbcProgramType Stage,
D3D11SamplerBindings& Bindings); D3D11SamplerBindings& Bindings);
template<DxbcProgramType Stage>
void RestoreShaderResources( void RestoreShaderResources(
DxbcProgramType Stage,
D3D11ShaderResourceBindings& Bindings); D3D11ShaderResourceBindings& Bindings);
template<DxbcProgramType Stage>
void RestoreUnorderedAccessViews( void RestoreUnorderedAccessViews(
DxbcProgramType Stage,
D3D11UnorderedAccessBindings& Bindings); D3D11UnorderedAccessBindings& Bindings);
void UpdateMappedBuffer( void UpdateMappedBuffer(