From 13ab63bb62b6c47172de06b5d72ae43babd892df Mon Sep 17 00:00:00 2001 From: Bas Nieuwenhuizen Date: Thu, 24 Jan 2019 02:06:27 +0100 Subject: [PATCH] radv: Implement VK_EXT_buffer_device_address. v2: Also update the release notes. Reviewed-by: Samuel Pitoiset --- docs/relnotes/19.1.0.html | 2 +- src/amd/vulkan/radv_device.c | 20 +++++++++++++++++++- src/amd/vulkan/radv_extensions.py | 1 + src/amd/vulkan/radv_shader.c | 2 ++ 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/docs/relnotes/19.1.0.html b/docs/relnotes/19.1.0.html index e6ea7c01fb2..69f8abbf17e 100644 --- a/docs/relnotes/19.1.0.html +++ b/docs/relnotes/19.1.0.html @@ -40,7 +40,7 @@ TBD.

Bug fixes

diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 5202d83a418..0fef92773e1 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -869,6 +869,14 @@ void radv_GetPhysicalDeviceFeatures2( features->memoryPriority = VK_TRUE; break; } + case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_ADDRESS_FEATURES_EXT: { + VkPhysicalDeviceBufferAddressFeaturesEXT *features = + (VkPhysicalDeviceBufferAddressFeaturesEXT *)ext; + features->bufferDeviceAddress = true; + features->bufferDeviceAddressCaptureReplay = false; + features->bufferDeviceAddressMultiDevice = false; + break; + } default: break; } @@ -1694,7 +1702,8 @@ VkResult radv_CreateDevice( * from the descriptor set anymore, so we have to use a global BO list. */ device->use_global_bo_list = - device->enabled_extensions.EXT_descriptor_indexing; + device->enabled_extensions.EXT_descriptor_indexing || + device->enabled_extensions.EXT_buffer_device_address; mtx_init(&device->shader_slab_mutex, mtx_plain); list_inithead(&device->shader_slabs); @@ -4032,6 +4041,15 @@ void radv_DestroyBuffer( vk_free2(&device->alloc, pAllocator, buffer); } +VkDeviceAddress radv_GetBufferDeviceAddressEXT( + VkDevice device, + const VkBufferDeviceAddressInfoEXT* pInfo) +{ + RADV_FROM_HANDLE(radv_buffer, buffer, pInfo->buffer); + return radv_buffer_get_va(buffer->bo) + buffer->offset; +} + + static inline unsigned si_tile_mode_index(const struct radv_image *image, unsigned level, bool stencil) { diff --git a/src/amd/vulkan/radv_extensions.py b/src/amd/vulkan/radv_extensions.py index 1bf56943f25..f218598f123 100644 --- a/src/amd/vulkan/radv_extensions.py +++ b/src/amd/vulkan/radv_extensions.py @@ -93,6 +93,7 @@ EXTENSIONS = [ Extension('VK_KHR_display', 23, 'VK_USE_PLATFORM_DISPLAY_KHR'), Extension('VK_EXT_direct_mode_display', 1, 'VK_USE_PLATFORM_DISPLAY_KHR'), Extension('VK_EXT_acquire_xlib_display', 1, 'VK_USE_PLATFORM_XLIB_XRANDR_EXT'), + Extension('VK_EXT_buffer_device_address', 1, True), Extension('VK_EXT_calibrated_timestamps', 1, True), Extension('VK_EXT_conditional_rendering', 1, True), Extension('VK_EXT_conservative_rasterization', 1, 'device->rad_info.chip_class >= GFX9'), diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c index 9a05b3c2434..1dcb0606246 100644 --- a/src/amd/vulkan/radv_shader.c +++ b/src/amd/vulkan/radv_shader.c @@ -232,6 +232,7 @@ radv_shader_compile_to_nir(struct radv_device *device, .int16 = true, .int64 = true, .multiview = true, + .physical_storage_buffer_address = true, .runtime_descriptor_array = true, .shader_viewport_index_layer = true, .stencil_export = true, @@ -250,6 +251,7 @@ radv_shader_compile_to_nir(struct radv_device *device, }, .ubo_ptr_type = glsl_vector_type(GLSL_TYPE_UINT, 2), .ssbo_ptr_type = glsl_vector_type(GLSL_TYPE_UINT, 2), + .phys_ssbo_ptr_type = glsl_vector_type(GLSL_TYPE_UINT64, 1), .push_const_ptr_type = glsl_uint_type(), .shared_ptr_type = glsl_uint_type(), }; -- 2.30.2