GetAttributeAtVertex

Description

Get the value of a vertex attribute at a specific vertex.

The GetAttributeAtVertex() function can be used in a fragment shader to get the value of the given attribute at the vertex of the primitive that corresponds to the given vertexIndex.

Note that the attribute must have been a declared varying input to the fragment shader with the nointerpolation modifier.

This function can be applied to scalars, vectors, and matrices of built-in scalar types.

Signature

T GetAttributeAtVertex<T>(
    T attribute,
    uint vertexIndex)
    where T : __BuiltinType;

vector<T, N> GetAttributeAtVertex<T, int N>(
    vector<T, N> attribute,
    uint vertexIndex)
    where T : __BuiltinType;

matrix<T, N, M> GetAttributeAtVertex<T, int N, int M>(
    matrix<T, N, M> attribute,
    uint vertexIndex)
    where T : __BuiltinType;

Generic Parameters

T: __BuiltinType

N : int

M : int

Parameters

attribute : T

vertexIndex : uint

attribute : vector<T, N>

attribute : matrix<T, N, M>

Availability and Requirements

Defined for the following targets:

hlsl

Available in fragment stage only.

glsl

Available in fragment stage only.

spirv

Available in fragment stage only.

Requires capability: spvFragmentBarycentricKHR.