mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-14 00:48:44 +01:00
[d3d11] Refactor shader state
This commit is contained in:
parent
95ab1465ab
commit
9f07bc6532
@ -1318,8 +1318,8 @@ namespace dxvk {
|
|||||||
if (NumClassInstances)
|
if (NumClassInstances)
|
||||||
Logger::err("D3D11: Class instances not supported");
|
Logger::err("D3D11: Class instances not supported");
|
||||||
|
|
||||||
if (m_state.vs.shader != shader) {
|
if (m_state.vs != shader) {
|
||||||
m_state.vs.shader = shader;
|
m_state.vs = shader;
|
||||||
|
|
||||||
BindShader<DxbcProgramType::VertexShader>(GetCommonShader(shader));
|
BindShader<DxbcProgramType::VertexShader>(GetCommonShader(shader));
|
||||||
}
|
}
|
||||||
@ -1385,7 +1385,7 @@ namespace dxvk {
|
|||||||
D3D10DeviceLock lock = LockContext();
|
D3D10DeviceLock lock = LockContext();
|
||||||
|
|
||||||
if (ppVertexShader)
|
if (ppVertexShader)
|
||||||
*ppVertexShader = m_state.vs.shader.ref();
|
*ppVertexShader = m_state.vs.ref();
|
||||||
|
|
||||||
if (pNumClassInstances)
|
if (pNumClassInstances)
|
||||||
*pNumClassInstances = 0;
|
*pNumClassInstances = 0;
|
||||||
@ -1456,8 +1456,8 @@ namespace dxvk {
|
|||||||
if (NumClassInstances)
|
if (NumClassInstances)
|
||||||
Logger::err("D3D11: Class instances not supported");
|
Logger::err("D3D11: Class instances not supported");
|
||||||
|
|
||||||
if (m_state.hs.shader != shader) {
|
if (m_state.hs != shader) {
|
||||||
m_state.hs.shader = shader;
|
m_state.hs = shader;
|
||||||
|
|
||||||
BindShader<DxbcProgramType::HullShader>(GetCommonShader(shader));
|
BindShader<DxbcProgramType::HullShader>(GetCommonShader(shader));
|
||||||
}
|
}
|
||||||
@ -1523,7 +1523,7 @@ namespace dxvk {
|
|||||||
D3D10DeviceLock lock = LockContext();
|
D3D10DeviceLock lock = LockContext();
|
||||||
|
|
||||||
if (ppHullShader)
|
if (ppHullShader)
|
||||||
*ppHullShader = m_state.hs.shader.ref();
|
*ppHullShader = m_state.hs.ref();
|
||||||
|
|
||||||
if (pNumClassInstances)
|
if (pNumClassInstances)
|
||||||
*pNumClassInstances = 0;
|
*pNumClassInstances = 0;
|
||||||
@ -1594,8 +1594,8 @@ namespace dxvk {
|
|||||||
if (NumClassInstances)
|
if (NumClassInstances)
|
||||||
Logger::err("D3D11: Class instances not supported");
|
Logger::err("D3D11: Class instances not supported");
|
||||||
|
|
||||||
if (m_state.ds.shader != shader) {
|
if (m_state.ds != shader) {
|
||||||
m_state.ds.shader = shader;
|
m_state.ds = shader;
|
||||||
|
|
||||||
BindShader<DxbcProgramType::DomainShader>(GetCommonShader(shader));
|
BindShader<DxbcProgramType::DomainShader>(GetCommonShader(shader));
|
||||||
}
|
}
|
||||||
@ -1661,7 +1661,7 @@ namespace dxvk {
|
|||||||
D3D10DeviceLock lock = LockContext();
|
D3D10DeviceLock lock = LockContext();
|
||||||
|
|
||||||
if (ppDomainShader)
|
if (ppDomainShader)
|
||||||
*ppDomainShader = m_state.ds.shader.ref();
|
*ppDomainShader = m_state.ds.ref();
|
||||||
|
|
||||||
if (pNumClassInstances)
|
if (pNumClassInstances)
|
||||||
*pNumClassInstances = 0;
|
*pNumClassInstances = 0;
|
||||||
@ -1732,8 +1732,8 @@ namespace dxvk {
|
|||||||
if (NumClassInstances)
|
if (NumClassInstances)
|
||||||
Logger::err("D3D11: Class instances not supported");
|
Logger::err("D3D11: Class instances not supported");
|
||||||
|
|
||||||
if (m_state.gs.shader != shader) {
|
if (m_state.gs != shader) {
|
||||||
m_state.gs.shader = shader;
|
m_state.gs = shader;
|
||||||
|
|
||||||
BindShader<DxbcProgramType::GeometryShader>(GetCommonShader(shader));
|
BindShader<DxbcProgramType::GeometryShader>(GetCommonShader(shader));
|
||||||
}
|
}
|
||||||
@ -1799,7 +1799,7 @@ namespace dxvk {
|
|||||||
D3D10DeviceLock lock = LockContext();
|
D3D10DeviceLock lock = LockContext();
|
||||||
|
|
||||||
if (ppGeometryShader)
|
if (ppGeometryShader)
|
||||||
*ppGeometryShader = m_state.gs.shader.ref();
|
*ppGeometryShader = m_state.gs.ref();
|
||||||
|
|
||||||
if (pNumClassInstances)
|
if (pNumClassInstances)
|
||||||
*pNumClassInstances = 0;
|
*pNumClassInstances = 0;
|
||||||
@ -1870,8 +1870,8 @@ namespace dxvk {
|
|||||||
if (NumClassInstances)
|
if (NumClassInstances)
|
||||||
Logger::err("D3D11: Class instances not supported");
|
Logger::err("D3D11: Class instances not supported");
|
||||||
|
|
||||||
if (m_state.ps.shader != shader) {
|
if (m_state.ps != shader) {
|
||||||
m_state.ps.shader = shader;
|
m_state.ps = shader;
|
||||||
|
|
||||||
BindShader<DxbcProgramType::PixelShader>(GetCommonShader(shader));
|
BindShader<DxbcProgramType::PixelShader>(GetCommonShader(shader));
|
||||||
}
|
}
|
||||||
@ -1937,7 +1937,7 @@ namespace dxvk {
|
|||||||
D3D10DeviceLock lock = LockContext();
|
D3D10DeviceLock lock = LockContext();
|
||||||
|
|
||||||
if (ppPixelShader)
|
if (ppPixelShader)
|
||||||
*ppPixelShader = m_state.ps.shader.ref();
|
*ppPixelShader = m_state.ps.ref();
|
||||||
|
|
||||||
if (pNumClassInstances)
|
if (pNumClassInstances)
|
||||||
*pNumClassInstances = 0;
|
*pNumClassInstances = 0;
|
||||||
@ -2008,8 +2008,8 @@ namespace dxvk {
|
|||||||
if (NumClassInstances)
|
if (NumClassInstances)
|
||||||
Logger::err("D3D11: Class instances not supported");
|
Logger::err("D3D11: Class instances not supported");
|
||||||
|
|
||||||
if (m_state.cs.shader != shader) {
|
if (m_state.cs != shader) {
|
||||||
m_state.cs.shader = shader;
|
m_state.cs = shader;
|
||||||
|
|
||||||
BindShader<DxbcProgramType::ComputeShader>(GetCommonShader(shader));
|
BindShader<DxbcProgramType::ComputeShader>(GetCommonShader(shader));
|
||||||
}
|
}
|
||||||
@ -2132,7 +2132,7 @@ namespace dxvk {
|
|||||||
D3D10DeviceLock lock = LockContext();
|
D3D10DeviceLock lock = LockContext();
|
||||||
|
|
||||||
if (ppComputeShader)
|
if (ppComputeShader)
|
||||||
*ppComputeShader = m_state.cs.shader.ref();
|
*ppComputeShader = m_state.cs.ref();
|
||||||
|
|
||||||
if (pNumClassInstances)
|
if (pNumClassInstances)
|
||||||
*pNumClassInstances = 0;
|
*pNumClassInstances = 0;
|
||||||
@ -3884,13 +3884,13 @@ namespace dxvk {
|
|||||||
|
|
||||||
template<typename ContextType>
|
template<typename ContextType>
|
||||||
void D3D11CommonContext<ContextType>::ResetContextState() {
|
void D3D11CommonContext<ContextType>::ResetContextState() {
|
||||||
// Default shaders
|
// Reset shaders
|
||||||
m_state.vs.shader = nullptr;
|
m_state.vs = nullptr;
|
||||||
m_state.hs.shader = nullptr;
|
m_state.hs = nullptr;
|
||||||
m_state.ds.shader = nullptr;
|
m_state.ds = nullptr;
|
||||||
m_state.gs.shader = nullptr;
|
m_state.gs = nullptr;
|
||||||
m_state.ps.shader = nullptr;
|
m_state.ps = nullptr;
|
||||||
m_state.cs.shader = nullptr;
|
m_state.cs = nullptr;
|
||||||
|
|
||||||
// Reset render state
|
// Reset render state
|
||||||
m_state.id.reset();
|
m_state.id.reset();
|
||||||
@ -4016,12 +4016,12 @@ namespace dxvk {
|
|||||||
void D3D11CommonContext<ContextType>::RestoreCommandListState() {
|
void D3D11CommonContext<ContextType>::RestoreCommandListState() {
|
||||||
BindFramebuffer();
|
BindFramebuffer();
|
||||||
|
|
||||||
BindShader<DxbcProgramType::VertexShader> (GetCommonShader(m_state.vs.shader.ptr()));
|
BindShader<DxbcProgramType::VertexShader>(GetCommonShader(m_state.vs.ptr()));
|
||||||
BindShader<DxbcProgramType::HullShader> (GetCommonShader(m_state.hs.shader.ptr()));
|
BindShader<DxbcProgramType::HullShader>(GetCommonShader(m_state.hs.ptr()));
|
||||||
BindShader<DxbcProgramType::DomainShader> (GetCommonShader(m_state.ds.shader.ptr()));
|
BindShader<DxbcProgramType::DomainShader>(GetCommonShader(m_state.ds.ptr()));
|
||||||
BindShader<DxbcProgramType::GeometryShader> (GetCommonShader(m_state.gs.shader.ptr()));
|
BindShader<DxbcProgramType::GeometryShader>(GetCommonShader(m_state.gs.ptr()));
|
||||||
BindShader<DxbcProgramType::PixelShader> (GetCommonShader(m_state.ps.shader.ptr()));
|
BindShader<DxbcProgramType::PixelShader>(GetCommonShader(m_state.ps.ptr()));
|
||||||
BindShader<DxbcProgramType::ComputeShader> (GetCommonShader(m_state.cs.shader.ptr()));
|
BindShader<DxbcProgramType::ComputeShader>(GetCommonShader(m_state.cs.ptr()));
|
||||||
|
|
||||||
ApplyInputLayout();
|
ApplyInputLayout();
|
||||||
ApplyPrimitiveTopology();
|
ApplyPrimitiveTopology();
|
||||||
|
@ -124,36 +124,6 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct D3D11ContextStateVS {
|
|
||||||
Com<D3D11VertexShader> shader = nullptr;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
struct D3D11ContextStateHS {
|
|
||||||
Com<D3D11HullShader> shader = nullptr;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
struct D3D11ContextStateDS {
|
|
||||||
Com<D3D11DomainShader> shader = nullptr;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
struct D3D11ContextStateGS {
|
|
||||||
Com<D3D11GeometryShader> shader = nullptr;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
struct D3D11ContextStatePS {
|
|
||||||
Com<D3D11PixelShader> shader = nullptr;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
struct D3D11ContextStateCS {
|
|
||||||
Com<D3D11ComputeShader> shader = nullptr;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Input assembly state
|
* \brief Input assembly state
|
||||||
*
|
*
|
||||||
@ -321,12 +291,12 @@ namespace dxvk {
|
|||||||
* \brief Context state
|
* \brief Context state
|
||||||
*/
|
*/
|
||||||
struct D3D11ContextState {
|
struct D3D11ContextState {
|
||||||
D3D11ContextStateCS cs;
|
Com<D3D11VertexShader> vs;
|
||||||
D3D11ContextStateDS ds;
|
Com<D3D11HullShader> hs;
|
||||||
D3D11ContextStateGS gs;
|
Com<D3D11DomainShader> ds;
|
||||||
D3D11ContextStateHS hs;
|
Com<D3D11GeometryShader> gs;
|
||||||
D3D11ContextStatePS ps;
|
Com<D3D11PixelShader> ps;
|
||||||
D3D11ContextStateVS vs;
|
Com<D3D11ComputeShader> cs;
|
||||||
|
|
||||||
D3D11ContextStateID id;
|
D3D11ContextStateID id;
|
||||||
D3D11ContextStateIA ia;
|
D3D11ContextStateIA ia;
|
||||||
|
Loading…
Reference in New Issue
Block a user