mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-19 05:52:11 +01:00
[dxvk] Remove extra pipeline state
This can be expressed with specialization constants now.
This commit is contained in:
parent
a0c67191a7
commit
7687db0303
@ -3121,17 +3121,6 @@ namespace dxvk {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void D3D11DeviceContext::ApplyUnusedState() {
|
|
||||||
// Initialize state that isn't exposed in D3D11
|
|
||||||
EmitCs([] (DxvkContext* ctx) {
|
|
||||||
DxvkExtraState xs;
|
|
||||||
xs.alphaCompareOp = VK_COMPARE_OP_ALWAYS;
|
|
||||||
|
|
||||||
ctx->setExtraState(xs);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void D3D11DeviceContext::BindShader(
|
void D3D11DeviceContext::BindShader(
|
||||||
DxbcProgramType ShaderStage,
|
DxbcProgramType ShaderStage,
|
||||||
@ -3577,7 +3566,6 @@ namespace dxvk {
|
|||||||
ApplyStencilRef();
|
ApplyStencilRef();
|
||||||
ApplyRasterizerState();
|
ApplyRasterizerState();
|
||||||
ApplyViewportState();
|
ApplyViewportState();
|
||||||
ApplyUnusedState();
|
|
||||||
|
|
||||||
BindDrawBuffers(
|
BindDrawBuffers(
|
||||||
m_state.id.argBuffer.ptr(),
|
m_state.id.argBuffer.ptr(),
|
||||||
|
@ -679,8 +679,6 @@ namespace dxvk {
|
|||||||
|
|
||||||
void ApplyViewportState();
|
void ApplyViewportState();
|
||||||
|
|
||||||
void ApplyUnusedState();
|
|
||||||
|
|
||||||
void BindShader(
|
void BindShader(
|
||||||
DxbcProgramType ShaderStage,
|
DxbcProgramType ShaderStage,
|
||||||
const D3D11CommonShader* pShaderModule);
|
const D3D11CommonShader* pShaderModule);
|
||||||
|
@ -279,7 +279,6 @@ namespace dxvk {
|
|||||||
m_context->setMultisampleState(m_msState);
|
m_context->setMultisampleState(m_msState);
|
||||||
m_context->setDepthStencilState(m_dsState);
|
m_context->setDepthStencilState(m_dsState);
|
||||||
m_context->setLogicOpState(m_loState);
|
m_context->setLogicOpState(m_loState);
|
||||||
m_context->setExtraState(m_xsState);
|
|
||||||
m_context->setBlendMode(0, m_blendMode);
|
m_context->setBlendMode(0, m_blendMode);
|
||||||
|
|
||||||
m_context->setInputAssemblyState(m_iaState);
|
m_context->setInputAssemblyState(m_iaState);
|
||||||
@ -615,8 +614,6 @@ namespace dxvk {
|
|||||||
m_loState.enableLogicOp = VK_FALSE;
|
m_loState.enableLogicOp = VK_FALSE;
|
||||||
m_loState.logicOp = VK_LOGIC_OP_NO_OP;
|
m_loState.logicOp = VK_LOGIC_OP_NO_OP;
|
||||||
|
|
||||||
m_xsState.alphaCompareOp = VK_COMPARE_OP_ALWAYS;
|
|
||||||
|
|
||||||
m_blendMode.enableBlending = VK_FALSE;
|
m_blendMode.enableBlending = VK_FALSE;
|
||||||
m_blendMode.colorSrcFactor = VK_BLEND_FACTOR_ONE;
|
m_blendMode.colorSrcFactor = VK_BLEND_FACTOR_ONE;
|
||||||
m_blendMode.colorDstFactor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
|
m_blendMode.colorDstFactor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
|
||||||
|
@ -109,7 +109,6 @@ namespace dxvk {
|
|||||||
DxvkMultisampleState m_msState;
|
DxvkMultisampleState m_msState;
|
||||||
DxvkDepthStencilState m_dsState;
|
DxvkDepthStencilState m_dsState;
|
||||||
DxvkLogicOpState m_loState;
|
DxvkLogicOpState m_loState;
|
||||||
DxvkExtraState m_xsState;
|
|
||||||
DxvkBlendMode m_blendMode;
|
DxvkBlendMode m_blendMode;
|
||||||
|
|
||||||
D3D11Texture2D* m_backBuffer = nullptr;
|
D3D11Texture2D* m_backBuffer = nullptr;
|
||||||
|
@ -204,16 +204,4 @@ namespace dxvk {
|
|||||||
std::array<DxvkVertexBinding, DxvkLimits::MaxNumVertexBindings> bindings;
|
std::array<DxvkVertexBinding, DxvkLimits::MaxNumVertexBindings> bindings;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Extra state
|
|
||||||
*
|
|
||||||
* Additional state that will be passed to
|
|
||||||
* the graphics pipeline as specialization
|
|
||||||
* constants.
|
|
||||||
*/
|
|
||||||
struct DxvkExtraState {
|
|
||||||
VkCompareOp alphaCompareOp;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
@ -2142,14 +2142,6 @@ namespace dxvk {
|
|||||||
|
|
||||||
m_flags.set(DxvkContextFlag::GpDirtyPipelineState);
|
m_flags.set(DxvkContextFlag::GpDirtyPipelineState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DxvkContext::setExtraState(
|
|
||||||
const DxvkExtraState& xs) {
|
|
||||||
m_state.gp.state.xsAlphaCompareOp = xs.alphaCompareOp;
|
|
||||||
|
|
||||||
m_flags.set(DxvkContextFlag::GpDirtyPipelineState);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void DxvkContext::setPredicate(
|
void DxvkContext::setPredicate(
|
||||||
|
@ -856,13 +856,6 @@ namespace dxvk {
|
|||||||
uint32_t attachment,
|
uint32_t attachment,
|
||||||
const DxvkBlendMode& blendMode);
|
const DxvkBlendMode& blendMode);
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Sets extra pipeline state
|
|
||||||
* \param [in] xs New state object
|
|
||||||
*/
|
|
||||||
void setExtraState(
|
|
||||||
const DxvkExtraState& xs);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Sets predicate
|
* \brief Sets predicate
|
||||||
*
|
*
|
||||||
|
@ -192,8 +192,6 @@ namespace dxvk {
|
|||||||
// Set up some specialization constants
|
// Set up some specialization constants
|
||||||
DxvkSpecConstants specData;
|
DxvkSpecConstants specData;
|
||||||
specData.set(uint32_t(DxvkSpecConstantId::RasterizerSampleCount), sampleCount, VK_SAMPLE_COUNT_1_BIT);
|
specData.set(uint32_t(DxvkSpecConstantId::RasterizerSampleCount), sampleCount, VK_SAMPLE_COUNT_1_BIT);
|
||||||
specData.set(uint32_t(DxvkSpecConstantId::AlphaTestEnable), state.xsAlphaCompareOp != VK_COMPARE_OP_ALWAYS, false);
|
|
||||||
specData.set(uint32_t(DxvkSpecConstantId::AlphaCompareOp), state.xsAlphaCompareOp, VK_COMPARE_OP_ALWAYS);
|
|
||||||
|
|
||||||
for (uint32_t i = 0; i < m_layout->bindingCount(); i++)
|
for (uint32_t i = 0; i < m_layout->bindingCount(); i++)
|
||||||
specData.set(i, state.bsBindingMask.isBound(i), true);
|
specData.set(i, state.bsBindingMask.isBound(i), true);
|
||||||
|
@ -97,8 +97,6 @@ namespace dxvk {
|
|||||||
uint32_t msSampleMask;
|
uint32_t msSampleMask;
|
||||||
VkBool32 msEnableAlphaToCoverage;
|
VkBool32 msEnableAlphaToCoverage;
|
||||||
|
|
||||||
VkCompareOp xsAlphaCompareOp;
|
|
||||||
|
|
||||||
VkBool32 dsEnableDepthTest;
|
VkBool32 dsEnableDepthTest;
|
||||||
VkBool32 dsEnableDepthWrite;
|
VkBool32 dsEnableDepthWrite;
|
||||||
VkBool32 dsEnableDepthBoundsTest;
|
VkBool32 dsEnableDepthBoundsTest;
|
||||||
|
@ -30,13 +30,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
// Specialization constants for pipeline state
|
// Specialization constants for pipeline state
|
||||||
SpecConstantRangeStart = ColorComponentMappings + MaxNumRenderTargets * 4,
|
SpecConstantRangeStart = ColorComponentMappings + MaxNumRenderTargets * 4,
|
||||||
RasterizerSampleCount = SpecConstantRangeStart + 0,
|
RasterizerSampleCount = SpecConstantRangeStart,
|
||||||
AlphaTestEnable,
|
|
||||||
AlphaCompareOp,
|
|
||||||
|
|
||||||
/// Lowest and highest known spec constant IDs
|
|
||||||
SpecConstantIdMin = RasterizerSampleCount,
|
|
||||||
SpecConstantIdMax = AlphaCompareOp,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -309,7 +309,6 @@ namespace dxvk {
|
|||||||
if (readCacheEntry(ifile, entry)) {
|
if (readCacheEntry(ifile, entry)) {
|
||||||
switch (curHeader.version) {
|
switch (curHeader.version) {
|
||||||
case 2: convertEntryV2(entry); /* fall through */
|
case 2: convertEntryV2(entry); /* fall through */
|
||||||
case 3: convertEntryV3(entry); /* fall through */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t entryId = m_entries.size();
|
size_t entryId = m_entries.size();
|
||||||
@ -406,16 +405,6 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool DxvkStateCache::convertEntryV3(
|
|
||||||
DxvkStateCacheEntry& entry) const {
|
|
||||||
// Semantics changed:
|
|
||||||
// v3: Unused, always set to 0
|
|
||||||
// v4: Alpha test compare op
|
|
||||||
entry.gpState.xsAlphaCompareOp = VK_COMPARE_OP_ALWAYS;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void DxvkStateCache::workerFunc() {
|
void DxvkStateCache::workerFunc() {
|
||||||
env::setThreadName("dxvk-shader");
|
env::setThreadName("dxvk-shader");
|
||||||
|
|
||||||
|
@ -213,9 +213,6 @@ namespace dxvk {
|
|||||||
bool convertEntryV2(
|
bool convertEntryV2(
|
||||||
DxvkStateCacheEntry& entry) const;
|
DxvkStateCacheEntry& entry) const;
|
||||||
|
|
||||||
bool convertEntryV3(
|
|
||||||
DxvkStateCacheEntry& entry) const;
|
|
||||||
|
|
||||||
void workerFunc();
|
void workerFunc();
|
||||||
|
|
||||||
void writerFunc();
|
void writerFunc();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user