Expand description
SPIR-V Intrinsics
This module is intended as a low level abstraction over SPIR-V instructions. These functions will typically map to a single instruction, and will perform no additional safety checks beyond type-checking.
Structs§
- Subgroup
Mask SubgroupMask
is aglam::UVec4
representing a bitmask of all invocations within a subgroup. Mostly used in group ballot operations.
Enums§
- Group
Operation - Defines the class of group operation.
- Quad
Direction - Direction is the kind of swap to perform.
Traits§
- Derivative
- Types that can be derived by partial derivatives
- Index
Unchecked - Index into an array without bounds checking.
Functions§
- all
- Result is true if all components of
vector
is true, otherwise result is false. - all_
memory_ ⚠barrier - Blocks execution of all threads in a group until all memory accesses have been completed.
- all_
memory_ ⚠barrier_ with_ group_ sync - Blocks execution of all threads in a group until all memory accesses have been completed and all threads in the group have reached this call.
- any
- Result is true if any component of
vector
is true, otherwise result is false. - atomic_
and ⚠ - Perform the following steps atomically with respect to any other atomic accesses within Scope to the same location:
- atomic_
compare_ ⚠exchange - Perform the following steps atomically with respect to any other atomic
accesses within
SCOPE
to the same location: - atomic_
exchange ⚠ - Perform the following steps atomically with respect to any other atomic
accesses within
SCOPE
to the same location: - atomic_
f_ ⚠add - Perform the following steps atomically with respect to any other atomic
accesses within
SCOPE
to the same location: - atomic_
f_ ⚠max - Perform the following steps atomically with respect to any other atomic accesses within Scope to the same location:
- atomic_
f_ ⚠min - Perform the following steps atomically with respect to any other atomic accesses within Scope to the same location:
- atomic_
i_ ⚠add - Perform the following steps atomically with respect to any other atomic
accesses within
SCOPE
to the same location: - atomic_
i_ ⚠decrement - Perform the following steps atomically with respect to any other atomic
accesses within
SCOPE
to the same location: - atomic_
i_ ⚠increment - Perform the following steps atomically with respect to any other atomic
accesses within
SCOPE
to the same location: - atomic_
i_ ⚠sub - Perform the following steps atomically with respect to any other atomic
accesses within
SCOPE
to the same location: - atomic_
load ⚠ - Atomically load through
ptr
using the givenSEMANTICS
. All subparts of the value that is loaded are read atomically with respect to all other atomic accesses to it withinSCOPE
. - atomic_
or ⚠ - Perform the following steps atomically with respect to any other atomic accesses within Scope to the same location:
- atomic_
s_ ⚠max - Perform the following steps atomically with respect to any other atomic accesses within Scope to the same location:
- atomic_
s_ ⚠min - Perform the following steps atomically with respect to any other atomic accesses within Scope to the same location:
- atomic_
store ⚠ - Atomically store through
ptr
using the givenSEMANTICS
. All subparts ofvalue
are written atomically with respect to all other atomic accesses to it withinSCOPE
. - atomic_
u_ ⚠max - Perform the following steps atomically with respect to any other atomic accesses within Scope to the same location:
- atomic_
u_ ⚠min - Perform the following steps atomically with respect to any other atomic accesses within Scope to the same location:
- atomic_
xor ⚠ - Perform the following steps atomically with respect to any other atomic accesses within Scope to the same location:
- control_
barrier ⚠ - Wait for other invocations of this module to reach the current point of execution.
- demote_
to_ ⚠helper_ invocation - Demote fragment shader invocation to a helper invocation. Equivalvent to
discard()
in HLSL. Any stores to memory after this instruction are suppressed and the fragment does not write outputs to the framebuffer. - device_
memory_ ⚠barrier - Blocks execution of all threads in a group until all device memory accesses have been completed.
- device_
memory_ ⚠barrier_ with_ group_ sync - Blocks execution of all threads in a group until all device memory accesses have been completed and all threads in the group have reached this call.
- emit_
mesh_ ⚠tasks_ ext - Defines the grid size of subsequent mesh shader workgroups to generate upon completion of the task shader workgroup.
- emit_
mesh_ ⚠tasks_ ext_ payload - Defines the grid size of subsequent mesh shader workgroups to generate upon completion of the task shader workgroup.
- emit_
stream_ ⚠vertex - Emits the current values of all output variables to the current output primitive. After execution, the values of all output variables are undefined.
- emit_
vertex ⚠ - Emits the current values of all output variables to the current output
primitive. After execution, the values of all output variables
are undefined. Requires capability
Geometry
. - end_
primitive ⚠ - Finish the current primitive and start a new one. No vertex is emitted.
Requires capability
Geometry
. - end_
stream_ ⚠primitive - Finish the current primitive and start a new one. No vertex is emitted.
- execute_
callable ⚠ - Invoke a callable shader.
- ignore_
intersection ⚠ - Ignores the current potential intersection, terminating the invocation that
executes it, and continues the ray traversal. This instruction is allowed
only in
any_hit
execution model. - is_
helper_ invocation - Returns
true
if the invocation is currently a helper invocation, otherwise result isfalse
. An invocation is currently a helper invocation if it was originally invoked as a helper invocation or if it has been demoted to a helper invocation by demote_to_helper_invocation. - kill
- Fragment-shader discard. Equivalvent to
discard()
from GLSL - memory_
barrier ⚠ - Control the order that memory accesses are observed.
- read_
clock_ ⚠khr - Read from the shader clock with either the
Subgroup
orDevice
scope. - read_
clock_ ⚠uvec2_ khr - Like
read_clock_khr
but returns a vector to avoid requiring theInt64
capability. It returns a ‘vector of two-components of 32-bit unsigned integer type with the first component containing the 32 least significant bits and the second component containing the 32 most significant bits.’ - report_
intersection ⚠ - Reports an intersection back to the traversal infrastructure.
- set_
mesh_ ⚠outputs_ ext - Sets the actual output size of the primitives and vertices that the mesh shader workgroup will emit upon completion.
- signed_
max - Compute the maximum of two signed integers via a GLSL extended instruction.
- signed_
min - Compute the minimum of two signed integers via a GLSL extended instruction.
- subgroup_
all - Evaluates a
predicate
for all active invocations in the group, resulting in true ifpredicate
evaluates to true for all active invocations in the group, otherwise the result is false. - subgroup_
all_ equal - Evaluates a
value
for all active invocations in the group. The result is true ifvalue
is equal for all active invocations in the group. Otherwise, the result is false. - subgroup_
and - A bitwise and group operation of all
value
operands contributed by active invocations in the group. - subgroup_
any - Evaluates a
predicate
for all active invocations in the group, resulting in true ifpredicate
evaluates to true for any active invocation in the group, otherwise the result is false. - subgroup_
ballot - Result is a bitfield value combining the
predicate
value from all invocations in the group that execute the same dynamic instance of this instruction. The bit is set to one if the corresponding invocation is active and thepredicate
for that invocation evaluated to true; otherwise, it is set to zero. - subgroup_
ballot_ bit_ count - Result is the number of bits that are set to 1 in
value
, considering only the bits invalue
required to represent all bits of the group’s invocations. - subgroup_
ballot_ bit_ extract - Evaluates a value for all active invocations in the group, resulting in true if the bit in
value
that corresponds toindex
is set to one, otherwise the result is false. - subgroup_
ballot_ exclusive_ bit_ count - Result is the number of bits that are set to 1 in
value
, considering only the bits invalue
required to represent all bits of the group’s invocations. - subgroup_
ballot_ find_ lsb - Find the least significant bit set to 1 in
value
, considering only the bits invalue
required to represent all bits of the group’s invocations. If none of the considered bits is set to 1, the resulting value is undefined. - subgroup_
ballot_ find_ msb - Find the most significant bit set to 1 in
value
, considering only the bits invalue
required to represent all bits of the group’s invocations. If none of the considered bits is set to 1, the resulting value is undefined. - subgroup_
ballot_ inclusive_ bit_ count - Result is the number of bits that are set to 1 in
value
, considering only the bits invalue
required to represent all bits of the group’s invocations. - subgroup_
barrier - The function
subgroupBarrier()
enforces that all active invocations within a subgroup must execute this function before any are allowed to continue their execution, and the results of any memory stores performed using coherent variables performed prior to the call will be visible to any future coherent access to the same memory performed by any other shader invocation within the same subgroup. - subgroup_
broadcast ⚠ - Result is the
value
of the invocation identified by the idid
to all active invocations in the group. - subgroup_
broadcast_ first - Result is the
value
of the invocation from the active invocation with the lowest id in the group to all active invocations in the group. - subgroup_
clustered_ ⚠and - A bitwise and group operation of all
value
operands contributed by active invocations in the group. - subgroup_
clustered_ ⚠f_ add - A floating point add group operation of all
value
operands contributed by active invocations in the group. - subgroup_
clustered_ ⚠f_ max - A floating point maximum group operation of all
value
operands contributed by active invocations in by group. - subgroup_
clustered_ ⚠f_ min - A floating point minimum group operation of all
value
operands contributed by active invocations in the group. - subgroup_
clustered_ ⚠f_ mul - A floating point multiply group operation of all
value
operands contributed by active invocations in the group. - subgroup_
clustered_ ⚠i_ add - An integer add group operation of all
value
operands contributed by active invocations in the group. - subgroup_
clustered_ ⚠i_ mul - An integer multiply group operation of all
value
operands contributed by active invocations in the group. - subgroup_
clustered_ ⚠logical_ and - A logical and group operation of all
value
operands contributed by active invocations in the group. - subgroup_
clustered_ ⚠logical_ or - A logical or group operation of all
value
operands contributed by active invocations in the group. - subgroup_
clustered_ ⚠logical_ xor - A logical xor group operation of all
value
operands contributed by active invocations in the group. - subgroup_
clustered_ ⚠or - A bitwise or group operation of all
value
operands contributed by active invocations in the group. - subgroup_
clustered_ ⚠s_ max - A signed integer maximum group operation of all
value
operands contributed by active invocations in the group. - subgroup_
clustered_ ⚠s_ min - A signed integer minimum group operation of all
value
operands contributed by active invocations in the group. - subgroup_
clustered_ ⚠u_ max - An unsigned integer maximum group operation of all
value
operands contributed by active invocations in the group. - subgroup_
clustered_ ⚠u_ min - An unsigned integer minimum group operation of all
value
operands contributed by active invocations in the group. - subgroup_
clustered_ ⚠xor - A bitwise xor group operation of all
value
operands contributed by active invocations in the group. - subgroup_
elect - Result is true only in the active invocation with the lowest id in the group, otherwise result is false.
- subgroup_
exclusive_ and - A bitwise and group operation of all
value
operands contributed by active invocations in the group. - subgroup_
exclusive_ f_ add - A floating point add group operation of all
value
operands contributed by active invocations in the group. - subgroup_
exclusive_ f_ max - A floating point maximum group operation of all
value
operands contributed by active invocations in by group. - subgroup_
exclusive_ f_ min - A floating point minimum group operation of all
value
operands contributed by active invocations in the group. - subgroup_
exclusive_ f_ mul - A floating point multiply group operation of all
value
operands contributed by active invocations in the group. - subgroup_
exclusive_ i_ add - An integer add group operation of all
value
operands contributed by active invocations in the group. - subgroup_
exclusive_ i_ mul - An integer multiply group operation of all
value
operands contributed by active invocations in the group. - subgroup_
exclusive_ logical_ and - A logical and group operation of all
value
operands contributed by active invocations in the group. - subgroup_
exclusive_ logical_ or - A logical or group operation of all
value
operands contributed by active invocations in the group. - subgroup_
exclusive_ logical_ xor - A logical xor group operation of all
value
operands contributed by active invocations in the group. - subgroup_
exclusive_ or - A bitwise or group operation of all
value
operands contributed by active invocations in the group. - subgroup_
exclusive_ s_ max - A signed integer maximum group operation of all
value
operands contributed by active invocations in the group. - subgroup_
exclusive_ s_ min - A signed integer minimum group operation of all
value
operands contributed by active invocations in the group. - subgroup_
exclusive_ u_ max - An unsigned integer maximum group operation of all
value
operands contributed by active invocations in the group. - subgroup_
exclusive_ u_ min - An unsigned integer minimum group operation of all
value
operands contributed by active invocations in the group. - subgroup_
exclusive_ xor - A bitwise xor group operation of all
value
operands contributed by active invocations in the group. - subgroup_
f_ add - A floating point add group operation of all
value
operands contributed by active invocations in the group. - subgroup_
f_ max - A floating point maximum group operation of all
value
operands contributed by active invocations in by group. - subgroup_
f_ min - A floating point minimum group operation of all
value
operands contributed by active invocations in the group. - subgroup_
f_ mul - A floating point multiply group operation of all
value
operands contributed by active invocations in the group. - subgroup_
i_ add - An integer add group operation of all
value
operands contributed by active invocations in the group. - subgroup_
i_ mul - An integer multiply group operation of all
value
operands contributed by active invocations in the group. - subgroup_
inclusive_ and - A bitwise and group operation of all
value
operands contributed by active invocations in the group. - subgroup_
inclusive_ f_ add - A floating point add group operation of all
value
operands contributed by active invocations in the group. - subgroup_
inclusive_ f_ max - A floating point maximum group operation of all
value
operands contributed by active invocations in by group. - subgroup_
inclusive_ f_ min - A floating point minimum group operation of all
value
operands contributed by active invocations in the group. - subgroup_
inclusive_ f_ mul - A floating point multiply group operation of all
value
operands contributed by active invocations in the group. - subgroup_
inclusive_ i_ add - An integer add group operation of all
value
operands contributed by active invocations in the group. - subgroup_
inclusive_ i_ mul - An integer multiply group operation of all
value
operands contributed by active invocations in the group. - subgroup_
inclusive_ logical_ and - A logical and group operation of all
value
operands contributed by active invocations in the group. - subgroup_
inclusive_ logical_ or - A logical or group operation of all
value
operands contributed by active invocations in the group. - subgroup_
inclusive_ logical_ xor - A logical xor group operation of all
value
operands contributed by active invocations in the group. - subgroup_
inclusive_ or - A bitwise or group operation of all
value
operands contributed by active invocations in the group. - subgroup_
inclusive_ s_ max - A signed integer maximum group operation of all
value
operands contributed by active invocations in the group. - subgroup_
inclusive_ s_ min - A signed integer minimum group operation of all
value
operands contributed by active invocations in the group. - subgroup_
inclusive_ u_ max - An unsigned integer maximum group operation of all
value
operands contributed by active invocations in the group. - subgroup_
inclusive_ u_ min - An unsigned integer minimum group operation of all
value
operands contributed by active invocations in the group. - subgroup_
inclusive_ xor - A bitwise xor group operation of all
value
operands contributed by active invocations in the group. - subgroup_
inverse_ ⚠ballot - Evaluates a
value
for all active invocations in the group, resulting in true if the bit invalue
for the corresponding invocation is set to one, otherwise the result is false. - subgroup_
logical_ and - A logical and group operation of all
value
operands contributed by active invocations in the group. - subgroup_
logical_ or - A logical or group operation of all
value
operands contributed by active invocations in the group. - subgroup_
logical_ xor - A logical xor group operation of all
value
operands contributed by active invocations in the group. - subgroup_
memory_ barrier - The function
subgroupMemoryBarrier()
enforces the ordering of all memory transactions issued within a single shader invocation, as viewed by other invocations in the same subgroup. - subgroup_
memory_ barrier_ buffer - The function
subgroupMemoryBarrierBuffer()
enforces the ordering of all memory transactions to buffer variables issued within a single shader invocation, as viewed by other invocations in the same subgroup. - subgroup_
memory_ barrier_ image - The function
subgroupMemoryBarrierImage()
enforces the ordering of all memory transactions to images issued within a single shader invocation, as viewed by other invocations in the same subgroup. - subgroup_
memory_ barrier_ shared - The function
subgroupMemoryBarrierShared()
enforces the ordering of all memory transactions to shared variables issued within a single shader invocation, as viewed by other invocations in the same subgroup. - subgroup_
or - A bitwise or group operation of all
value
operands contributed by active invocations in the group. - subgroup_
quad_ broadcast - Result is the
value
of the invocation within the quad with a quad index equal toindex
. - subgroup_
quad_ swap - Swap the
value
of the invocation within the quad with another invocation in the quad using Direction. - subgroup_
s_ max - A signed integer maximum group operation of all
value
operands contributed by active invocations in the group. - subgroup_
s_ min - A signed integer minimum group operation of all
value
operands contributed by active invocations in the group. - subgroup_
shuffle - Result is the
value
of the invocation identified by the idid
. - subgroup_
shuffle_ down - Result is the
value
of the invocation identified by the current invocation’s id within the group + Delta. - subgroup_
shuffle_ up - Result is the
value
of the invocation identified by the current invocation’s id within the group - Delta. - subgroup_
shuffle_ xor - Result is the
value
of the invocation identified by the current invocation’s id within the group xor’ed with Mask. - subgroup_
u_ max - An unsigned integer maximum group operation of all
value
operands contributed by active invocations in the group. - subgroup_
u_ min - An unsigned integer minimum group operation of all
value
operands contributed by active invocations in the group. - subgroup_
xor - A bitwise xor group operation of all
value
operands contributed by active invocations in the group. - terminate_
ray ⚠ - Terminates the invocation that executes it, stops the ray traversal, accepts
the current hit, and invokes the
closest_hit
execution model (if active). This instruction is allowed only in theany_hit
execution model. - unsigned_
max - Compute the maximum of two unsigned integers via a GLSL extended instruction.
- unsigned_
min - Compute the minimum of two unsigned integers via a GLSL extended instruction.
- vector_
extract_ ⚠dynamic - Extract a single, dynamically selected, component of a vector.
- vector_
insert_ ⚠dynamic - Make a copy of a vector, with a single, variably selected, component modified.
- workgroup_
memory_ ⚠barrier - Blocks execution of all threads in a group until all group shared accesses have been completed.
- workgroup_
memory_ ⚠barrier_ with_ group_ sync - Blocks execution of all threads in a group until all group shared accesses have been completed and all threads in the group have reached this call.