mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-03 13:24:20 +01:00
[dxvk] Introduce extra pipeline state
Provides extra state that will be passed in via spec constants. Whether or not this state is used is determined by the shaders.
This commit is contained in:
parent
18d2905bf7
commit
70510bab9a
@ -180,4 +180,16 @@ 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;
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
@ -2031,6 +2031,14 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DxvkContext::setExtraState(
|
||||||
|
const DxvkExtraState& xs) {
|
||||||
|
m_state.gp.state.xsAlphaCompareOp = xs.alphaCompareOp;
|
||||||
|
|
||||||
|
m_flags.set(DxvkContextFlag::GpDirtyPipelineState);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void DxvkContext::setPredicate(
|
void DxvkContext::setPredicate(
|
||||||
const DxvkBufferSlice& predicate,
|
const DxvkBufferSlice& predicate,
|
||||||
VkConditionalRenderingFlagsEXT flags) {
|
VkConditionalRenderingFlagsEXT flags) {
|
||||||
|
@ -813,6 +813,13 @@ 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
|
||||||
*
|
*
|
||||||
|
@ -204,6 +204,8 @@ namespace dxvk {
|
|||||||
// Set up some specialization constants
|
// Set up some specialization constants
|
||||||
DxvkSpecConstantData specData;
|
DxvkSpecConstantData specData;
|
||||||
specData.rasterizerSampleCount = uint32_t(sampleCount);
|
specData.rasterizerSampleCount = uint32_t(sampleCount);
|
||||||
|
specData.alphaTestEnable = state.xsAlphaCompareOp != VK_COMPARE_OP_ALWAYS;
|
||||||
|
specData.alphaCompareOp = state.xsAlphaCompareOp;
|
||||||
|
|
||||||
for (uint32_t i = 0; i < MaxNumActiveBindings; i++)
|
for (uint32_t i = 0; i < MaxNumActiveBindings; i++)
|
||||||
specData.activeBindings[i] = state.bsBindingMask.isBound(i) ? VK_TRUE : VK_FALSE;
|
specData.activeBindings[i] = state.bsBindingMask.isBound(i) ? VK_TRUE : VK_FALSE;
|
||||||
@ -353,7 +355,7 @@ namespace dxvk {
|
|||||||
msInfo.minSampleShading = m_common.msSampleShadingFactor;
|
msInfo.minSampleShading = m_common.msSampleShadingFactor;
|
||||||
msInfo.pSampleMask = &state.msSampleMask;
|
msInfo.pSampleMask = &state.msSampleMask;
|
||||||
msInfo.alphaToCoverageEnable = state.msEnableAlphaToCoverage;
|
msInfo.alphaToCoverageEnable = state.msEnableAlphaToCoverage;
|
||||||
msInfo.alphaToOneEnable = state.msEnableAlphaToOne;
|
msInfo.alphaToOneEnable = VK_FALSE;
|
||||||
|
|
||||||
VkPipelineDepthStencilStateCreateInfo dsInfo;
|
VkPipelineDepthStencilStateCreateInfo dsInfo;
|
||||||
dsInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO;
|
dsInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO;
|
||||||
|
@ -92,7 +92,8 @@ namespace dxvk {
|
|||||||
VkSampleCountFlags msSampleCount;
|
VkSampleCountFlags msSampleCount;
|
||||||
uint32_t msSampleMask;
|
uint32_t msSampleMask;
|
||||||
VkBool32 msEnableAlphaToCoverage;
|
VkBool32 msEnableAlphaToCoverage;
|
||||||
VkBool32 msEnableAlphaToOne;
|
|
||||||
|
VkCompareOp xsAlphaCompareOp;
|
||||||
|
|
||||||
VkBool32 dsEnableDepthTest;
|
VkBool32 dsEnableDepthTest;
|
||||||
VkBool32 dsEnableDepthWrite;
|
VkBool32 dsEnableDepthWrite;
|
||||||
|
@ -30,10 +30,12 @@ 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 + 0,
|
||||||
|
AlphaTestEnable,
|
||||||
|
AlphaCompareOp,
|
||||||
|
|
||||||
/// Lowest and highest known spec constant IDs
|
/// Lowest and highest known spec constant IDs
|
||||||
SpecConstantIdMin = RasterizerSampleCount,
|
SpecConstantIdMin = RasterizerSampleCount,
|
||||||
SpecConstantIdMax = RasterizerSampleCount,
|
SpecConstantIdMax = AlphaCompareOp,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,6 +11,8 @@ namespace dxvk {
|
|||||||
|
|
||||||
DxvkSpecConstantMap::DxvkSpecConstantMap() {
|
DxvkSpecConstantMap::DxvkSpecConstantMap() {
|
||||||
SET_CONSTANT_ENTRY(DxvkSpecConstantId::RasterizerSampleCount, rasterizerSampleCount);
|
SET_CONSTANT_ENTRY(DxvkSpecConstantId::RasterizerSampleCount, rasterizerSampleCount);
|
||||||
|
SET_CONSTANT_ENTRY(DxvkSpecConstantId::AlphaTestEnable, alphaTestEnable);
|
||||||
|
SET_CONSTANT_ENTRY(DxvkSpecConstantId::AlphaCompareOp, alphaCompareOp);
|
||||||
|
|
||||||
for (uint32_t i = 0; i < MaxNumActiveBindings; i++)
|
for (uint32_t i = 0; i < MaxNumActiveBindings; i++)
|
||||||
this->setBindingEntry(i);
|
this->setBindingEntry(i);
|
||||||
|
@ -18,6 +18,8 @@ namespace dxvk {
|
|||||||
*/
|
*/
|
||||||
struct DxvkSpecConstantData {
|
struct DxvkSpecConstantData {
|
||||||
uint32_t rasterizerSampleCount;
|
uint32_t rasterizerSampleCount;
|
||||||
|
VkBool32 alphaTestEnable;
|
||||||
|
VkCompareOp alphaCompareOp;
|
||||||
uint32_t outputMappings[MaxNumRenderTargets * 4];
|
uint32_t outputMappings[MaxNumRenderTargets * 4];
|
||||||
VkBool32 activeBindings[MaxNumActiveBindings];
|
VkBool32 activeBindings[MaxNumActiveBindings];
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user