Skip to main content

TargetEnv

Enum TargetEnv 

Source
#[repr(C)]
pub enum TargetEnv {
Show 27 variants Universal_1_0 = 0, Vulkan_1_0 = 1, Universal_1_1 = 2, OpenCL_2_1 = 3, OpenCL_2_2 = 4, OpenGL_4_0 = 5, OpenGL_4_1 = 6, OpenGL_4_2 = 7, OpenGL_4_3 = 8, OpenGL_4_5 = 9, Universal_1_2 = 10, OpenCL_1_2 = 11, OpenCLEmbedded_1_2 = 12, OpenCL_2_0 = 13, OpenCLEmbedded_2_0 = 14, OpenCLEmbedded_2_1 = 15, OpenCLEmbedded_2_2 = 16, Universal_1_3 = 17, Vulkan_1_1 = 18, WebGPU_0_DEPRECATED = 19, Universal_1_4 = 20, Vulkan_1_1_Spirv_1_4 = 21, Universal_1_5 = 22, Vulkan_1_2 = 23, Universal_1_6 = 24, Vulkan_1_3 = 25, Vulkan_1_4 = 26,
}
Expand description

Certain target environments impose additional restrictions on SPIR-V, so it’s often necessary to specify which one applies. Universal_* implies an environment-agnostic SPIR-V.

This enum MUST be kept in sync with the typedef enum spv_target_env in spirv-tools-sys/spirv-tools/include/spirv-tools/libspirv.h, it is being sent across the ffi boundary.

Variants§

§

Universal_1_0 = 0

SPIR-V 1.0 latest revision, no other restrictions.

§

Vulkan_1_0 = 1

Vulkan 1.0 latest revision.

§

Universal_1_1 = 2

SPIR-V 1.1 latest revision, no other restrictions.

§

OpenCL_2_1 = 3

OpenCL Full Profile 2.1 latest revision.

§

OpenCL_2_2 = 4

OpenCL Full Profile 2.2 latest revision.

§

OpenGL_4_0 = 5

OpenGL 4.0 plus GL_ARB_gl_spirv, latest revisions.

§

OpenGL_4_1 = 6

OpenGL 4.1 plus GL_ARB_gl_spirv, latest revisions.

§

OpenGL_4_2 = 7

OpenGL 4.2 plus GL_ARB_gl_spirv, latest revisions.

§

OpenGL_4_3 = 8

OpenGL 4.3 plus GL_ARB_gl_spirv, latest revisions.

§

OpenGL_4_5 = 9

OpenGL 4.5 plus GL_ARB_gl_spirv, latest revisions.

§

Universal_1_2 = 10

SPIR-V 1.2, latest revision, no other restrictions.

§

OpenCL_1_2 = 11

OpenCL Full Profile 1.2 plus cl_khr_il_program, latest revision.

§

OpenCLEmbedded_1_2 = 12

OpenCL Embedded Profile 1.2 plus cl_khr_il_program, latest revision.

§

OpenCL_2_0 = 13

OpenCL Full Profile 2.0 plus cl_khr_il_program, latest revision.

§

OpenCLEmbedded_2_0 = 14

OpenCL Embedded Profile 2.0 plus cl_khr_il_program, latest revision.

§

OpenCLEmbedded_2_1 = 15

OpenCL Embedded Profile 2.1 latest revision.

§

OpenCLEmbedded_2_2 = 16

OpenCL Embedded Profile 2.2 latest revision.

§

Universal_1_3 = 17

SPIR-V 1.3 latest revision, no other restrictions.

§

Vulkan_1_1 = 18

Vulkan 1.1 latest revision.

§

WebGPU_0_DEPRECATED = 19

DEPRECATED, may be removed in the future.

§

Universal_1_4 = 20

SPIR-V 1.4 latest revision, no other restrictions.

§

Vulkan_1_1_Spirv_1_4 = 21

Vulkan 1.1 with VK_KHR_spirv_1_4, i.e. SPIR-V 1.4 binary.

§

Universal_1_5 = 22

SPIR-V 1.5 latest revision, no other restrictions.

§

Vulkan_1_2 = 23

Vulkan 1.2 latest revision.

§

Universal_1_6 = 24

SPIR-V 1.6 latest revision, no other restrictions.

§

Vulkan_1_3 = 25

Vulkan 1.3 latest revision.

§

Vulkan_1_4 = 26

Vulkan 1.4 latest revision.

Implementations§

Source§

impl TargetEnv

Source

pub fn spirv_version(&self) -> (u8, u8)

Returns the (mayor, minor) version of spv this enum variant must at least support

The spirv versions for vulkan targets have been pulled from the source of the vulkan spec: https://github.com/KhronosGroup/Vulkan-Docs/blob/main/appendices/spirvenv.adoc?plain=1#L21

Trait Implementations§

Source§

impl Clone for TargetEnv

Source§

fn clone(&self) -> TargetEnv

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for TargetEnv

Source§

impl Debug for TargetEnv

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TargetEnv

Source§

fn default() -> TargetEnv

Returns the “default value” for a type. Read more
Source§

impl Display for TargetEnv

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl FromStr for TargetEnv

Source§

type Err = SpirvResult

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl PartialEq for TargetEnv

Source§

fn eq(&self, other: &TargetEnv) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for TargetEnv

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.