Skip to content

Reflection Info

Sean Moss edited this page Jan 30, 2021 · 6 revisions

This page describes the various values and extra information associated with the generated shader reflection.

Shader Base Types

Reflection uses a set of base types that can describe both numeric and opaque handle types. Any time a "base type" or "component type" is referenced in the reflection, it will take one of the following values:

Value Type Notes
1 Boolean A 32-bit boolean type
2 Signed Signed integer type
3 Unsigned Unsigned integer type
4 Float Floating point type
5 Sampler A sampler type (combined image-sampler in Vulkan terms)
6 Image A read/write image
7 ROBuffer A read-only structured buffer
8 RWBuffer A read-write structured buffer
9 ROTexels A read-only texel buffer
10 RWTexels A read-write texel buffer

Texel Rank

Texel-like objects will have a number of dimensions (known as the "rank") associated with them. They take the following values:

Value Type Notes
0 1D 1-dimensional
1 2D 2-dimensional
2 3D 3-dimensional
3 1D Array Array of 1-dimensional objects
4 2D Array Array of 2-dimensional objects
5 Cube A cube-map
6 Buffer Special rank for ROTexels and RWTexels

Numeric Types

Numeric types are associated with a base type (Signed, Unsigned, or Float), a size, and two dimension values.

The base types are described above.

The size is the component size of the numeric type. Right now, this will always be 4 as numerics of different sizes are not yet supported.

The first dimension value gives the vector size (or matrix row count), and the second dimension gives the matrix columns, or one. Examples:

Type Base Type Dim[0] Dim[1]
float Float 1 1
ivec2 Signed 2 1
float2x4 Float 4 2
float4x2 Float 2 4
float4x4 Float 4 4

Texel Format

Texel-like objects have texel format information associated with them. Texel formats are given as a tuple of format type, format size, and component count. The format type gives the base type of the texel, and can be one of:

Value Name Description
0 Signed The texel components are a signed integer type
1 Unsigned The texel components are an unsigned integer type
2 Float The texel components are a floating point type
3 UNorm The texel components are unsigned integers that are normalized to a floating point value in [0, 1]
4 SNorm The texel components are signed integers that are normalized to a floating point value in [-1, 1]

All supported VSL formats and their associated format info is given here:

Format Base Type Type Size Component Count
int4 Signed 4 4
int2 Signed 4 2
int Signed 4 1
uint4 Unsigned 4 4
uint2 Unsigned 4 2
uint Unsigned 4 1
float4 Float 4 4
float2 Float 4 2
float Float 4 1
u8norm4 UNorm 1 4
u8norm2 UNorm 1 2
u8norm UNorm 1 1
u16norm4 UNorm 2 4
u16norm2 UNorm 2 2
u16norm UNorm 2 1
s8norm4 SNorm 1 4
s8norm2 SNorm 1 2
s8norm SNorm 1 1
s16norm4 SNorm 2 4
s16norm2 SNorm 2 2
s16norm SNorm 2 1
Clone this wiki locally