1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-02-20 19:54:19 +01:00

[d3d11] Avoid redundant viewport updates in RSSetState

Rise of the Tomb Raider changes its rasterizer state very frequently
(once every handful of draws), and the viewport package is very large,
so we should avoid sending it to the CS thread redundantly.

We only need to update when the scissor test state has changed.
This commit is contained in:
Philip Rebohle 2019-01-23 05:36:49 +01:00
parent df7573f332
commit 3960355d47
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 16 additions and 2 deletions

View File

@ -2688,14 +2688,24 @@ namespace dxvk {
auto rasterizerState = static_cast<D3D11RasterizerState*>(pRasterizerState);
bool currScissorEnable = m_state.rs.state != nullptr
? m_state.rs.state->Desc()->ScissorEnable
: false;
bool nextScissorEnable = rasterizerState != nullptr
? rasterizerState->Desc()->ScissorEnable
: false;
if (m_state.rs.state != rasterizerState) {
m_state.rs.state = rasterizerState;
// In D3D11, the rasterizer state defines whether the
// scissor test is enabled, so we have to update the
// scissor rectangles as well.
ApplyRasterizerState();
ApplyViewportState();
if (currScissorEnable != nextScissorEnable)
ApplyViewportState();
}
}

View File

@ -34,6 +34,10 @@ namespace dxvk {
void STDMETHODCALLTYPE GetDesc1(
D3D11_RASTERIZER_DESC1* pDesc) final;
const D3D11_RASTERIZER_DESC1* Desc() const {
return &m_desc;
}
void BindToContext(
const Rc<DxvkContext>& ctx);