pub fn shader_module(device: &Device, wgsl: &str, label: &str) -> ShaderModuleExpand description
Create a shader module from the crate’s composed WGSL.
In debug builds the module goes through
Device::create_shader_module,
so wgpu’s runtime checks — shader-side bounds checks, loop bounding and
the like — all apply. In release builds it goes through
Device::create_shader_module_trusted
with ShaderRuntimeChecks::unchecked,
which hands the module to the backend
without injecting any of them. The WGSL this helper accepts is composed at
build time from the crate’s own shader package or a caller’s entry module,
never arbitrary user code, so the unchecked contract holds: every loop is
bounded, and every binding stays within the region its bind group
describes.
wgpu’s own validation always runs either way, and on WebGPU the trusted
path simply calls
Device::create_shader_module — the browser keeps
checking its modules.