Struct wgpu_types::ShaderRuntimeChecks
source · 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
impl ShaderRuntimeChecks
sourcepub fn unchecked() -> Self
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.
sourcepub unsafe fn all(all_checks: bool) -> Self
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
impl Clone for ShaderRuntimeChecks
source§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 moresource§impl Debug for ShaderRuntimeChecks
impl Debug for ShaderRuntimeChecks
source§impl Default for ShaderRuntimeChecks
impl Default for ShaderRuntimeChecks
source§impl<'de> Deserialize<'de> for ShaderRuntimeChecks
impl<'de> Deserialize<'de> for ShaderRuntimeChecks
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl Serialize for ShaderRuntimeChecks
impl Serialize for 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,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)