Function getFragmentShaderCodeWithOutput

  • Build a fragment shader based on output value and types e.g. write to color target 0 a vec4<f32>(1.0, 0.0, 1.0, 1.0) and color target 2 a vec2<u32>(1, 2)

    outputs: [
    {
    values: [1, 0, 1, 1],,
    plainType: 'f32',
    componentCount: 4,
    },
    null,
    {
    values: [1, 2],
    plainType: 'u32',
    componentCount: 2,
    },
    ]

    return:

    struct Outputs {
    @location(0) o1 : vec4<f32>,
    @location(2) o3 : vec2<u32>,
    }
    @fragment fn main() -> Outputs {
    return Outputs(vec4<f32>(1.0, 0.0, 1.0, 1.0), vec4<u32>(1, 2));
    }

    If fragDepth is given there will be an extra @builtin(frag_depth) output with the specified value assigned.

    Parameters

    • outputs: (null | {
          componentCount: number;
          plainType: "f32" | "u32" | "i32";
          values: readonly number[];
      })[]

      the shader outputs for each location attribute

    • fragDepth: null | {
          value: number;
      } = null

      the shader outputs frag_depth value (optional)

    • dualSourceBlending: boolean = false

    Returns string

    the fragment shader string

Generated using TypeDoc