- Notifications
You must be signed in to change notification settings - Fork 805
Description
Description
When compiling any Domain/TessellationEvaluation shader, the %gl_TessCoord
variable that's generated from the SV_DomainLocation
semantic is decorated with the Patch
decoration. According to the SPIR-V spec this is invalid.
This causes Vulkan graphics pipeline creation to fail for some pipelines with complex tessellation shaders on current NVIDIA drivers after updating from Vulkan SDK 1.3.296.0 to 1.4.304.1, since the generated SPIR-V code changed in some other way:
(Left is the result of the generated code from the new SDK, right it old. Please ignore the SPIR-V ids since those are the result of manual patching).
The issue is still there in commit 0a1143572d107c8b6980df092b84a79190ec1fbd
of the main
branch from Feb 28 2025`.
I suppose the check in DeclResultIdMapper.cpp
line 3519 may not be sufficient, though I don't have enough knowlege to come up with a fix myself that I'd feel comfortable with:
// TODO: the following may not be correct? if (stageVarData.sigPoint->GetSignatureKind() == hlsl::DXIL::SignatureKind::PatchConstOrPrim) { if (stageVarData.sigPoint->GetKind() == hlsl::SigPoint::Kind::MSPOut) { // Decorate with PerPrimitiveNV for per-primitive out variables. spvBuilder.decoratePerPrimitiveNV(varInstr, varInstr->getSourceLocation()); } else { spvBuilder.decoratePatch(varInstr, varInstr->getSourceLocation()); } }
Steps to Reproduce
Compile the attached HLSL file (please replace the extension) with the following dxc command line:
-nologo -spirv -E tes_main -Fc test.s -Fo test.spv -HV 202x -Wconversion -Wdouble-promotion -T ds_6_2 -Wx -fspv-target-env="vulkan1.1" test.hlsl
or have a look at godbolt: https://godbolt.org/z/TqTnK7GYj
Actual Behavior
%gl_TessCoord
has the Patch
decoration, which is not valid SPIR-V.
OpDecorate %gl_TessCoord Patch
Environment
- DXC version:
dxcompiler.dll: 1.8 - 1.8.0.4775 (d39324e06)
and commit0a1143572d107c8b6980df092b84a79190ec1fbd
compiled from source - Host Operating System: Windows 10
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Status