pub struct ShaderRuntimeChecks {
    pub bounds_checks: bool,
    pub force_loop_bounding: bool,
}
Expand description

Describes how shader bound checks should be performed.

Fields§

§bounds_checks: bool

Enforce bounds checks in shaders, even if the underlying driver doesn’t support doing so natively.

When this is true, wgpu promises that shaders can only read or write the accessible region of a bindgroup’s buffer bindings. If the underlying graphics platform cannot implement these bounds checks itself, wgpu will inject bounds checks before presenting the shader to the platform.

When this is false, wgpu only enforces such bounds checks if the underlying platform provides a way to do so itself. wgpu does not itself add any bounds checks to generated shader code.

Note that wgpu users may try to initialize only those portions of buffers that they anticipate might be read from. Passing false here may allow shaders to see wider regions of the buffers than expected, making such deferred initialization visible to the application.

§force_loop_bounding: bool

If false, the caller MUST ensure that all passed shaders do not contain any infinite loops.

If it does, backend compilers MAY treat such a loop as unreachable code and draw conclusions about other safety-critical code paths. This option SHOULD NOT be disabled when running untrusted code.

Implementations§

source§

impl ShaderRuntimeChecks

source

pub fn checked() -> Self

Creates a new configuration where the shader is fully checked.

source

pub fn unchecked() -> Self

Creates a new configuration where none of the checks are performed.

Safety

See the documentation for the set_* methods for the safety requirements of each sub-configuration.

source

pub unsafe fn all(all_checks: bool) -> Self

Creates a new configuration where all checks are enabled or disabled. To safely create a configuration with all checks enabled, use ShaderRuntimeChecks::checked.

Safety

See the documentation for the set_* methods for the safety requirements of each sub-configuration.

Trait Implementations§

source§

impl Clone for ShaderRuntimeChecks

source§

fn clone(&self) -> ShaderRuntimeChecks

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for ShaderRuntimeChecks

source§

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

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

impl Default for ShaderRuntimeChecks

source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for ShaderRuntimeChecks

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Serialize for ShaderRuntimeChecks

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Copy for ShaderRuntimeChecks

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> 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,

§

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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

source§

impl<T> WasmNotSend for T
where T: Send,

source§

impl<T> WasmNotSendSync for T

source§

impl<T> WasmNotSync for T
where T: Sync,