• Slang Standard Library Reference
    • Interfaces
    • Types
    • Attributes
    • Global Declarations
      • Atomic functions
      • Memory and control barriers
      • Bit operation functions
      • Conversion functions
      • Derivative functions
      • Math functions
      • Mesh shading
      • Ray-tracing
      • Tessellation functions
      • Wave and quad functions
      • CheckAccessFullyMapped
      • D3DCOLORtoUBYTE4
      • EvaluateAttributeAtCentroid
      • EvaluateAttributeAtSample
      • EvaluateAttributeSnapped
      • GetAttributeAtVertex
      • GetRenderTargetSampleCount
      • GetRenderTargetSamplePosition
      • IsHelperLane
      • NonUniformResourceIndex
      • ReorderThread
      • WorkgroupSize
      • abort
      • all
      • any
      • clip
      • concat
      • createDynamicObject
      • cudaBlockDim
      • cudaBlockIdx
      • cudaThreadIdx
      • debugBreak
      • getRealtimeClock
      • getRealtimeClockLow
      • getStringHash
      • makeTuple
      • nextafter
      • printf
      • select
      • static_assert
      • unmodified
      • unused

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, N:int>(
    vector<T, N> attribute,
    uint vertexIndex)
    where T : __BuiltinType;

matrix<T, N, M> GetAttributeAtVertex<T, N:int, M:int>(
    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.