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 more