1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-31 14:52:11 +01:00

[dxvk] Use dynamic depth bias enable for base pipelines

This is always supported in Vulkan 1.3.
This commit is contained in:
Philip Rebohle 2022-07-14 21:19:22 +02:00
parent d6d7d5137b
commit 0b59af996a
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
3 changed files with 12 additions and 8 deletions

View File

@ -669,6 +669,12 @@ namespace dxvk {
}
void cmdSetDepthBiasState(
VkBool32 depthBiasEnable) {
m_vkd->vkCmdSetDepthBiasEnable(m_execBuffer, depthBiasEnable);
}
void cmdSetDepthBias(
float depthBiasConstantFactor,
float depthBiasClamp,

View File

@ -4547,8 +4547,8 @@ namespace dxvk {
m_state.gp.state.ds.enableDepthBoundsTest());
}
if (!m_flags.test(DxvkContextFlag::GpDynamicDepthBias))
m_cmd->cmdSetDepthBias(0.0f, 0.0f, 0.0f);
m_cmd->cmdSetDepthBiasState(
m_state.gp.state.rs.depthBiasEnable());
if (!m_flags.test(DxvkContextFlag::GpDynamicRasterizerState))
m_cmd->cmdSetRasterizerState(VK_CULL_MODE_FRONT_AND_BACK, VK_FRONT_FACE_CLOCKWISE);

View File

@ -547,10 +547,11 @@ namespace dxvk {
// Set up dynamic state. We do not know any pipeline state
// at this time, so make as much state dynamic as we can.
std::array<VkDynamicState, 5> dynamicStates = {{
std::array<VkDynamicState, 6> dynamicStates = {{
VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT,
VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT,
VK_DYNAMIC_STATE_DEPTH_BIAS,
VK_DYNAMIC_STATE_DEPTH_BIAS_ENABLE,
VK_DYNAMIC_STATE_CULL_MODE,
VK_DYNAMIC_STATE_FRONT_FACE,
}};
@ -562,17 +563,14 @@ namespace dxvk {
// All viewport state is dynamic, so we do not need to initialize this.
VkPipelineViewportStateCreateInfo vpInfo = { VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO };
// Set up rasterizer state. Depth bias, cull mode and front face are all
// dynamic, but we do not have dynamic state for depth bias enablement
// with the original version of VK_EXT_extended_dynamic_state, so always
// enable that. Do not support any polygon modes other than FILL.
// Set up rasterizer state. Depth bias, cull mode and front face are
// all dynamic. Do not support any polygon modes other than FILL.
VkPipelineRasterizationDepthClipStateCreateInfoEXT rsDepthClipInfo = { VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_DEPTH_CLIP_STATE_CREATE_INFO_EXT };
VkPipelineRasterizationStateCreateInfo rsInfo = { VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO };
rsInfo.depthClampEnable = VK_TRUE;
rsInfo.rasterizerDiscardEnable = VK_FALSE;
rsInfo.polygonMode = VK_POLYGON_MODE_FILL;
rsInfo.depthBiasEnable = VK_TRUE;
rsInfo.lineWidth = 1.0f;
if (m_device->features().extDepthClipEnable.depthClipEnable) {