|
|
|
@ -735,13 +735,18 @@ void GraphicsPipeline::MakePipeline(VkRenderPass render_pass) { |
|
|
|
.lineWidth = 1.0f, |
|
|
|
// TODO(alekpop): Transfer from regs
|
|
|
|
}; |
|
|
|
const bool smooth_lines_supported = |
|
|
|
device.IsExtLineRasterizationSupported() && device.SupportsSmoothLines(); |
|
|
|
const bool stippled_lines_supported = |
|
|
|
device.IsExtLineRasterizationSupported() && device.SupportsStippledRectangularLines(); |
|
|
|
VkPipelineRasterizationLineStateCreateInfoEXT line_state{ |
|
|
|
.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_LINE_STATE_CREATE_INFO_EXT, |
|
|
|
.pNext = nullptr, |
|
|
|
.lineRasterizationMode = key.state.smooth_lines != 0 |
|
|
|
.lineRasterizationMode = key.state.smooth_lines != 0 && smooth_lines_supported |
|
|
|
? VK_LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT |
|
|
|
: VK_LINE_RASTERIZATION_MODE_RECTANGULAR_EXT, |
|
|
|
.stippledLineEnable = dynamic.line_stipple_enable ? VK_TRUE : VK_FALSE, |
|
|
|
.stippledLineEnable = |
|
|
|
(dynamic.line_stipple_enable && stippled_lines_supported) ? VK_TRUE : VK_FALSE, |
|
|
|
.lineStippleFactor = key.state.line_stipple_factor, |
|
|
|
.lineStipplePattern = static_cast<uint16_t>(key.state.line_stipple_pattern), |
|
|
|
}; |
|
|
|
@ -773,6 +778,7 @@ void GraphicsPipeline::MakePipeline(VkRenderPass render_pass) { |
|
|
|
} |
|
|
|
|
|
|
|
const bool supports_alpha_output = fragment_has_color0_output; |
|
|
|
const bool alpha_to_one_supported = device.SupportsAlphaToOne(); |
|
|
|
const VkPipelineMultisampleStateCreateInfo multisample_ci{ |
|
|
|
.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO, |
|
|
|
.pNext = nullptr, |
|
|
|
@ -783,8 +789,8 @@ void GraphicsPipeline::MakePipeline(VkRenderPass render_pass) { |
|
|
|
.pSampleMask = nullptr, |
|
|
|
.alphaToCoverageEnable = |
|
|
|
supports_alpha_output && key.state.alpha_to_coverage_enabled != 0 ? VK_TRUE : VK_FALSE, |
|
|
|
.alphaToOneEnable = |
|
|
|
supports_alpha_output && key.state.alpha_to_one_enabled != 0 ? VK_TRUE : VK_FALSE, |
|
|
|
.alphaToOneEnable = supports_alpha_output && alpha_to_one_supported && |
|
|
|
key.state.alpha_to_one_enabled != 0 ? VK_TRUE : VK_FALSE, |
|
|
|
}; |
|
|
|
const VkPipelineDepthStencilStateCreateInfo depth_stencil_ci{ |
|
|
|
.sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO, |
|
|
|
@ -899,18 +905,29 @@ void GraphicsPipeline::MakePipeline(VkRenderPass render_pass) { |
|
|
|
dynamic_states.insert(dynamic_states.end(), extended3.begin(), extended3.end()); |
|
|
|
} |
|
|
|
|
|
|
|
// EDS3 - Enables (composite: 9 states)
|
|
|
|
// EDS3 - Enables (composite: per-feature)
|
|
|
|
if (key.state.extended_dynamic_state_3_enables) { |
|
|
|
static constexpr std::array extended3{ |
|
|
|
VK_DYNAMIC_STATE_DEPTH_CLAMP_ENABLE_EXT, |
|
|
|
VK_DYNAMIC_STATE_LOGIC_OP_ENABLE_EXT, |
|
|
|
VK_DYNAMIC_STATE_LINE_RASTERIZATION_MODE_EXT, |
|
|
|
VK_DYNAMIC_STATE_CONSERVATIVE_RASTERIZATION_MODE_EXT, |
|
|
|
VK_DYNAMIC_STATE_LINE_STIPPLE_ENABLE_EXT, |
|
|
|
VK_DYNAMIC_STATE_ALPHA_TO_COVERAGE_ENABLE_EXT, |
|
|
|
VK_DYNAMIC_STATE_ALPHA_TO_ONE_ENABLE_EXT, |
|
|
|
}; |
|
|
|
dynamic_states.insert(dynamic_states.end(), extended3.begin(), extended3.end()); |
|
|
|
if (device.SupportsDynamicState3DepthClampEnable()) { |
|
|
|
dynamic_states.push_back(VK_DYNAMIC_STATE_DEPTH_CLAMP_ENABLE_EXT); |
|
|
|
} |
|
|
|
if (device.SupportsDynamicState3LogicOpEnable()) { |
|
|
|
dynamic_states.push_back(VK_DYNAMIC_STATE_LOGIC_OP_ENABLE_EXT); |
|
|
|
} |
|
|
|
if (device.SupportsDynamicState3LineRasterizationMode()) { |
|
|
|
dynamic_states.push_back(VK_DYNAMIC_STATE_LINE_RASTERIZATION_MODE_EXT); |
|
|
|
} |
|
|
|
if (device.SupportsDynamicState3ConservativeRasterizationMode()) { |
|
|
|
dynamic_states.push_back(VK_DYNAMIC_STATE_CONSERVATIVE_RASTERIZATION_MODE_EXT); |
|
|
|
} |
|
|
|
if (device.SupportsDynamicState3LineStippleEnable()) { |
|
|
|
dynamic_states.push_back(VK_DYNAMIC_STATE_LINE_STIPPLE_ENABLE_EXT); |
|
|
|
} |
|
|
|
if (device.SupportsDynamicState3AlphaToCoverageEnable()) { |
|
|
|
dynamic_states.push_back(VK_DYNAMIC_STATE_ALPHA_TO_COVERAGE_ENABLE_EXT); |
|
|
|
} |
|
|
|
if (device.SupportsDynamicState3AlphaToOneEnable()) { |
|
|
|
dynamic_states.push_back(VK_DYNAMIC_STATE_ALPHA_TO_ONE_ENABLE_EXT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const VkPipelineDynamicStateCreateInfo dynamic_state_ci{ |
|
|
|
|