@@ -4,18 +4,9 @@ use std::fmt;
4
4
/// often necessary to specify which one applies. `Universal_*` implies an
5
5
/// environment-agnostic SPIR-V.
6
6
///
7
- /// When an API method needs to derive a SPIR-V version from a target environment
8
- /// the method will choose the highest version of SPIR-V supported by the target
9
- /// environment. Examples:
10
- ///
11
- /// ```text
12
- /// SPV_ENV_VULKAN_1_0 -> SPIR-V 1.0
13
- /// SPV_ENV_VULKAN_1_1 -> SPIR-V 1.3
14
- /// SPV_ENV_VULKAN_1_1_SPIRV_1_4 -> SPIR-V 1.4
15
- /// SPV_ENV_VULKAN_1_2 -> SPIR-V 1.5
16
- /// ```
17
- ///
18
- /// Consult the description of API entry points for specific rules.
7
+ /// This enum MUST be kept in sync with the `typedef enum spv_target_env` in
8
+ /// `spirv-tools-sys/spirv-tools/include/spirv-tools/libspirv.h`, it is being
9
+ /// sent across the ffi boundary.
19
10
#[ derive( Copy , Clone , Debug , PartialEq ) ]
20
11
#[ repr( C ) ]
21
12
#[ allow( non_camel_case_types, clippy:: upper_case_acronyms) ]
@@ -58,8 +49,8 @@ pub enum TargetEnv {
58
49
Universal_1_3 ,
59
50
/// Vulkan 1.1 latest revision.
60
51
Vulkan_1_1 ,
61
- /// Work in progress WebGPU 1.0 .
62
- WebGPU_0 ,
52
+ /// DEPRECATED, may be removed in the future .
53
+ WebGPU_0_DEPRECATED ,
63
54
/// SPIR-V 1.4 latest revision, no other restrictions.
64
55
Universal_1_4 ,
65
56
/// Vulkan 1.1 with `VK_KHR_spirv_1_4`, i.e. SPIR-V 1.4 binary.
@@ -109,11 +100,12 @@ impl TargetEnv {
109
100
110
101
TargetEnv :: Vulkan_1_0 => ( 1 , 0 ) ,
111
102
TargetEnv :: Vulkan_1_1 => ( 1 , 3 ) ,
112
- TargetEnv :: WebGPU_0 => ( 1 , 3 ) ,
113
103
TargetEnv :: Vulkan_1_1_Spirv_1_4 => ( 1 , 4 ) ,
114
104
TargetEnv :: Vulkan_1_2 => ( 1 , 5 ) ,
115
105
TargetEnv :: Vulkan_1_3 => ( 1 , 6 ) ,
116
106
TargetEnv :: Vulkan_1_4 => ( 1 , 6 ) ,
107
+
108
+ TargetEnv :: WebGPU_0_DEPRECATED => ( 1 , 3 ) ,
117
109
}
118
110
}
119
111
}
@@ -156,7 +148,7 @@ impl std::str::FromStr for TargetEnv {
156
148
"opengl4.2" => Self :: OpenGL_4_2 ,
157
149
"opengl4.3" => Self :: OpenGL_4_3 ,
158
150
"opengl4.5" => Self :: OpenGL_4_5 ,
159
- "webgpu0 " => Self :: WebGPU_0 ,
151
+ "webgpu0_DEPRECATED " => Self :: WebGPU_0_DEPRECATED ,
160
152
_ => return Err ( SpirvResult :: InvalidValue ) ,
161
153
} )
162
154
}
@@ -191,7 +183,7 @@ impl fmt::Display for TargetEnv {
191
183
Self :: OpenGL_4_2 => "opengl4.2" ,
192
184
Self :: OpenGL_4_3 => "opengl4.3" ,
193
185
Self :: OpenGL_4_5 => "opengl4.5" ,
194
- Self :: WebGPU_0 => "webgpu0 " ,
186
+ Self :: WebGPU_0_DEPRECATED => "webgpu0_DEPRECATED " ,
195
187
} )
196
188
}
197
189
}
0 commit comments