Name Description Size
keywords.rs 7299
mod.rs ! Backend for [MSL][msl] (Metal Shading Language). This backend does not support the [`SHADER_INT64_ATOMIC_ALL_OPS`][all-atom] capability. ## Binding model Metal's bindings are flat per resource. Since there isn't an obvious mapping from SPIR-V's descriptor sets, we require a separate mapping provided in the options. This mapping may have one or more resource end points for each descriptor set + index pair. ## Entry points Even though MSL and our IR appear to be similar in that the entry points in both can accept arguments and return values, the restrictions are different. MSL allows the varyings to be either in separate arguments, or inside a single `[[stage_in]]` struct. We gather input varyings and form this artificial structure. We also add all the (non-Private) globals into the arguments. At the beginning of the entry point, we assign the local constants and re-compose the arguments as they are declared on IR side, so that the rest of the logic can pretend that MSL doesn't have all the restrictions it has. For the result type, if it's a structure, we re-compose it with a temporary value holding the result. [msl]: https://developer.apple.com/metal/Metal-Shading-Language-Specification.pdf [all-atom]: crate::valid::Capabilities::SHADER_INT64_ATOMIC_ALL_OPS ## Pointer-typed bounds-checked expressions and OOB locals MSL (unlike HLSL and GLSL) has native support for pointer-typed function arguments. When the [`BoundsCheckPolicy`] is `ReadZeroSkipWrite` and an out-of-bounds index expression is used for such an argument, our strategy is to pass a pointer to a dummy variable. These dummy variables are called "OOB locals". We emit at most one OOB local per function for each type, since all expressions producing a result of that type can share the same OOB local. (Note that the OOB local mechanism is not actually implementing "skip write", nor even "read zero" in some cases of read-after-write, but doing so would require additional effort and the difference is unlikely to matter.) [`BoundsCheckPolicy`]: crate::proc::BoundsCheckPolicy 29442
sampler.rs 4383
writer.rs 307214