-
Notifications
You must be signed in to change notification settings - Fork 0
Annotations and attributes
Gustav Sterbrant edited this page Oct 14, 2024
·
4 revisions
Annotations are data ignored by the shader compiler but serialized to the client API for parsing in your application. It allows for a user to annotate objects in the shader code, which can then be read back. Example:
@ShaderVisibility("CS")
Annotations can be either string, float, int, unsigned int or bool.
Nearly all symbols in GPULang have a set of allowed attributes based on the type of symbol attached to them.
-
const
Variable may not change its value after initialization -
var
Variable may change its value after initialization, and is implicit
-
group
Associates an externally provided resources with a certain binding group (descriptor set, root signature table, bind group) -
binding
Either associates an externally provided resource with a binding index within it's binding group, or associates an entry_point input or output with it's corresponding slot
-
entry_point
Flags the function as being a shader entry point. It doesn't need to be consumed by a program. Special rules apply to a function of this nature, such as being able to set other function attributes associated with shader linkage. -
local_size_x(N)
Compute shader work group dimension in X. N must be a literal integer value. Valid forentry_point
functions. -
local_size_y(N)
Compute shader work group dimension in Y. N must be a literal integer value. Valid forentry_point
functions. -
local_size_z(N)
Compute shader work group dimension in Z. N must be a literal integer value. Valid forentry_point
functions. -
early_depth
Pixel shader should eliminate if depth test fails before running the shader. Valid forentry_point
functions. -
group_size(N)
Compute shader subgroup size. Default is 64. N must be a literal integer value. Valid forentry_point
functions. -
groups_per_workgroup(N)
Compute shader subgroups per workgroup. Default is 1. N must be a literal integer value. Valid forentry_point
functions. -
input_vertices(N)
Hull/Mesh shader input vertex count. N must be a literal integer value. Valid forentry_point
functions. -
max_output_vertices(N)
- Geometry/Mesh/Hull shader max vertex output count. N must be a literal integer value. Valid forentry_point
functions. -
winding(CW/CCW)
- Domain shader winding order. Can be either CW (clockwise) or CCW (counter-clockwise) Valid forentry_point
functions. -
input_topology(points/lines/lines_adjacency/triangles/triangles_adjacency/quads/isoline)
- Hull/Geometry shader mesh input topology. For Hull shaders, valid values includepoints/lines/lines_adjacency/triangles_adjacency
. For Geometry shaders, valid values includetriangles/quads/isolines
. Valid forentry_point
functions. -
output_topology(points/lines/triangles)
- Geometry shader mesh output topology. Valid forentry_point
functions. -
patch_type(triangles/quads/isolines)
- Domain shader patch type. Valid forentry_point
functions. -
partition(integer, fract_even, fract_odd)
- Hull shader partitioning method. Valid forentry_point
functions. -
pixel_origin(lower_left/lower/upper_left/upper/center)
- Pixel shader origin point.lower_left
andlower
denote the same mode, as well asupper_left
andupper
. Valid forentry_point
functions. -
prototype
- Flags the function as being bound on a per-program basis.
-
in
Forentry_point
parameters, makes up the linking interface with the previous shader or client. Can be combined withbinding
to assign a specific binding point -
out
Same as forin
but for linking with the next shader stage or framebuffer output. -
patch
This parameter comes from a patch produced by a Hull shader. Valid for Domain shader inputs. -
no_interpolate
- This parameter should not undergo any barycentric interpolation at shader start. Valid for Pixel shader inputs and Vertex/Domain/Geometry/Mesh shader outputs. -
no_perspective
- Do not perform perspective correction on input. Valid for Pixel shader inputs and Vertex/Domain/Geometry/Mesh shader outputs.
-
no_read
For externally provided resources in the global scope, this means the resource cannot be read. -
atomic
Resource manages writes atomically. -
volatile
Accesses to this resource may not be optimized away.
-
uniform
Indicates the value is uniform across a work group. -
inline
Resource reads it's data inline from the command buffer (push constants/root constants). -
workgroup
Value is shared across the workgroup (LDS).