SPIR-V Built-In

PrimitiveShadingRateKHR

Primitive contribution to fragment shading rate
PrimitiveShadingRateKHR

Decorating a variable with the PrimitiveShadingRateKHR built-in decoration will make that variable contain the primitive fragment shading rate.

The value written to the variable decorated with PrimitiveShadingRateKHR by the last pre-rasterization shader stage in the pipeline is used as the primitive fragment shading rate. Outputs in previous shader stages are ignored.

If the last active pre-rasterization shader stage shader entry point’s interface does not include a variable decorated with PrimitiveShadingRateKHR, then it is as if the shader specified a fragment shading rate value of 0, indicating a horizontal and vertical rate of 1 pixel.

If a shader has PrimitiveShadingRateKHR in the output interface and there is an execution path through the shader that does not write to it, its value is undefined: for executions of the shader that take that path.

Valid Usage

VUID-PrimitiveShadingRateKHR-PrimitiveShadingRateKHR-04484

The PrimitiveShadingRateKHR decoration must be used only within the MeshEXT, MeshNV, Vertex, or Geometry

Execution Model

VUID-PrimitiveShadingRateKHR-PrimitiveShadingRateKHR-04485

The variable decorated with PrimitiveShadingRateKHR must be declared using the Output Storage Class

VUID-PrimitiveShadingRateKHR-PrimitiveShadingRateKHR-04486

The variable decorated with PrimitiveShadingRateKHR must be declared as a scalar 32-bit integer value

VUID-PrimitiveShadingRateKHR-PrimitiveShadingRateKHR-04487

The value written to PrimitiveShadingRateKHR must include no more than one of Vertical2Pixels and Vertical4Pixels

VUID-PrimitiveShadingRateKHR-PrimitiveShadingRateKHR-04488

The value written to PrimitiveShadingRateKHR must include no more than one of Horizontal2Pixels and Horizontal4Pixels

VUID-PrimitiveShadingRateKHR-PrimitiveShadingRateKHR-04489

The value written to PrimitiveShadingRateKHR must not have any bits set other than those defined by Fragment Shading Rate Flags enumerants in the SPIR-V specification

VUID-PrimitiveShadingRateKHR-PrimitiveShadingRateKHR-07059

The variable decorated with PrimitiveShadingRateKHR within the MeshEXT Execution Model must also be decorated with the PerPrimitiveEXT decoration