summarylogtreecommitdiffstats
path: root/0001-spirv-radv-anv-implement-no-op-VK_GOOGLE_user_type.patch
blob: 19b789e6d8b35096e2f6c75e411f51fe1fca4e31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
From 50344bbb381511924b4d89877f9efada466304ba Mon Sep 17 00:00:00 2001
From: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Date: Thu, 28 May 2020 10:21:27 +0200
Subject: [PATCH 1/1] spirv,radv,anv: implement no-op VK_GOOGLE_user_type

[ Rebased for mesa-aco repository ]

This extension only allows HLSL shader compilers to optionally embed
unambiguous type information which can be safely ignored by the driver.

This fixes a crash with the recent Vulkan backend of Path Of Exile
(it uses the extension without checking if it's supported).

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Tested-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5237>
---
 docs/relnotes/new_features.txt     | 1 +
 src/amd/vulkan/radv_extensions.py  | 1 +
 src/compiler/spirv/spirv_to_nir.c  | 5 +++++
 src/compiler/spirv/vtn_variables.c | 1 +
 src/intel/vulkan/anv_extensions.py | 1 +
 5 files changed, 9 insertions(+)

diff --git a/docs/relnotes/new_features.txt b/docs/relnotes/new_features.txt
index c2b424dec52..5352bbe4ba6 100644
--- a/docs/relnotes/new_features.txt
+++ b/docs/relnotes/new_features.txt
@@ -15,3 +15,4 @@ shaderInt16 for ACO on GFX9+
 VK_KHR_shader_float16_int8 for ACO on GFX8+ (shaderFloat16 is still unsupported)
 VK_EXT_robustness2 on Intel, RADV.
 Add Rocket Lake (RKL) support on anvil and iris.
+VK_GOOGLE_user_type on ANV and RADV.
diff --git a/src/amd/vulkan/radv_extensions.py b/src/amd/vulkan/radv_extensions.py
index 4ea75a10d57..f1feb810bb4 100644
--- a/src/amd/vulkan/radv_extensions.py
+++ b/src/amd/vulkan/radv_extensions.py
@@ -172,6 +172,7 @@ EXTENSIONS = [
     Extension('VK_AMD_shader_trinary_minmax',             1, True),
     Extension('VK_GOOGLE_decorate_string',                1, True),
     Extension('VK_GOOGLE_hlsl_functionality1',            1, True),
+    Extension('VK_GOOGLE_user_type',                      1, True),
     Extension('VK_NV_compute_shader_derivatives',         1, True),
 ]
 
diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
index 2ea51707734..e6f49ed87a8 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -859,6 +859,7 @@ struct_member_decoration_cb(struct vtn_builder *b,
       break;
 
    case SpvDecorationUserSemantic:
+   case SpvDecorationUserTypeGOOGLE:
       /* User semantic decorations can safely be ignored by the driver. */
       break;
 
@@ -1040,6 +1041,10 @@ type_decoration_cb(struct vtn_builder *b,
                spirv_decoration_to_string(dec->decoration));
       break;
 
+   case SpvDecorationUserTypeGOOGLE:
+      /* User semantic decorations can safely be ignored by the driver. */
+      break;
+
    default:
       vtn_fail_with_decoration("Unhandled decoration", dec->decoration);
    }
diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c
index 9a6ddc2db1e..00743d6552c 100644
--- a/src/compiler/spirv/vtn_variables.c
+++ b/src/compiler/spirv/vtn_variables.c
@@ -1652,6 +1652,7 @@ apply_var_decoration(struct vtn_builder *b,
       break;
 
    case SpvDecorationUserSemantic:
+   case SpvDecorationUserTypeGOOGLE:
       /* User semantic decorations can safely be ignored by the driver. */
       break;
 
diff --git a/src/intel/vulkan/anv_extensions.py b/src/intel/vulkan/anv_extensions.py
index 4760b984d35..b88f01088b8 100644
--- a/src/intel/vulkan/anv_extensions.py
+++ b/src/intel/vulkan/anv_extensions.py
@@ -173,6 +173,7 @@ EXTENSIONS = [
     Extension('VK_ANDROID_native_buffer',                 7, 'ANDROID'),
     Extension('VK_GOOGLE_decorate_string',                1, True),
     Extension('VK_GOOGLE_hlsl_functionality1',            1, True),
+    Extension('VK_GOOGLE_user_type',                      1, True),
     Extension('VK_INTEL_performance_query',               1, 'device->perf && device->perf->i915_perf_version >= 3'),
     Extension('VK_INTEL_shader_integer_functions2',       1, 'device->info.gen >= 8'),
     Extension('VK_NV_compute_shader_derivatives',         1, True),
-- 
2.26.2