llvm / llvm/llvm-project

[HLSL] Implement the `SV_ShadingRate` semantic

Open
#212,567 0 comments 0 reactions 1 assignee Claimed by @inbelic View on GitHub
HLSL
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Add `SV_ShadingRate` to the list of parsed semantics. Emitted from the vertex shader and requires Shader Model 6.4. Then lower as follows:

DXIL: `StoreOutput` op (`dx.op.storeOutput`, opcode 5) to a not-packed output element.

SPIRV: `PrimitiveShadingRateKHR` built-in store.

Reference [here](https://github.com/llvm/wg-hlsl/blob/main/proposals/0040-semantics-overview.md#system-value-constraints) for its type constraints. Reference the [vertex](https://github.com/llvm/wg-hlsl/blob/main/proposals/0040-semantics-overview.md#vertex-shader) shader section for packing info and where valid.

Offload test suite testing implemented in https://github.com/llvm/offload-test-suite/issues/1044

AC:
- [ ] Add the semantic spelling in `Attr.td`
- [ ] Update `CGHLSLRuntime` to handle the semantic spelling
- [ ] Update `SemaHLSL` to add additional diagnostics
- [ ] Update shader flag analysis to set the variable-rate-shading flag when this semantic is present
- [ ] Add LIT testing of sema and codegen

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.