Skip to content

[DirectX][SPIRV] Add variable rate shading support - #1533

Merged
spall merged 11 commits into
llvm:mainfrom
spall:issue-1044
Sep 25, 2026
Merged

spall merged 11 commits into
llvm:mainfrom
spall:issue-1044

Conversation

@spall

@spall spall commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Add support for variable rate shading for both directx and spirv. Add a test case which uses SV_ShadingRate.

Closes #1044

Assisted by GPT-5.6 Sol

Comment thread test/Feature/Semantics/ShadingRate.test Outdated
Comment thread test/Feature/Semantics/ShadingRate.test Outdated
Comment thread test/Feature/Semantics/ShadingRate.test Outdated
Comment thread test/Feature/Semantics/ShadingRate.test Outdated
Comment thread test/Feature/Semantics/ShadingRate.test Outdated
Co-authored-by: Deric C. <cheung.deric@gmail.com>
@spall
spall merged commit c90d8bd into llvm:main Sep 25, 2026
24 of 32 checks passed
Comment thread lib/API/DX/Device.cpp
Comment on lines 544 to +558
@@ -503,10 +551,11 @@ class DXPipelineState : public offloadtest::PipelineState {
llvm::SmallVector<RootSignatureLayout> Layout,
ComPtr<ID3D12PipelineState> PSO,
std::optional<D3D_PRIMITIVE_TOPOLOGY> Topology,
bool IsRT = false)
bool IsRT = false,
D3D12_SHADING_RATE ShadingRate = D3D12_SHADING_RATE_1X1)
: offloadtest::PipelineState(GPUAPI::DirectX), Name(Name),
RootSig(RootSig), Layout(std::move(Layout)), PSO(PSO),
Topology(Topology), IsRayTracing(IsRT) {}
Topology(Topology), IsRayTracing(IsRT), ShadingRate(ShadingRate) {}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm seeing a warning from clang here:

error: field 'IsRayTracing' will be initialized after field 'ShadingRate' [-Werror,-Wreorder-ctor]

Constructors should always initialize fields in the same order they're declared in the class, and it's least confusing if the argument order matches, so this should be:

  DXPipelineState(llvm::StringRef Name, ComPtr<ID3D12RootSignature> RootSig,
                  llvm::SmallVector<RootSignatureLayout> Layout,
                  ComPtr<ID3D12PipelineState> PSO,
                  std::optional<D3D_PRIMITIVE_TOPOLOGY> Topology,
                  D3D12_SHADING_RATE ShadingRate = D3D12_SHADING_RATE_1X1,
                  bool IsRT = false)
      : offloadtest::PipelineState(GPUAPI::DirectX), Name(Name),
        RootSig(RootSig), Layout(std::move(Layout)), PSO(PSO),
        Topology(Topology), ShadingRate(ShadingRate), IsRayTracing(IsRT) {}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok ill put up a pr to fix this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spall added a commit that referenced this pull request Sep 29, 2026
Fix warning by reordering class fields in DXPipelineState
Addresses comment here:
#1533 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[SPIRV][DirectX] Add variable rate shading

5 participants