src/sksl/codegen/SkSLWGSLCodeGenerator.cpp
std::optional<WGSLCodeGenerator::Builtin> builtin_from_sksl_name(int builtin) {
    using Builtin = WGSLCodeGenerator::Builtin;
    switch (builtin) {
        case SK_POSITION_BUILTIN:
            [[fallthrough]];
        case SK_FRAGCOORD_BUILTIN:
            return {Builtin::kPosition};
        case SK_VERTEXID_BUILTIN:
            return {Builtin::kVertexIndex};
        case SK_INSTANCEID_BUILTIN:
            return {Builtin::kInstanceIndex};
        case SK_CLOCKWISE_BUILTIN:
            // TODO(skia:13092): While `front_facing` is the corresponding built-in, it does not
            // imply a particular winding order. We correctly compute the face orientation based
            // on how Skia configured the render pipeline for all references to this built-in
            // variable (see `SkSL::Program::Inputs::fUseFlipRTUniform`).
            return {Builtin::kFrontFacing};
        default:
            break;
    }
    return std::nullopt;
}
// Map a SkSL builtin flag to a WGSL builtin kind. Returns std::nullopt if `builtin` is not
// not supported for WGSL.
//
// Also see //src/sksl/sksl_vert.sksl and //src/sksl/sksl_frag.sksl for supported built-ins.
Map a SkSL builtin flag to a WGSL builtin kind. Returns std::nullopt if `builtin` is not
not supported for WGSL.


Map a SkSL builtin flag to a WGSL builtin kind . Returns std :: nullopt if ` builtin ` is not not supported for WGSL .
std::optional<WGSLCodeGenerator::Builtin> builtin_from_sksl_name(int builtin) {
    using Builtin = WGSLCodeGenerator::Builtin;
    switch (builtin) {
        case SK_POSITION_BUILTIN:
            [[fallthrough]];
        case SK_FRAGCOORD_BUILTIN:
            return {Builtin::kPosition};
        case SK_VERTEXID_BUILTIN:
            return {Builtin::kVertexIndex};
        case SK_INSTANCEID_BUILTIN:
            return {Builtin::kInstanceIndex};
        case SK_CLOCKWISE_BUILTIN:
            return {Builtin::kFrontFacing};
        default:
            break;
    }
    return std::nullopt;
}
std :: optional < WGSLCodeGenerator :: Builtin > builtin_from_sksl_name ( int builtin ) { using Builtin = WGSLCodeGenerator :: Builtin ; switch ( builtin ) { case SK_POSITION_BUILTIN : [[ fallthrough ]] ; case SK_FRAGCOORD_BUILTIN : return { Builtin :: kPosition } ; case SK_VERTEXID_BUILTIN : return { Builtin :: kVertexIndex } ; case SK_INSTANCEID_BUILTIN : return { Builtin :: kInstanceIndex } ; case SK_CLOCKWISE_BUILTIN : return { Builtin :: kFrontFacing } ; default : break ; } return std :: nullopt ; }
Map a SkSL builtin flag to a WGSL builtin kind.
Map a SkSL builtin flag to a WGSL builtin kind .
// TODO(skia:13092): While `front_facing` is the corresponding built-in, it does not // imply a particular winding order. We correctly compute the face orientation based // on how Skia configured the render pipeline for all references to this built-in // variable (see `SkSL::Program::Inputs::fUseFlipRTUniform`).