mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
Vulkan: Add support for unrestricted depth range.
This commit is contained in:
@ -368,12 +368,19 @@ std::unique_ptr<VKPipeline> VKPipeline::Create(const AbstractPipelineConfig& con
|
||||
GetVulkanColorBlendState(config.blending_state, blend_attachment_states.data(),
|
||||
static_cast<uint32_t>(blend_attachment_states.size()));
|
||||
|
||||
static const VkDepthClampRangeEXT clamp_range = {0.0f, MAX_EFB_DEPTH};
|
||||
static const VkPipelineViewportDepthClampControlCreateInfoEXT depth_clamp_state = {
|
||||
VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_DEPTH_CLAMP_CONTROL_CREATE_INFO_EXT, nullptr,
|
||||
VK_DEPTH_CLAMP_MODE_USER_DEFINED_RANGE_EXT, // VkDepthClampModeEXT depthClampMode
|
||||
&clamp_range // const VkDepthClampRangeEXT* pDepthClampRange
|
||||
};
|
||||
|
||||
// This viewport isn't used, but needs to be specified anyway.
|
||||
static const VkViewport viewport = {0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f};
|
||||
static const VkRect2D scissor = {{0, 0}, {1, 1}};
|
||||
static const VkPipelineViewportStateCreateInfo viewport_state = {
|
||||
VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO,
|
||||
nullptr,
|
||||
&depth_clamp_state,
|
||||
0, // VkPipelineViewportStateCreateFlags flags;
|
||||
1, // uint32_t viewportCount
|
||||
&viewport, // const VkViewport* pViewports
|
||||
|
@ -459,6 +459,7 @@ void VulkanContext::PopulateBackendInfo(BackendInfo* backend_info)
|
||||
backend_info->bSupportsDynamicVertexLoader = true; // Assumed support.
|
||||
backend_info->bSupportsVSLinePointExpand = true; // Assumed support.
|
||||
backend_info->bSupportsHDROutput = true; // Assumed support.
|
||||
backend_info->bSupportsUnrestrictedDepthRange = false; // Dependent on features.
|
||||
}
|
||||
|
||||
void VulkanContext::PopulateBackendInfoAdapters(BackendInfo* backend_info, const GPUList& gpu_list)
|
||||
@ -663,6 +664,16 @@ bool VulkanContext::SelectDeviceExtensions(bool enable_surface)
|
||||
AddExtension(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME, false);
|
||||
AddExtension(VK_EXT_MEMORY_BUDGET_EXTENSION_NAME, false);
|
||||
|
||||
if (!DriverDetails::HasBug(DriverDetails::BUG_BROKEN_D32F_CLEAR))
|
||||
{
|
||||
// Unrestricted depth range is one of the few extensions that changes the behavior
|
||||
// of Vulkan just by being enabled, so we rely on lazy evaluation to ensure it is
|
||||
// not enabled unless depth clamp control is supported.
|
||||
g_backend_info.bSupportsUnrestrictedDepthRange =
|
||||
AddExtension(VK_EXT_DEPTH_CLAMP_CONTROL_EXTENSION_NAME, false) &&
|
||||
AddExtension(VK_EXT_DEPTH_RANGE_UNRESTRICTED_EXTENSION_NAME, false);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user