Skip to content

Clarify VS/FS fragment shader matching with anonymous struct varying #3656

Description

@kkinnunen-apple

Clarify how are the output or input variables variables matched when the variable declaration contains possibly anonymous struct.

The type of vertex outputs and fragment inputs with the same name must match, otherwise the link
command will fail. The precision does not need to match. Only those fragment inputs statically used (i.e.
read) in the fragment shader must be declared as outputs in the vertex shader; declaring superfluous vertex
shader outputs is permissible.

https://registry.khronos.org/OpenGL/specs/es/3.0/GLSL_ES_Specification_3.00.pdf

Two unnamed structs

// VS
out struct { float field; } s0;

// FS
in struct { float field; } s0;

Two named structs with the same name

// VS
out struct T { float field; } s0;

// FS
in struct T { float field; } s0;

One unnamed struct and one named struct

// VS
out struct T { float field; } s0;

// FS
in struct { float field; } s0;

Two named structs with different struct names

// VS
out struct T { float field; } s0;

// FS
in struct Q { float field; } s0;

Anonymous struct matched to two distinct anonymous structs at the other side

// VS
out struct { float field; } s0, s1;

// FS
in struct { float field; } s0;
in struct { float field; } s1;

Activity

  1. assigned and unassigned on May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions