From 86a7b5e2769f0b0d81eec9b38e91394d27ea4997 Mon Sep 17 00:00:00 2001 From: Hans-Kristian Arntzen Date: Tue, 22 Feb 2022 11:42:54 +0100 Subject: [PATCH] radv: Implement VK_VALVE_descriptor_set_host_mapping. Reviewed-by: Samuel Pitoiset Part-of: --- src/amd/vulkan/radv_descriptor_set.c | 23 +++++++++++++++++++++++ src/amd/vulkan/radv_device.c | 10 +++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/amd/vulkan/radv_descriptor_set.c b/src/amd/vulkan/radv_descriptor_set.c index a87dd93..ecf0bb3 100644 --- a/src/amd/vulkan/radv_descriptor_set.c +++ b/src/amd/vulkan/radv_descriptor_set.c @@ -1552,6 +1552,29 @@ radv_UpdateDescriptorSetWithTemplate(VkDevice _device, VkDescriptorSet descripto radv_update_descriptor_set_with_template_impl(device, NULL, set, descriptorUpdateTemplate, pData); } +VKAPI_ATTR void VKAPI_CALL +radv_GetDescriptorSetLayoutHostMappingInfoVALVE( + VkDevice _device, const VkDescriptorSetBindingReferenceVALVE *pBindingReference, + VkDescriptorSetLayoutHostMappingInfoVALVE *pHostMapping) +{ + struct radv_descriptor_set_layout *set_layout = + radv_descriptor_set_layout_from_handle(pBindingReference->descriptorSetLayout); + + const struct radv_descriptor_set_binding_layout *binding_layout = + set_layout->binding + pBindingReference->binding; + + pHostMapping->descriptorOffset = binding_layout->offset; + pHostMapping->descriptorSize = binding_layout->size; +} + +VKAPI_ATTR void VKAPI_CALL +radv_GetDescriptorSetHostMappingVALVE(VkDevice _device, VkDescriptorSet descriptorSet, + void **ppData) +{ + RADV_FROM_HANDLE(radv_descriptor_set, set, descriptorSet); + *ppData = set->header.mapped_ptr; +} + VKAPI_ATTR VkResult VKAPI_CALL radv_CreateSamplerYcbcrConversion(VkDevice _device, const VkSamplerYcbcrConversionCreateInfo *pCreateInfo, diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 672cb70..b164bbc 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -557,6 +557,7 @@ radv_physical_device_get_supported_extensions(const struct radv_physical_device .NV_compute_shader_derivatives = true, .NV_mesh_shader = device->use_ngg && device->rad_info.chip_class >= GFX10_3 && device->instance->perftest_flags & RADV_PERFTEST_NV_MS && !device->use_llvm, + .VALVE_descriptor_set_host_mapping = true, .VALVE_mutable_descriptor_type = true, }; } @@ -1700,6 +1701,12 @@ radv_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice, features->textureCompressionASTC_HDR = false; break; } + case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_SET_HOST_MAPPING_FEATURES_VALVE: { + VkPhysicalDeviceDescriptorSetHostMappingFeaturesVALVE *features = + (VkPhysicalDeviceDescriptorSetHostMappingFeaturesVALVE *)ext; + features->descriptorSetHostMapping = true; + break; + } default: break; } @@ -3228,7 +3235,8 @@ radv_CreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCr device->vk.enabled_extensions.EXT_buffer_device_address || device->vk.enabled_extensions.KHR_buffer_device_address || device->vk.enabled_extensions.KHR_ray_tracing_pipeline || - device->vk.enabled_extensions.KHR_acceleration_structure; + device->vk.enabled_extensions.KHR_acceleration_structure || + device->vk.enabled_extensions.VALVE_descriptor_set_host_mapping; device->robust_buffer_access = robust_buffer_access || robust_buffer_access2; device->robust_buffer_access2 = robust_buffer_access2; -- 2.7.4