Mesa (main): v3dv: expose KHR_variable_pointers

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jun 10 06:03:57 UTC 2021


Module: Mesa
Branch: main
Commit: d84cd611eb0cd9b07f73d481f7af12deb9b3fdcf
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d84cd611eb0cd9b07f73d481f7af12deb9b3fdcf

Author: Iago Toral Quiroga <itoral at igalia.com>
Date:   Tue Jun  8 11:05:36 2021 +0200

v3dv: expose KHR_variable_pointers

We only support the VariablePointersStorageBuffer feature for now,
which is the only one that is mandatory, and for which we seem to
be passing all the relevant tests already.

Exposing the optional VariablePointers feature would require that
we support non-constant indexing on UBO/SSBO first.

Relevant CTS tests:
dEQP-VK.*pointer*

Reviewed-by: Alejandro Piñeiro <apinheiro at igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11257>

---

 docs/features.txt                   |  2 +-
 src/broadcom/vulkan/v3dv_device.c   | 11 ++++++++++-
 src/broadcom/vulkan/v3dv_pipeline.c |  1 +
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/docs/features.txt b/docs/features.txt
index 74980b01cf8..f6591bd4c84 100644
--- a/docs/features.txt
+++ b/docs/features.txt
@@ -443,7 +443,7 @@ Vulkan 1.1 -- all DONE: anv, lvp, radv, tu, vn
   VK_KHR_sampler_ycbcr_conversion                       DONE (anv, radv, tu, vn)
   VK_KHR_shader_draw_parameters                         DONE (anv, lvp, radv, tu, vn)
   VK_KHR_storage_buffer_storage_class                   DONE (anv, lvp, radv, tu, v3dv, vn)
-  VK_KHR_variable_pointers                              DONE (anv, lvp, radv, tu, vn)
+  VK_KHR_variable_pointers                              DONE (anv, lvp, radv, tu, v3dv, vn)
 
 Vulkan 1.2 -- all DONE: anv, vn
 
diff --git a/src/broadcom/vulkan/v3dv_device.c b/src/broadcom/vulkan/v3dv_device.c
index 551302bccb3..2ff1ea3dd4d 100644
--- a/src/broadcom/vulkan/v3dv_device.c
+++ b/src/broadcom/vulkan/v3dv_device.c
@@ -125,6 +125,7 @@ get_device_extensions(const struct v3dv_physical_device *device,
 #ifdef V3DV_HAS_SURFACE
       .KHR_swapchain                       = true,
 #endif
+      .KHR_variable_pointers               = true,
       .EXT_external_memory_dma_buf         = true,
       .EXT_private_data                    = true,
    };
@@ -1012,7 +1013,15 @@ v3dv_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice,
          features->privateData = true;
          break;
       }
-
+      case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES: {
+         VkPhysicalDeviceVariablePointersFeatures *features = (void *) ext;
+         features->variablePointersStorageBuffer = true;
+         /* FIXME: for this we need to support non-constant indexing on
+          * UBO/SSBO.
+          */
+         features->variablePointers = false;
+         break;
+      }
       default:
          v3dv_debug_ignored_stype(ext->sType);
          break;
diff --git a/src/broadcom/vulkan/v3dv_pipeline.c b/src/broadcom/vulkan/v3dv_pipeline.c
index 99d7779038b..813f715b8d2 100644
--- a/src/broadcom/vulkan/v3dv_pipeline.c
+++ b/src/broadcom/vulkan/v3dv_pipeline.c
@@ -174,6 +174,7 @@ v3dv_DestroyPipeline(VkDevice _device,
 static const struct spirv_to_nir_options default_spirv_options =  {
    .caps = {
       .device_group = true,
+      .variable_pointers = true,
     },
    .ubo_addr_format = nir_address_format_32bit_index_offset,
    .ssbo_addr_format = nir_address_format_32bit_index_offset,



More information about the mesa-commit mailing list