DirectXShaderCompiler
DirectXShaderCompiler copied to clipboard
Require valid outputcontrolpoints on Hull shader
According to the documentation: "A hull shader is implemented with an HLSL function, and has the following properties: [...] The shader output is between 1 and 32 control points".
https://learn.microsoft.com/en-us/windows/win32/direct3d11/direct3d-11-advanced-stages-tessellation#hull-shader-stage
This change adds a check to verify that the outputcontrolpoints attribute is set on Hull shaders and has an argument in the valid range.
Fixes #3733 (by making the error consistent between backends)
@llvm-beanz The cases where outputcontrolpoints
was 0 or unset currently pass with the DXIL backend, but it seems like this shouldn't be the case. What do you think of this change?
@tex3d Any thoughts on this? If it's too breaking of a change to error, do you have any insight into the expected behavior of outputcontrolpoints being unset or zero that could help us implement it correctly on the SPIR-V side?
In terms of the DXIL that would be generated if 0 were allowed, it's just placed on the list of attributes for the hull entry point functions.
I expect that drivers may consume this fine, but it could only mean that the domain shader wouldn't be run at all. I can't imagine why this would be a useful thing to do even in the most contrived case.
Looking into the validator changes...
:warning: Python code formatter, darker found issues in your code. :warning:
You can test this locally with the following command:
darker --check --diff -r 696a13a2a8d007e625c11d46f650b3a91ed72a3a..c679d6fdbdbaf936d8c0e977647f96484dcbc579 utils/hct/hctdb.py
View the diff from darker here.
--- hctdb.py 2024-02-27 18:36:29.000000 +0000
+++ hctdb.py 2024-03-25 17:22:57.471712 +0000
@@ -7587,11 +7587,11 @@
"Instr.AtomicIntrinNonUAV", "Non-UAV destination to atomic intrinsic."
)
self.add_valrule_msg(
"Instr.SVConflictingLaunchMode",
"Input system values are compatible with node shader launch mode.",
- "Call to DXIL intrinsic %0 (%1) is not allowed in node shader launch type %2"
+ "Call to DXIL intrinsic %0 (%1) is not allowed in node shader launch type %2",
)
self.add_valrule("Instr.AtomicConst", "Constant destination to atomic.")
# Work-Graphs
self.add_valrule(
- [x] Check this box to apply formatting changes to this branch.
This change is ready for re-review!
Ping @tex3d, this change is just waiting on your review.
I don't know why the formatter auto-apply is failing, but I'm going to bypass it since it's modifying a line that isn't touched in this PR anyways.
I see this failing the GitHub Pages workflow, taking a look...