You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 31, 2025. It is now read-only.
A lot of image operations (mainly those around sampling, or getting/setting texels from images) support additional optional operands. At the SPIR-V level this comes in the form of an operand at the end of each instruction which is a 8 bit integer that acts as a bit mask for indicating the how many operands follow and what they are used for. Additionally certain operands can only be used with certain image parameters, (such as the Bias operand only being available for single sampled 1D, 2D, 3D, and Cube image.)
The question becomes how to best support using these operands at the Rust level and validate these constraints.
Possibilities
Have a different function for each operand.
Advantage Simplest to implement.
Drawback Requires dozens if not hundreds of functions to cover every possible combination for each instruction, leading to a lot of repetition.
Use const generics on the functions for each instruction.
Advantage Potential to avoid a lot of repetition
Drawback Unclear how generic it could be at this point.
One example of where it's unclear with constant generics is the Grad operand. Which allows you to pass 2 vectors or scalars of the same size as the Dim, so right now I'm unsure how we'd allow that to generically while also validating the length.
A lot of image operations (mainly those around sampling, or getting/setting texels from images) support additional optional operands. At the SPIR-V level this comes in the form of an operand at the end of each instruction which is a 8 bit integer that acts as a bit mask for indicating the how many operands follow and what they are used for. Additionally certain operands can only be used with certain image parameters, (such as the
Biasoperand only being available for single sampled 1D, 2D, 3D, and Cube image.)The question becomes how to best support using these operands at the Rust level and validate these constraints.
Possibilities
One example of where it's unclear with constant generics is the
Gradoperand. Which allows you to pass 2 vectors or scalars of the same size as theDim, so right now I'm unsure how we'd allow that to generically while also validating the length.