mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-01 16:24:12 +01:00
[d3d9] Don't perform clipping in FF if disabled
Avoids unnecessary matrix multiplications in the shader, given this isn't as cheap as it is for programmable.
This commit is contained in:
parent
0c16cc7749
commit
7d3ec74b40
@ -1668,6 +1668,8 @@ namespace dxvk {
|
||||
bool changed = states[State] != Value;
|
||||
|
||||
if (likely(changed)) {
|
||||
const bool oldClipPlaneEnabled = IsClipPlaneEnabled();
|
||||
|
||||
const bool oldDepthBiasEnabled = IsDepthBiasEnabled();
|
||||
|
||||
const bool oldATOC = IsAlphaToCoverageEnabled();
|
||||
@ -1836,9 +1838,15 @@ namespace dxvk {
|
||||
m_flags.set(D3D9DeviceFlag::DirtyRasterizerState);
|
||||
break;
|
||||
|
||||
case D3DRS_CLIPPLANEENABLE:
|
||||
case D3DRS_CLIPPLANEENABLE: {
|
||||
const bool clipPlaneEnabled = IsClipPlaneEnabled();
|
||||
|
||||
if (clipPlaneEnabled != oldClipPlaneEnabled)
|
||||
m_flags.set(D3D9DeviceFlag::DirtyFFVertexShader);
|
||||
|
||||
m_flags.set(D3D9DeviceFlag::DirtyClipPlanes);
|
||||
break;
|
||||
}
|
||||
|
||||
case D3DRS_ALPHAREF:
|
||||
UpdatePushConstant<D3D9RenderStateItem::AlphaRef>();
|
||||
@ -5946,6 +5954,8 @@ namespace dxvk {
|
||||
key.Data.Contents.VertexBlendCount = m_state.renderStates[D3DRS_VERTEXBLEND] & 0xff;
|
||||
}
|
||||
|
||||
key.Data.Contents.VertexClipping = IsClipPlaneEnabled();
|
||||
|
||||
EmitCs([
|
||||
this,
|
||||
cKey = key,
|
||||
|
@ -776,6 +776,10 @@ namespace dxvk {
|
||||
return m_state.renderStates[D3DRS_ZENABLE] && m_state.depthStencil != nullptr;
|
||||
}
|
||||
|
||||
inline bool IsClipPlaneEnabled() {
|
||||
return m_state.renderStates[D3DRS_CLIPPLANEENABLE] != 0;
|
||||
}
|
||||
|
||||
void BindMultiSampleState();
|
||||
|
||||
void BindBlendState();
|
||||
|
@ -1163,6 +1163,7 @@ namespace dxvk {
|
||||
uint32_t pointSize = m_module.opFClamp(m_floatType, pointInfo.defaultValue, pointInfo.min, pointInfo.max);
|
||||
m_module.opStore(m_vs.out.POINTSIZE, pointSize);
|
||||
|
||||
if (m_vsKey.Data.Contents.VertexClipping)
|
||||
emitVsClipping(vtx);
|
||||
}
|
||||
|
||||
|
@ -107,6 +107,8 @@ namespace dxvk {
|
||||
uint32_t VertexBlendMode : 2;
|
||||
uint32_t VertexBlendIndexed : 1;
|
||||
uint32_t VertexBlendCount : 3;
|
||||
|
||||
uint32_t VertexClipping : 1;
|
||||
} Contents;
|
||||
|
||||
uint32_t Primitive[4];
|
||||
|
Loading…
Reference in New Issue
Block a user