Defines the fragment shader output structure and WGSL returned values. Allows declaring custom returned values, such as when rendering to a Multiple Render Target.

interface FragmentOutput {
    struct: { type: string; name: string }[];
    output: string;
}

Properties

Properties

struct: { type: string; name: string }[]

Define the fragment shader output structure as an array of type and name members. Default to [{ type: 'vec4f', name: 'color }].

Type declaration

  • type: string

    WGSL type of the fragment shader output struct member, e.g. vec4f, vec3f, etc.

  • name: string

    Name of the fragment shader output struct member, e.g. color, normal, etc.

output: string

Define a custom fragment shader WGSL returned value. Should use the FSOutput struct type. Default to:

var output: FSOutput;
output.color = outputColor;
return output;