@@ -4,18 +4,9 @@ use std::fmt;
44/// often necessary to specify which one applies. `Universal_*` implies an
55/// environment-agnostic SPIR-V.
66///
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.
1910#[ derive( Copy , Clone , Debug , PartialEq ) ]
2011#[ repr( C ) ]
2112#[ allow( non_camel_case_types, clippy:: upper_case_acronyms) ]
@@ -58,8 +49,8 @@ pub enum TargetEnv {
5849 Universal_1_3 ,
5950 /// Vulkan 1.1 latest revision.
6051 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 ,
6354 /// SPIR-V 1.4 latest revision, no other restrictions.
6455 Universal_1_4 ,
6556 /// Vulkan 1.1 with `VK_KHR_spirv_1_4`, i.e. SPIR-V 1.4 binary.
@@ -109,11 +100,12 @@ impl TargetEnv {
109100
110101 TargetEnv :: Vulkan_1_0 => ( 1 , 0 ) ,
111102 TargetEnv :: Vulkan_1_1 => ( 1 , 3 ) ,
112- TargetEnv :: WebGPU_0 => ( 1 , 3 ) ,
113103 TargetEnv :: Vulkan_1_1_Spirv_1_4 => ( 1 , 4 ) ,
114104 TargetEnv :: Vulkan_1_2 => ( 1 , 5 ) ,
115105 TargetEnv :: Vulkan_1_3 => ( 1 , 6 ) ,
116106 TargetEnv :: Vulkan_1_4 => ( 1 , 6 ) ,
107+
108+ TargetEnv :: WebGPU_0_DEPRECATED => ( 1 , 3 ) ,
117109 }
118110 }
119111}
@@ -156,7 +148,7 @@ impl std::str::FromStr for TargetEnv {
156148 "opengl4.2" => Self :: OpenGL_4_2 ,
157149 "opengl4.3" => Self :: OpenGL_4_3 ,
158150 "opengl4.5" => Self :: OpenGL_4_5 ,
159- "webgpu0 " => Self :: WebGPU_0 ,
151+ "webgpu0_DEPRECATED " => Self :: WebGPU_0_DEPRECATED ,
160152 _ => return Err ( SpirvResult :: InvalidValue ) ,
161153 } )
162154 }
@@ -191,7 +183,7 @@ impl fmt::Display for TargetEnv {
191183 Self :: OpenGL_4_2 => "opengl4.2" ,
192184 Self :: OpenGL_4_3 => "opengl4.3" ,
193185 Self :: OpenGL_4_5 => "opengl4.5" ,
194- Self :: WebGPU_0 => "webgpu0 " ,
186+ Self :: WebGPU_0_DEPRECATED => "webgpu0_DEPRECATED " ,
195187 } )
196188 }
197189}
0 commit comments