fn texture_args_generator(
    options: TextureArgsOptions,
    mut f: impl FnMut(crate::ScalarKind, Dim, bool, bool, bool),
) {
    for kind in [Sk::Float, Sk::Uint, Sk::Sint].iter().copied() {
        for dim in [Dim::D1, Dim::D2, Dim::D3, Dim::Cube].iter().copied() {
            for arrayed in [false, true].iter().copied() {
                if dim == Dim::Cube && arrayed {
                    if !options.contains(TextureArgsOptions::CUBE_ARRAY) {
                        continue;
                    }
                } else if Dim::D2 == dim
                    && options.contains(TextureArgsOptions::MULTI)
                    && arrayed
                    && options.contains(TextureArgsOptions::D2_MULTI_ARRAY)
                {
                    // multisampling for sampler2DMSArray
                    f(kind, dim, arrayed, true, false);
                } else if !options.contains(TextureArgsOptions::STANDARD) {
                    continue;
                }

                f(kind, dim, arrayed, false, false);

                // 3D images can't be neither arrayed nor shadow
                // so we break out early, this way arrayed will always
                // be false and we won't hit the shadow branch
                if let Dim::D3 = dim {
                    break;
                }

                if Dim::D2 == dim && options.contains(TextureArgsOptions::MULTI) && !arrayed {
                    // multisampling
                    f(kind, dim, arrayed, true, false);
                }

                if Sk::Float == kind && options.contains(TextureArgsOptions::SHADOW) {
                    // shadow
                    f(kind, dim, arrayed, false, true);
                }
            }
        }
    }
}
/// Helper function to generate the image components for texture/image builtins
///
/// Calls the passed function `f` with:
/// ```text
/// f(ScalarKind, ImageDimension, arrayed, multi, shadow)
/// ```
///
/// `options` controls extra image variants generation like multisampling and depth,
/// see the struct documentation


`options` controls extra image variants generation like multisampling and depth,
see the struct documentation
` options ` controls extra image variants generation like multisampling and depth see the struct documentation
fn texture_args_generator(
    options: TextureArgsOptions,
    mut f: impl FnMut(crate::ScalarKind, Dim, bool, bool, bool),
) {
    for kind in [Sk::Float, Sk::Uint, Sk::Sint].iter().copied() {
        for dim in [Dim::D1, Dim::D2, Dim::D3, Dim::Cube].iter().copied() {
            for arrayed in [false, true].iter().copied() {
                if dim == Dim::Cube && arrayed {
                    if !options.contains(TextureArgsOptions::CUBE_ARRAY) {
                        continue;
                    }
                } else if Dim::D2 == dim
                    && options.contains(TextureArgsOptions::MULTI)
                    && arrayed
                    && options.contains(TextureArgsOptions::D2_MULTI_ARRAY)
                {
                    // multisampling for sampler2DMSArray
                    f(kind, dim, arrayed, true, false);
                } else if !options.contains(TextureArgsOptions::STANDARD) {
                    continue;
                }
                f(kind, dim, arrayed, false, false);
                // 3D images can't be neither arrayed nor shadow
                // so we break out early, this way arrayed will always
                // be false and we won't hit the shadow branch
                if let Dim::D3 = dim {
                    break;
                }
                if Dim::D2 == dim && options.contains(TextureArgsOptions::MULTI) && !arrayed {
                    // multisampling
                    f(kind, dim, arrayed, true, false);
                }
                if Sk::Float == kind && options.contains(TextureArgsOptions::SHADOW) {
                    // shadow
                    f(kind, dim, arrayed, false, true);
                }
            }
        }
    }
}
fn texture_args_generator ( options : TextureArgsOptions , mut f : impl FnMut ( crate :: ScalarKind , Dim , bool , bool , bool ) , ) { for kind in [ Sk :: Float , Sk :: Uint , Sk :: Sint ] . iter ( ) . copied ( ) { for dim in [ Dim :: D1 , Dim :: D2 , Dim :: D3 , Dim :: Cube ] . iter ( ) . copied ( ) { for arrayed in [ false , true ] . iter ( ) . copied ( ) { if dim == Dim :: Cube && arrayed { if ! options . contains ( TextureArgsOptions :: CUBE_ARRAY ) { continue ; } } else if Dim :: D2 == dim && options . contains ( TextureArgsOptions :: MULTI ) && arrayed && options . contains ( TextureArgsOptions :: D2_MULTI_ARRAY ) { // multisampling for sampler2DMSArray f ( kind , dim , arrayed , true , false ) ; } else if ! options . contains ( TextureArgsOptions :: STANDARD ) { continue ; } f ( kind , dim , arrayed , false , false ) ; // 3D images can't be neither arrayed nor shadow // so we break out early, this way arrayed will always // be false and we won't hit the shadow branch if let Dim :: D3 = dim { break ; } if Dim :: D2 == dim && options . contains ( TextureArgsOptions :: MULTI ) && ! arrayed { // multisampling f ( kind , dim , arrayed , true , false ) ; } if Sk :: Float == kind && options . contains ( TextureArgsOptions :: SHADOW ) { // shadow f ( kind , dim , arrayed , false , true ) ; } } } } }
Helper function to generate the image components for texture/image builtins
Calls the passed function `f` with:
```text
f(ScalarKind, ImageDimension, arrayed, multi, shadow)
```
Helper function to generate the image components for texture / image builtins Calls the passed function ` f ` with : ` ` ` text f ( ScalarKind ImageDimension arrayed multi shadow ) ` ` `
options
TextureArgsOptions
f
impl FnMut(crate::ScalarKind, Dim, bool, bool, bool)
options
TextureArgsOptions
f
impl FnMut(crate::ScalarKind, Dim, bool, bool, bool)