Set sampler feedback shader flag when sampler feedback operations are used (and validator version >= 1.9)#8567
Open
Icohedron wants to merge 1 commit into
Open
Conversation
Detect sampler feedback DXIL ops when collecting shader flags and gate the SamplerFeedback requirement by validator version >= 1.9. Add an HLSL FileCheck test covering both enabled and gated behavior. Assisted-by: Claude Opus 4.8
Collaborator
Author
|
I could also add a validator test but I don't think it is necessary. The validator already has two smoke tests ensuring that the validator validates the setting of shader flags. Explicit support for new shader flags does not need to be added to the validator since they are picked up automatically from diff --git a/tools/clang/unittests/HLSL/ValidationTest.cpp b/tools/clang/unittests/HLSL/ValidationTest.cpp
index 67c22e7b..f1fb6208 100644
--- a/tools/clang/unittests/HLSL/ValidationTest.cpp
+++ b/tools/clang/unittests/HLSL/ValidationTest.cpp
@@ -217,6 +217,7 @@ public:
TEST_METHOD(WhenMetaFlagsUsageDeclThenOK)
TEST_METHOD(WhenMetaFlagsUsageThenFail)
+ TEST_METHOD(WhenMetaFlagsSamplerFeedbackThenFail)
TEST_METHOD(WhenRootSigMismatchThenFail)
TEST_METHOD(WhenRootSigCompatThenSucceed)
@@ -1843,6 +1844,17 @@ TEST_F(ValidationTest, WhenMetaFlagsUsageThenFail) {
"Flags must match usage");
}
+TEST_F(ValidationTest, WhenMetaFlagsSamplerFeedbackThenFail) {
+ if (m_ver.SkipDxilVersion(1, 9))
+ return;
+ RewriteAssemblyCheckMsg(
+ "FeedbackTexture2D<SAMPLER_FEEDBACK_MIN_MIP> fb; Texture2D<float> t; "
+ "SamplerState s; float main() : SV_Target { "
+ "fb.WriteSamplerFeedback(t, s, (float2)0); return 0; }",
+ "ps_6_5", "67108864", "0", // remove the sampler feedback flag
+ "Flags must match usage");
+}
+
TEST_F(ValidationTest, StorePatchControlNotInPatchConstantFunction) {
if (m_ver.SkipDxilVersion(1, 3))
return; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #8533
This PR sets the sampler feedback DXIL feature flag in the presence of sampler feedback operations when the validator version is >= 1.9.
A lit test has also added to verify the functionality.
Assisted-by: Claude Opus 4.8