-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Revert "[HLSL][RootSignature] Add parsing of filter enum for StaticSampler" #142053
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
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
…mpler (#…" This reverts commit dfc2c15.
@llvm/pr-subscribers-clang @llvm/pr-subscribers-hlsl Author: Finn Plummer (inbelic) ChangesThe current naming of the This change will be reverted to be addressed by renaming the variable. Reverts llvm/llvm-project#140294 Full diff: https://github.com/llvm/llvm-project/pull/142053.diff 6 Files Affected:
diff --git a/clang/include/clang/Lex/HLSLRootSignatureTokenKinds.def b/clang/include/clang/Lex/HLSLRootSignatureTokenKinds.def
index 9515bc7d847fa..9b47ec57f541b 100644
--- a/clang/include/clang/Lex/HLSLRootSignatureTokenKinds.def
+++ b/clang/include/clang/Lex/HLSLRootSignatureTokenKinds.def
@@ -53,9 +53,6 @@
#ifndef SHADER_VISIBILITY_ENUM
#define SHADER_VISIBILITY_ENUM(NAME, LIT) ENUM(NAME, LIT)
#endif
-#ifndef FILTER_ENUM
-#define FILTER_ENUM(NAME, LIT) ENUM(NAME, LIT)
-#endif
#ifndef TEXTURE_ADDRESS_MODE_ENUM
#define TEXTURE_ADDRESS_MODE_ENUM(NAME, LIT) ENUM(NAME, LIT)
#endif
@@ -107,11 +104,10 @@ KEYWORD(numDescriptors)
KEYWORD(offset)
// StaticSampler Keywords:
-KEYWORD(filter)
+KEYWORD(mipLODBias)
KEYWORD(addressU)
KEYWORD(addressV)
KEYWORD(addressW)
-KEYWORD(mipLODBias)
KEYWORD(maxAnisotropy)
KEYWORD(minLOD)
KEYWORD(maxLOD)
@@ -158,44 +154,6 @@ SHADER_VISIBILITY_ENUM(Pixel, "SHADER_VISIBILITY_PIXEL")
SHADER_VISIBILITY_ENUM(Amplification, "SHADER_VISIBILITY_AMPLIFICATION")
SHADER_VISIBILITY_ENUM(Mesh, "SHADER_VISIBILITY_MESH")
-// Filter Enums:
-FILTER_ENUM(MinMagMipPoint, "FILTER_MIN_MAG_MIP_POINT")
-FILTER_ENUM(MinMagPointMipLinear, "FILTER_MIN_MAG_POINT_MIP_LINEAR")
-FILTER_ENUM(MinPointMagLinearMipPoint, "FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT")
-FILTER_ENUM(MinPointMagMipLinear, "FILTER_MIN_POINT_MAG_MIP_LINEAR")
-FILTER_ENUM(MinLinearMagMipPoint, "FILTER_MIN_LINEAR_MAG_MIP_POINT")
-FILTER_ENUM(MinLinearMagPointMipLinear, "FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR")
-FILTER_ENUM(MinMagLinearMipPoint, "FILTER_MIN_MAG_LINEAR_MIP_POINT")
-FILTER_ENUM(MinMagMipLinear, "FILTER_MIN_MAG_MIP_LINEAR")
-FILTER_ENUM(Anisotropic, "FILTER_ANISOTROPIC")
-FILTER_ENUM(ComparisonMinMagMipPoint, "FILTER_COMPARISON_MIN_MAG_MIP_POINT")
-FILTER_ENUM(ComparisonMinMagPointMipLinear, "FILTER_COMPARISON_MIN_MAG_POINT_MIP_LINEAR")
-FILTER_ENUM(ComparisonMinPointMagLinearMipPoint, "FILTER_COMPARISON_MIN_POINT_MAG_LINEAR_MIP_POINT")
-FILTER_ENUM(ComparisonMinPointMagMipLinear, "FILTER_COMPARISON_MIN_POINT_MAG_MIP_LINEAR")
-FILTER_ENUM(ComparisonMinLinearMagMipPoint, "FILTER_COMPARISON_MIN_LINEAR_MAG_MIP_POINT")
-FILTER_ENUM(ComparisonMinLinearMagPointMipLinear, "FILTER_COMPARISON_MIN_LINEAR_MAG_POINT_MIP_LINEAR")
-FILTER_ENUM(ComparisonMinMagLinearMipPoint, "FILTER_COMPARISON_MIN_MAG_LINEAR_MIP_POINT")
-FILTER_ENUM(ComparisonMinMagMipLinear, "FILTER_COMPARISON_MIN_MAG_MIP_LINEAR")
-FILTER_ENUM(ComparisonAnisotropic, "FILTER_COMPARISON_ANISOTROPIC")
-FILTER_ENUM(MinimumMinMagMipPoint, "FILTER_MINIMUM_MIN_MAG_MIP_POINT")
-FILTER_ENUM(MinimumMinMagPointMipLinear, "FILTER_MINIMUM_MIN_MAG_POINT_MIP_LINEAR")
-FILTER_ENUM(MinimumMinPointMagLinearMipPoint, "FILTER_MINIMUM_MIN_POINT_MAG_LINEAR_MIP_POINT")
-FILTER_ENUM(MinimumMinPointMagMipLinear, "FILTER_MINIMUM_MIN_POINT_MAG_MIP_LINEAR")
-FILTER_ENUM(MinimumMinLinearMagMipPoint, "FILTER_MINIMUM_MIN_LINEAR_MAG_MIP_POINT")
-FILTER_ENUM(MinimumMinLinearMagPointMipLinear, "FILTER_MINIMUM_MIN_LINEAR_MAG_POINT_MIP_LINEAR")
-FILTER_ENUM(MinimumMinMagLinearMipPoint, "FILTER_MINIMUM_MIN_MAG_LINEAR_MIP_POINT")
-FILTER_ENUM(MinimumMinMagMipLinear, "FILTER_MINIMUM_MIN_MAG_MIP_LINEAR")
-FILTER_ENUM(MinimumAnisotropic, "FILTER_MINIMUM_ANISOTROPIC")
-FILTER_ENUM(MaximumMinMagMipPoint, "FILTER_MAXIMUM_MIN_MAG_MIP_POINT")
-FILTER_ENUM(MaximumMinMagPointMipLinear, "FILTER_MAXIMUM_MIN_MAG_POINT_MIP_LINEAR")
-FILTER_ENUM(MaximumMinPointMagLinearMipPoint, "FILTER_MAXIMUM_MIN_POINT_MAG_LINEAR_MIP_POINT")
-FILTER_ENUM(MaximumMinPointMagMipLinear, "FILTER_MAXIMUM_MIN_POINT_MAG_MIP_LINEAR")
-FILTER_ENUM(MaximumMinLinearMagMipPoint, "FILTER_MAXIMUM_MIN_LINEAR_MAG_MIP_POINT")
-FILTER_ENUM(MaximumMinLinearMagPointMipLinear, "FILTER_MAXIMUM_MIN_LINEAR_MAG_POINT_MIP_LINEAR")
-FILTER_ENUM(MaximumMinMagLinearMipPoint, "FILTER_MAXIMUM_MIN_MAG_LINEAR_MIP_POINT")
-FILTER_ENUM(MaximumMinMagMipLinear, "FILTER_MAXIMUM_MIN_MAG_MIP_LINEAR")
-FILTER_ENUM(MaximumAnisotropic, "FILTER_MAXIMUM_ANISOTROPIC")
-
// Texture Address Mode Enums:
TEXTURE_ADDRESS_MODE_ENUM(Wrap, "TEXTURE_ADDRESS_WRAP")
TEXTURE_ADDRESS_MODE_ENUM(Mirror, "TEXTURE_ADDRESS_MIRROR")
@@ -204,7 +162,6 @@ TEXTURE_ADDRESS_MODE_ENUM(Border, "TEXTURE_ADDRESS_BORDER")
TEXTURE_ADDRESS_MODE_ENUM(MirrorOnce, "TEXTURE_ADDRESS_MIRRORONCE")
#undef TEXTURE_ADDRESS_MODE_ENUM
-#undef FILTER_ENUM
#undef SHADER_VISIBILITY_ENUM
#undef DESCRIPTOR_RANGE_FLAG_ENUM
#undef DESCRIPTOR_RANGE_FLAG_ENUM_OFF
diff --git a/clang/include/clang/Parse/ParseHLSLRootSignature.h b/clang/include/clang/Parse/ParseHLSLRootSignature.h
index 3af2f9bb5c754..d436265b8b37a 100644
--- a/clang/include/clang/Parse/ParseHLSLRootSignature.h
+++ b/clang/include/clang/Parse/ParseHLSLRootSignature.h
@@ -111,11 +111,10 @@ class RootSignatureParser {
struct ParsedStaticSamplerParams {
std::optional<llvm::hlsl::rootsig::Register> Reg;
- std::optional<llvm::hlsl::rootsig::Filter> Filter;
+ std::optional<float> MipLODBias;
std::optional<llvm::hlsl::rootsig::TextureAddressMode> AddressU;
std::optional<llvm::hlsl::rootsig::TextureAddressMode> AddressV;
std::optional<llvm::hlsl::rootsig::TextureAddressMode> AddressW;
- std::optional<float> MipLODBias;
std::optional<uint32_t> MaxAnisotropy;
std::optional<float> MinLOD;
std::optional<float> MaxLOD;
@@ -129,7 +128,6 @@ class RootSignatureParser {
/// Parsing methods of various enums
std::optional<llvm::hlsl::rootsig::ShaderVisibility> parseShaderVisibility();
- std::optional<llvm::hlsl::rootsig::Filter> parseFilter();
std::optional<llvm::hlsl::rootsig::TextureAddressMode>
parseTextureAddressMode();
std::optional<llvm::hlsl::rootsig::RootDescriptorFlags>
diff --git a/clang/lib/Parse/ParseHLSLRootSignature.cpp b/clang/lib/Parse/ParseHLSLRootSignature.cpp
index 0279819b84cd4..e9373f9a82beb 100644
--- a/clang/lib/Parse/ParseHLSLRootSignature.cpp
+++ b/clang/lib/Parse/ParseHLSLRootSignature.cpp
@@ -377,9 +377,6 @@ std::optional<StaticSampler> RootSignatureParser::parseStaticSampler() {
Sampler.Reg = Params->Reg.value();
// Fill in optional values
- if (Params->Filter.has_value())
- Sampler.Filter = Params->Filter.value();
-
if (Params->AddressU.has_value())
Sampler.AddressU = Params->AddressU.value();
@@ -687,23 +684,6 @@ RootSignatureParser::parseStaticSamplerParams() {
Params.Reg = Reg;
}
- // `filter` `=` FILTER
- if (tryConsumeExpectedToken(TokenKind::kw_filter)) {
- if (Params.Filter.has_value()) {
- getDiags().Report(CurToken.TokLoc, diag::err_hlsl_rootsig_repeat_param)
- << CurToken.TokKind;
- return std::nullopt;
- }
-
- if (consumeExpectedToken(TokenKind::pu_equal))
- return std::nullopt;
-
- auto Filter = parseFilter();
- if (!Filter.has_value())
- return std::nullopt;
- Params.Filter = Filter;
- }
-
// `addressU` `=` TEXTURE_ADDRESS
if (tryConsumeExpectedToken(TokenKind::kw_addressU)) {
if (Params.AddressU.has_value()) {
@@ -929,31 +909,6 @@ RootSignatureParser::parseShaderVisibility() {
return std::nullopt;
}
-std::optional<llvm::hlsl::rootsig::Filter> RootSignatureParser::parseFilter() {
- assert(CurToken.TokKind == TokenKind::pu_equal &&
- "Expects to only be invoked starting at given keyword");
-
- TokenKind Expected[] = {
-#define FILTER_ENUM(NAME, LIT) TokenKind::en_##NAME,
-#include "clang/Lex/HLSLRootSignatureTokenKinds.def"
- };
-
- if (!tryConsumeExpectedToken(Expected))
- return std::nullopt;
-
- switch (CurToken.TokKind) {
-#define FILTER_ENUM(NAME, LIT) \
- case TokenKind::en_##NAME: \
- return Filter::NAME; \
- break;
-#include "clang/Lex/HLSLRootSignatureTokenKinds.def"
- default:
- llvm_unreachable("Switch for consumed enum token was not provided");
- }
-
- return std::nullopt;
-}
-
std::optional<llvm::hlsl::rootsig::TextureAddressMode>
RootSignatureParser::parseTextureAddressMode() {
assert(CurToken.TokKind == TokenKind::pu_equal &&
diff --git a/clang/unittests/Lex/LexHLSLRootSignatureTest.cpp b/clang/unittests/Lex/LexHLSLRootSignatureTest.cpp
index 39872ea6b0a3e..f0f22ccc29e9f 100644
--- a/clang/unittests/Lex/LexHLSLRootSignatureTest.cpp
+++ b/clang/unittests/Lex/LexHLSLRootSignatureTest.cpp
@@ -136,8 +136,8 @@ TEST_F(LexHLSLRootSignatureTest, ValidLexAllTokensTest) {
space visibility flags
numDescriptors offset
- filter addressU addressV addressW
- mipLODBias maxAnisotropy minLOD maxLOD
+ mipLODBias addressU addressV addressW
+ maxAnisotropy minLOD maxLOD
unbounded
DESCRIPTOR_RANGE_OFFSET_APPEND
@@ -170,43 +170,6 @@ TEST_F(LexHLSLRootSignatureTest, ValidLexAllTokensTest) {
shader_visibility_amplification
shader_visibility_mesh
- FILTER_MIN_MAG_MIP_POINT
- FILTER_MIN_MAG_POINT_MIP_LINEAR
- FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT
- FILTER_MIN_POINT_MAG_MIP_LINEAR
- FILTER_MIN_LINEAR_MAG_MIP_POINT
- FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR
- FILTER_MIN_MAG_LINEAR_MIP_POINT
- FILTER_MIN_MAG_MIP_LINEAR
- FILTER_ANISOTROPIC
- FILTER_COMPARISON_MIN_MAG_MIP_POINT
- FILTER_COMPARISON_MIN_MAG_POINT_MIP_LINEAR
- FILTER_COMPARISON_MIN_POINT_MAG_LINEAR_MIP_POINT
- FILTER_COMPARISON_MIN_POINT_MAG_MIP_LINEAR
- FILTER_COMPARISON_MIN_LINEAR_MAG_MIP_POINT
- FILTER_COMPARISON_MIN_LINEAR_MAG_POINT_MIP_LINEAR
- FILTER_COMPARISON_MIN_MAG_LINEAR_MIP_POINT
- FILTER_COMPARISON_MIN_MAG_MIP_LINEAR
- FILTER_COMPARISON_ANISOTROPIC
- FILTER_MINIMUM_MIN_MAG_MIP_POINT
- FILTER_MINIMUM_MIN_MAG_POINT_MIP_LINEAR
- FILTER_MINIMUM_MIN_POINT_MAG_LINEAR_MIP_POINT
- FILTER_MINIMUM_MIN_POINT_MAG_MIP_LINEAR
- FILTER_MINIMUM_MIN_LINEAR_MAG_MIP_POINT
- FILTER_MINIMUM_MIN_LINEAR_MAG_POINT_MIP_LINEAR
- FILTER_MINIMUM_MIN_MAG_LINEAR_MIP_POINT
- FILTER_MINIMUM_MIN_MAG_MIP_LINEAR
- FILTER_MINIMUM_ANISOTROPIC
- FILTER_MAXIMUM_MIN_MAG_MIP_POINT
- FILTER_MAXIMUM_MIN_MAG_POINT_MIP_LINEAR
- FILTER_MAXIMUM_MIN_POINT_MAG_LINEAR_MIP_POINT
- FILTER_MAXIMUM_MIN_POINT_MAG_MIP_LINEAR
- FILTER_MAXIMUM_MIN_LINEAR_MAG_MIP_POINT
- FILTER_MAXIMUM_MIN_LINEAR_MAG_POINT_MIP_LINEAR
- FILTER_MAXIMUM_MIN_MAG_LINEAR_MIP_POINT
- FILTER_MAXIMUM_MIN_MAG_MIP_LINEAR
- FILTER_MAXIMUM_ANISOTROPIC
-
TEXTURE_ADDRESS_WRAP
TEXTURE_ADDRESS_MIRROR
TEXTURE_ADDRESS_CLAMP
diff --git a/clang/unittests/Parse/ParseHLSLRootSignatureTest.cpp b/clang/unittests/Parse/ParseHLSLRootSignatureTest.cpp
index b0c667156ab6d..6477b25550c4d 100644
--- a/clang/unittests/Parse/ParseHLSLRootSignatureTest.cpp
+++ b/clang/unittests/Parse/ParseHLSLRootSignatureTest.cpp
@@ -230,7 +230,6 @@ TEST_F(ParseHLSLRootSignatureTest, ValidParseStaticSamplerTest) {
minLOD = 4.2f, mipLODBias = 0.23e+3,
addressW = TEXTURE_ADDRESS_CLAMP,
addressV = TEXTURE_ADDRESS_BORDER,
- filter = FILTER_MAXIMUM_MIN_POINT_MAG_LINEAR_MIP_POINT,
maxLOD = 9000, addressU = TEXTURE_ADDRESS_MIRROR
)
)cc";
@@ -255,7 +254,6 @@ TEST_F(ParseHLSLRootSignatureTest, ValidParseStaticSamplerTest) {
ASSERT_TRUE(std::holds_alternative<StaticSampler>(Elem));
ASSERT_EQ(std::get<StaticSampler>(Elem).Reg.ViewType, RegisterType::SReg);
ASSERT_EQ(std::get<StaticSampler>(Elem).Reg.Number, 0u);
- ASSERT_EQ(std::get<StaticSampler>(Elem).Filter, Filter::Anisotropic);
ASSERT_EQ(std::get<StaticSampler>(Elem).AddressU, TextureAddressMode::Wrap);
ASSERT_EQ(std::get<StaticSampler>(Elem).AddressV, TextureAddressMode::Wrap);
ASSERT_EQ(std::get<StaticSampler>(Elem).AddressW, TextureAddressMode::Wrap);
@@ -269,8 +267,6 @@ TEST_F(ParseHLSLRootSignatureTest, ValidParseStaticSamplerTest) {
ASSERT_TRUE(std::holds_alternative<StaticSampler>(Elem));
ASSERT_EQ(std::get<StaticSampler>(Elem).Reg.ViewType, RegisterType::SReg);
ASSERT_EQ(std::get<StaticSampler>(Elem).Reg.Number, 0u);
- ASSERT_EQ(std::get<StaticSampler>(Elem).Filter,
- Filter::MaximumMinPointMagLinearMipPoint);
ASSERT_EQ(std::get<StaticSampler>(Elem).AddressU, TextureAddressMode::Mirror);
ASSERT_EQ(std::get<StaticSampler>(Elem).AddressV, TextureAddressMode::Border);
ASSERT_EQ(std::get<StaticSampler>(Elem).AddressW, TextureAddressMode::Clamp);
diff --git a/llvm/include/llvm/Frontend/HLSL/HLSLRootSignature.h b/llvm/include/llvm/Frontend/HLSL/HLSLRootSignature.h
index 29a55e326fa34..bb0a0d158a980 100644
--- a/llvm/include/llvm/Frontend/HLSL/HLSLRootSignature.h
+++ b/llvm/include/llvm/Frontend/HLSL/HLSLRootSignature.h
@@ -27,10 +27,7 @@ class Metadata;
namespace hlsl {
namespace rootsig {
-// Definition of the various enumerations and flags. The definitions of all
-// values here correspond to their description in the d3d12.h header and are
-// carried over from their values in DXC. For reference:
-// https://learn.microsoft.com/en-us/windows/win32/api/d3d12/
+// Definition of the various enumerations and flags
enum class RootFlags : uint32_t {
None = 0,
@@ -79,47 +76,6 @@ enum class ShaderVisibility {
Mesh = 7,
};
-// D3D12_FILTER enumeration:
-// https://learn.microsoft.com/en-us/windows/win32/api/d3d12/ne-d3d12-d3d12_filter
-enum class Filter {
- MinMagMipPoint = 0,
- MinMagPointMipLinear = 0x1,
- MinPointMagLinearMipPoint = 0x4,
- MinPointMagMipLinear = 0x5,
- MinLinearMagMipPoint = 0x10,
- MinLinearMagPointMipLinear = 0x11,
- MinMagLinearMipPoint = 0x14,
- MinMagMipLinear = 0x15,
- Anisotropic = 0x55,
- ComparisonMinMagMipPoint = 0x80,
- ComparisonMinMagPointMipLinear = 0x81,
- ComparisonMinPointMagLinearMipPoint = 0x84,
- ComparisonMinPointMagMipLinear = 0x85,
- ComparisonMinLinearMagMipPoint = 0x90,
- ComparisonMinLinearMagPointMipLinear = 0x91,
- ComparisonMinMagLinearMipPoint = 0x94,
- ComparisonMinMagMipLinear = 0x95,
- ComparisonAnisotropic = 0xd5,
- MinimumMinMagMipPoint = 0x100,
- MinimumMinMagPointMipLinear = 0x101,
- MinimumMinPointMagLinearMipPoint = 0x104,
- MinimumMinPointMagMipLinear = 0x105,
- MinimumMinLinearMagMipPoint = 0x110,
- MinimumMinLinearMagPointMipLinear = 0x111,
- MinimumMinMagLinearMipPoint = 0x114,
- MinimumMinMagMipLinear = 0x115,
- MinimumAnisotropic = 0x155,
- MaximumMinMagMipPoint = 0x180,
- MaximumMinMagPointMipLinear = 0x181,
- MaximumMinPointMagLinearMipPoint = 0x184,
- MaximumMinPointMagMipLinear = 0x185,
- MaximumMinLinearMagMipPoint = 0x190,
- MaximumMinLinearMagPointMipLinear = 0x191,
- MaximumMinMagLinearMipPoint = 0x194,
- MaximumMinMagMipLinear = 0x195,
- MaximumAnisotropic = 0x1d5
-};
-
enum class TextureAddressMode {
Wrap = 1,
Mirror = 2,
@@ -209,7 +165,6 @@ raw_ostream &operator<<(raw_ostream &OS, const DescriptorTableClause &Clause);
struct StaticSampler {
Register Reg;
- Filter Filter = Filter::Anisotropic;
TextureAddressMode AddressU = TextureAddressMode::Wrap;
TextureAddressMode AddressV = TextureAddressMode::Wrap;
TextureAddressMode AddressW = TextureAddressMode::Wrap;
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
clang:frontend
Language frontend issues, e.g. anything involving "Sema"
clang
Clang issues not falling into any other category
HLSL
HLSL Language Support
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.
The current naming of the
enum class Filter
and the Filter struct member causes ambiguity.This change will be reverted to be addressed by renaming the variable.
Reverts #140294