[d3d11] Refactored state object binding

This commit is contained in:
Philip Rebohle 2017-12-11 13:07:27 +01:00
parent 4144e3229a
commit 352b46fe80
5 changed files with 18 additions and 12 deletions

View File

@ -1262,13 +1262,10 @@ namespace dxvk {
if (m_state.rs.state != rasterizerState) {
m_state.rs.state = rasterizerState;
if (rasterizerState != nullptr) {
m_context->setRasterizerState(
rasterizerState->GetDXVKRasterizerState());
} else {
// Restore the initial state
if (rasterizerState != nullptr)
rasterizerState->BindToContext(m_context);
else
this->SetDefaultRasterizerState();
}
// In D3D11, the rasterizer state defines
// whether the scissor test is enabled, so

View File

@ -47,6 +47,12 @@ namespace dxvk {
}
void D3D11DepthStencilState::BindToContext(
const Rc<DxvkContext>& ctx) {
ctx->setDepthStencilState(m_state);
}
VkStencilOpState D3D11DepthStencilState::DecodeStencilOpState(
const D3D11_DEPTH_STENCILOP_DESC& stencilDesc,
const D3D11_DEPTH_STENCIL_DESC& desc) const {

View File

@ -30,9 +30,8 @@ namespace dxvk {
void GetDesc(
D3D11_DEPTH_STENCIL_DESC* pDesc) final;
const DxvkDepthStencilState& GetDXVKDepthStencilState() const {
return m_state;
}
void BindToContext(
const Rc<DxvkContext>& ctx);
private:

View File

@ -86,4 +86,9 @@ namespace dxvk {
*pDesc = m_desc;
}
void D3D11RasterizerState::BindToContext(const Rc<DxvkContext>& ctx) {
ctx->setRasterizerState(m_state);
}
}

View File

@ -29,9 +29,8 @@ namespace dxvk {
void GetDesc(
D3D11_RASTERIZER_DESC* pDesc) final;
const DxvkRasterizerState& GetDXVKRasterizerState() const {
return m_state;
}
void BindToContext(
const Rc<DxvkContext>& ctx);
private: