Struct ShaderRuntimeChecks
pub struct ShaderRuntimeChecks {
pub bounds_checks: bool,
pub force_loop_bounding: bool,
}
unstable-wgpu-24
only.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§
§impl ShaderRuntimeChecks
impl ShaderRuntimeChecks
pub fn checked() -> ShaderRuntimeChecks
pub fn checked() -> ShaderRuntimeChecks
Creates a new configuration where the shader is fully checked.
pub fn unchecked() -> ShaderRuntimeChecks
pub fn unchecked() -> ShaderRuntimeChecks
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.
pub unsafe fn all(all_checks: bool) -> ShaderRuntimeChecks
pub unsafe fn all(all_checks: bool) -> ShaderRuntimeChecks
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§
§impl Clone for ShaderRuntimeChecks
impl Clone for ShaderRuntimeChecks
§fn clone(&self) -> ShaderRuntimeChecks
fn clone(&self) -> ShaderRuntimeChecks
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl Debug for ShaderRuntimeChecks
impl Debug for ShaderRuntimeChecks
§impl Default for ShaderRuntimeChecks
impl Default for ShaderRuntimeChecks
§fn default() -> ShaderRuntimeChecks
fn default() -> ShaderRuntimeChecks
impl Copy for ShaderRuntimeChecks
Auto Trait Implementations§
impl Freeze for ShaderRuntimeChecks
impl RefUnwindSafe for ShaderRuntimeChecks
impl Send for ShaderRuntimeChecks
impl Sync for ShaderRuntimeChecks
impl Unpin for ShaderRuntimeChecks
impl UnwindSafe for ShaderRuntimeChecks
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere
T: Default,
type NoneType = T
§fn null_value() -> T
fn null_value() -> T
§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian()
.