From 62033e0cb33fde06bb634cd18f02ec22a63cda47 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Mon, 22 Mar 2021 17:55:40 +0100 Subject: [PATCH] radv: determine if attachment VRS is enabled When VRS attachment, any depth buffer can potentially be used for VRS. We also have to create a global depth buffer if the app doesn't provide one. Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhuizen Part-of: --- src/amd/vulkan/radv_device.c | 5 ++++- src/amd/vulkan/radv_private.h | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 02191d22a1f..e51e14a0099 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -2683,6 +2683,7 @@ radv_CreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCr bool overallocation_disallowed = false; bool custom_border_colors = false; bool vrs_enabled = false; + bool attachment_vrs_enabled = false; /* Check enabled features */ if (pCreateInfo->pEnabledFeatures) { @@ -2722,8 +2723,9 @@ radv_CreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCr } case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_FEATURES_KHR: { const VkPhysicalDeviceFragmentShadingRateFeaturesKHR *vrs = (const void *)ext; + attachment_vrs_enabled = vrs->attachmentFragmentShadingRate; vrs_enabled = vrs->pipelineFragmentShadingRate || vrs->primitiveFragmentShadingRate || - vrs->attachmentFragmentShadingRate; + attachment_vrs_enabled; break; } case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_FEATURES_EXT: { @@ -2782,6 +2784,7 @@ radv_CreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCr (device->physical_device->rad_info.family == CHIP_SIENNA_CICHLID || device->physical_device->rad_info.family == CHIP_NAVY_FLOUNDER || device->physical_device->rad_info.family == CHIP_VANGOGH); + device->attachment_vrs_enabled = attachment_vrs_enabled; mtx_init(&device->shader_slab_mutex, mtx_plain); list_inithead(&device->shader_slabs); diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h index 72f8601800a..3bb1bbc8752 100644 --- a/src/amd/vulkan/radv_private.h +++ b/src/amd/vulkan/radv_private.h @@ -805,6 +805,9 @@ struct radv_device { /* Whether the driver uses a global BO list. */ bool use_global_bo_list; + /* Whether attachment VRS is enabled. */ + bool attachment_vrs_enabled; + /* Whether anisotropy is forced with RADV_TEX_ANISO (-1 is disabled). */ int force_aniso;