Mesa (staging/21.0): spirv: fixup pointer_to/from_ssa with acceleration structures

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Apr 22 20:16:10 UTC 2021


Module: Mesa
Branch: staging/21.0
Commit: 371bc90cf70b346a4d482237f87789485e6bd56f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=371bc90cf70b346a4d482237f87789485e6bd56f

Author: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Date:   Tue Apr 20 21:46:53 2021 +0300

spirv: fixup pointer_to/from_ssa with acceleration structures

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Fixes: ed907e5d84cba4 ("spirv: Add support for OpTypeAccelerationStructureKHR")
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10357>
(cherry picked from commit 0bb29c07a4fd262db891005897b0662720ddbccf)

---

 .pick_status.json                  |  2 +-
 src/compiler/spirv/vtn_variables.c | 15 +++++++++------
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index d27f9abddfa..861b1e3f41a 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -328,7 +328,7 @@
         "description": "spirv: fixup pointer_to/from_ssa with acceleration structures",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "ed907e5d84cba4632320bad4dfc35462ca0dd927"
     },
diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c
index 9f216158943..c3b92907b58 100644
--- a/src/compiler/spirv/vtn_variables.c
+++ b/src/compiler/spirv/vtn_variables.c
@@ -1589,9 +1589,10 @@ vtn_mode_to_address_format(struct vtn_builder *b, enum vtn_variable_mode mode)
 nir_ssa_def *
 vtn_pointer_to_ssa(struct vtn_builder *b, struct vtn_pointer *ptr)
 {
-   if (vtn_pointer_is_external_block(b, ptr) &&
-       vtn_type_contains_block(b, ptr->type) &&
-       ptr->mode != vtn_variable_mode_phys_ssbo) {
+   if ((vtn_pointer_is_external_block(b, ptr) &&
+        vtn_type_contains_block(b, ptr->type) &&
+        ptr->mode != vtn_variable_mode_phys_ssbo) ||
+       ptr->mode == vtn_variable_mode_accel_struct) {
       /* In this case, we're looking for a block index and not an actual
        * deref.
        *
@@ -1640,11 +1641,13 @@ vtn_pointer_from_ssa(struct vtn_builder *b, nir_ssa_def *ssa,
 
    const struct glsl_type *deref_type =
       vtn_type_get_nir_type(b, ptr_type->deref, ptr->mode);
-   if (!vtn_pointer_is_external_block(b, ptr)) {
+   if (!vtn_pointer_is_external_block(b, ptr) &&
+       ptr->mode != vtn_variable_mode_accel_struct) {
       ptr->deref = nir_build_deref_cast(&b->nb, ssa, nir_mode,
                                         deref_type, ptr_type->stride);
-   } else if (vtn_type_contains_block(b, ptr->type) &&
-              ptr->mode != vtn_variable_mode_phys_ssbo) {
+   } else if ((vtn_type_contains_block(b, ptr->type) &&
+               ptr->mode != vtn_variable_mode_phys_ssbo) ||
+              ptr->mode == vtn_variable_mode_accel_struct) {
       /* This is a pointer to somewhere in an array of blocks, not a
        * pointer to somewhere inside the block.  Set the block index
        * instead of making a cast.



More information about the mesa-commit mailing list