mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-11 10:24:10 +01:00
[dxvk] Enable sample rate shading if needed
This commit is contained in:
parent
797d7ec81d
commit
687ef77860
@ -62,8 +62,6 @@ namespace dxvk {
|
|||||||
uint32_t sampleMask;
|
uint32_t sampleMask;
|
||||||
VkBool32 enableAlphaToCoverage;
|
VkBool32 enableAlphaToCoverage;
|
||||||
VkBool32 enableAlphaToOne;
|
VkBool32 enableAlphaToOne;
|
||||||
VkBool32 enableSampleShading;
|
|
||||||
float minSampleShading;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1277,8 +1277,6 @@ namespace dxvk {
|
|||||||
m_state.gp.state.msSampleMask = ms.sampleMask;
|
m_state.gp.state.msSampleMask = ms.sampleMask;
|
||||||
m_state.gp.state.msEnableAlphaToCoverage = ms.enableAlphaToCoverage;
|
m_state.gp.state.msEnableAlphaToCoverage = ms.enableAlphaToCoverage;
|
||||||
m_state.gp.state.msEnableAlphaToOne = ms.enableAlphaToOne;
|
m_state.gp.state.msEnableAlphaToOne = ms.enableAlphaToOne;
|
||||||
m_state.gp.state.msEnableSampleShading = ms.enableSampleShading;
|
|
||||||
m_state.gp.state.msMinSampleShading = ms.minSampleShading;
|
|
||||||
|
|
||||||
m_flags.set(DxvkContextFlag::GpDirtyPipelineState);
|
m_flags.set(DxvkContextFlag::GpDirtyPipelineState);
|
||||||
}
|
}
|
||||||
|
@ -64,6 +64,9 @@ namespace dxvk {
|
|||||||
|
|
||||||
m_vsIn = vs != nullptr ? vs->interfaceSlots().inputSlots : 0;
|
m_vsIn = vs != nullptr ? vs->interfaceSlots().inputSlots : 0;
|
||||||
m_fsOut = fs != nullptr ? fs->interfaceSlots().outputSlots : 0;
|
m_fsOut = fs != nullptr ? fs->interfaceSlots().outputSlots : 0;
|
||||||
|
|
||||||
|
m_common.msSampleShadingEnable = fs != nullptr && fs->hasCapability(spv::CapabilitySampleRateShading);
|
||||||
|
m_common.msSampleShadingFactor = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -183,8 +186,8 @@ namespace dxvk {
|
|||||||
msInfo.pNext = nullptr;
|
msInfo.pNext = nullptr;
|
||||||
msInfo.flags = 0;
|
msInfo.flags = 0;
|
||||||
msInfo.rasterizationSamples = state.msSampleCount;
|
msInfo.rasterizationSamples = state.msSampleCount;
|
||||||
msInfo.sampleShadingEnable = state.msEnableSampleShading;
|
msInfo.sampleShadingEnable = m_common.msSampleShadingEnable;
|
||||||
msInfo.minSampleShading = state.msMinSampleShading;
|
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 = state.msEnableAlphaToOne;
|
||||||
|
@ -59,8 +59,6 @@ namespace dxvk {
|
|||||||
uint32_t msSampleMask;
|
uint32_t msSampleMask;
|
||||||
VkBool32 msEnableAlphaToCoverage;
|
VkBool32 msEnableAlphaToCoverage;
|
||||||
VkBool32 msEnableAlphaToOne;
|
VkBool32 msEnableAlphaToOne;
|
||||||
VkBool32 msEnableSampleShading;
|
|
||||||
float msMinSampleShading;
|
|
||||||
|
|
||||||
VkBool32 dsEnableDepthTest;
|
VkBool32 dsEnableDepthTest;
|
||||||
VkBool32 dsEnableDepthWrite;
|
VkBool32 dsEnableDepthWrite;
|
||||||
@ -79,6 +77,18 @@ namespace dxvk {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Common graphics pipeline state
|
||||||
|
*
|
||||||
|
* Non-dynamic pipeline state that cannot
|
||||||
|
* be changed dynamically.
|
||||||
|
*/
|
||||||
|
struct DxvkGraphicsCommonPipelineStateInfo {
|
||||||
|
bool msSampleShadingEnable;
|
||||||
|
float msSampleShadingFactor;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Graphics pipeline
|
* \brief Graphics pipeline
|
||||||
*
|
*
|
||||||
@ -147,6 +157,8 @@ namespace dxvk {
|
|||||||
uint32_t m_vsIn = 0;
|
uint32_t m_vsIn = 0;
|
||||||
uint32_t m_fsOut = 0;
|
uint32_t m_fsOut = 0;
|
||||||
|
|
||||||
|
DxvkGraphicsCommonPipelineStateInfo m_common;
|
||||||
|
|
||||||
std::vector<PipelineStruct> m_pipelines;
|
std::vector<PipelineStruct> m_pipelines;
|
||||||
|
|
||||||
VkPipeline m_basePipeline = VK_NULL_HANDLE;
|
VkPipeline m_basePipeline = VK_NULL_HANDLE;
|
||||||
|
@ -57,6 +57,20 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool DxvkShader::hasCapability(spv::Capability cap) {
|
||||||
|
for (auto ins : m_code) {
|
||||||
|
// OpCapability instructions come first
|
||||||
|
if (ins.opCode() != spv::OpCapability)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (ins.arg(1) == cap)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void DxvkShader::defineResourceSlots(
|
void DxvkShader::defineResourceSlots(
|
||||||
DxvkDescriptorSlotMapping& mapping) const {
|
DxvkDescriptorSlotMapping& mapping) const {
|
||||||
for (const auto& slot : m_slots)
|
for (const auto& slot : m_slots)
|
||||||
|
@ -98,6 +98,18 @@ namespace dxvk {
|
|||||||
|
|
||||||
~DxvkShader();
|
~DxvkShader();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Checks whether a capability is enabled
|
||||||
|
*
|
||||||
|
* If the shader contains an \c OpCapability
|
||||||
|
* instruction with the given capability, it
|
||||||
|
* is considered enabled. This may be required
|
||||||
|
* to correctly set up certain pipeline states.
|
||||||
|
* \param [in] cap The capability to check
|
||||||
|
* \returns \c true if \c cap is enabled
|
||||||
|
*/
|
||||||
|
bool hasCapability(spv::Capability cap);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Adds resource slots definitions to a mapping
|
* \brief Adds resource slots definitions to a mapping
|
||||||
*
|
*
|
||||||
|
@ -198,8 +198,6 @@ namespace dxvk::hud {
|
|||||||
msState.sampleMask = 0xFFFFFFFF;
|
msState.sampleMask = 0xFFFFFFFF;
|
||||||
msState.enableAlphaToCoverage = VK_FALSE;
|
msState.enableAlphaToCoverage = VK_FALSE;
|
||||||
msState.enableAlphaToOne = VK_FALSE;
|
msState.enableAlphaToOne = VK_FALSE;
|
||||||
msState.enableSampleShading = VK_FALSE;
|
|
||||||
msState.minSampleShading = 1.0f;
|
|
||||||
m_context->setMultisampleState(msState);
|
m_context->setMultisampleState(msState);
|
||||||
|
|
||||||
VkStencilOpState stencilOp;
|
VkStencilOpState stencilOp;
|
||||||
|
Loading…
Reference in New Issue
Block a user