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:
parent
df7573f332
commit
3960355d47
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user