Skip to content

Commit 55111b9

Browse files
committed
nfc: move StaticBorderColor
1 parent 7a0a9f7 commit 55111b9

File tree

6 files changed

+10
-27
lines changed

6 files changed

+10
-27
lines changed

clang/include/clang/Parse/ParseHLSLRootSignature.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class RootSignatureParser {
118118
std::optional<float> MipLODBias;
119119
std::optional<uint32_t> MaxAnisotropy;
120120
std::optional<llvm::hlsl::rootsig::ComparisonFunc> CompFunc;
121-
std::optional<llvm::hlsl::rootsig::StaticBorderColor> BorderColor;
121+
std::optional<llvm::dxbc::StaticBorderColor> BorderColor;
122122
std::optional<float> MinLOD;
123123
std::optional<float> MaxLOD;
124124
std::optional<uint32_t> Space;
@@ -137,8 +137,7 @@ class RootSignatureParser {
137137
std::optional<llvm::hlsl::rootsig::TextureAddressMode>
138138
parseTextureAddressMode();
139139
std::optional<llvm::hlsl::rootsig::ComparisonFunc> parseComparisonFunc();
140-
std::optional<llvm::hlsl::rootsig::StaticBorderColor>
141-
parseStaticBorderColor();
140+
std::optional<llvm::dxbc::StaticBorderColor> parseStaticBorderColor();
142141
std::optional<llvm::dxbc::RootDescriptorFlags> parseRootDescriptorFlags();
143142
std::optional<llvm::dxbc::DescriptorRangeFlags> parseDescriptorRangeFlags();
144143

clang/lib/Parse/ParseHLSLRootSignature.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,7 +1088,7 @@ RootSignatureParser::parseComparisonFunc() {
10881088
return std::nullopt;
10891089
}
10901090

1091-
std::optional<llvm::hlsl::rootsig::StaticBorderColor>
1091+
std::optional<llvm::dxbc::StaticBorderColor>
10921092
RootSignatureParser::parseStaticBorderColor() {
10931093
assert(CurToken.TokKind == TokenKind::pu_equal &&
10941094
"Expects to only be invoked starting at given keyword");
@@ -1104,7 +1104,7 @@ RootSignatureParser::parseStaticBorderColor() {
11041104
switch (CurToken.TokKind) {
11051105
#define STATIC_BORDER_COLOR_ENUM(NAME, LIT) \
11061106
case TokenKind::en_##NAME: \
1107-
return StaticBorderColor::NAME; \
1107+
return llvm::dxbc::StaticBorderColor::NAME; \
11081108
break;
11091109
#include "clang/Lex/HLSLRootSignatureTokenKinds.def"
11101110
default:

clang/unittests/Parse/ParseHLSLRootSignatureTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ TEST_F(ParseHLSLRootSignatureTest, ValidParseStaticSamplerTest) {
268268
ASSERT_EQ(std::get<StaticSampler>(Elem).MaxAnisotropy, 16u);
269269
ASSERT_EQ(std::get<StaticSampler>(Elem).CompFunc, ComparisonFunc::LessEqual);
270270
ASSERT_EQ(std::get<StaticSampler>(Elem).BorderColor,
271-
StaticBorderColor::OpaqueWhite);
271+
llvm::dxbc::StaticBorderColor::OpaqueWhite);
272272
ASSERT_FLOAT_EQ(std::get<StaticSampler>(Elem).MinLOD, 0.f);
273273
ASSERT_FLOAT_EQ(std::get<StaticSampler>(Elem).MaxLOD, 3.402823466e+38f);
274274
ASSERT_EQ(std::get<StaticSampler>(Elem).Space, 0u);
@@ -289,7 +289,7 @@ TEST_F(ParseHLSLRootSignatureTest, ValidParseStaticSamplerTest) {
289289
ASSERT_EQ(std::get<StaticSampler>(Elem).MaxAnisotropy, 3u);
290290
ASSERT_EQ(std::get<StaticSampler>(Elem).CompFunc, ComparisonFunc::NotEqual);
291291
ASSERT_EQ(std::get<StaticSampler>(Elem).BorderColor,
292-
StaticBorderColor::OpaqueBlackUint);
292+
llvm::dxbc::StaticBorderColor::OpaqueBlackUint);
293293
ASSERT_FLOAT_EQ(std::get<StaticSampler>(Elem).MinLOD, 4.2f);
294294
ASSERT_FLOAT_EQ(std::get<StaticSampler>(Elem).MaxLOD, 9000.f);
295295
ASSERT_EQ(std::get<StaticSampler>(Elem).Space, 4u);

llvm/include/llvm/Frontend/HLSL/HLSLRootSignature.h

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,6 @@ enum class ComparisonFunc : unsigned {
8989
Always = 8
9090
};
9191

92-
enum class StaticBorderColor {
93-
TransparentBlack = 0,
94-
OpaqueBlack = 1,
95-
OpaqueWhite = 2,
96-
OpaqueBlackUint = 3,
97-
OpaqueWhiteUint = 4
98-
};
99-
10092
// Definitions of the in-memory data layout structures
10193

10294
// Models the different registers: bReg | tReg | uReg | sReg
@@ -181,7 +173,7 @@ struct StaticSampler {
181173
float MipLODBias = 0.f;
182174
uint32_t MaxAnisotropy = 16;
183175
ComparisonFunc CompFunc = ComparisonFunc::LessEqual;
184-
StaticBorderColor BorderColor = StaticBorderColor::OpaqueWhite;
176+
dxbc::StaticBorderColor BorderColor = dxbc::StaticBorderColor::OpaqueWhite;
185177
float MinLOD = 0.f;
186178
float MaxLOD = std::numeric_limits<float>::max();
187179
uint32_t Space = 0;

llvm/lib/Frontend/HLSL/HLSLRootSignatureUtils.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -175,17 +175,9 @@ static raw_ostream &operator<<(raw_ostream &OS,
175175
return OS;
176176
}
177177

178-
static const EnumEntry<StaticBorderColor> StaticBorderColorNames[] = {
179-
{"TransparentBlack", StaticBorderColor::TransparentBlack},
180-
{"OpaqueBlack", StaticBorderColor::OpaqueBlack},
181-
{"OpaqueWhite", StaticBorderColor::OpaqueWhite},
182-
{"OpaqueBlackUint", StaticBorderColor::OpaqueBlackUint},
183-
{"OpaqueWhiteUint", StaticBorderColor::OpaqueWhiteUint},
184-
};
185-
186178
static raw_ostream &operator<<(raw_ostream &OS,
187-
const StaticBorderColor &BorderColor) {
188-
printEnum(OS, BorderColor, ArrayRef(StaticBorderColorNames));
179+
const dxbc::StaticBorderColor &BorderColor) {
180+
printEnum(OS, BorderColor, dxbc::getStaticBorderColors());
189181

190182
return OS;
191183
}

llvm/unittests/Frontend/HLSLRootSignatureDumpTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ TEST(HLSLRootSignatureTest, DefinedStaticSamplerDump) {
201201
Sampler.MipLODBias = 4.8f;
202202
Sampler.MaxAnisotropy = 32;
203203
Sampler.CompFunc = ComparisonFunc::NotEqual;
204-
Sampler.BorderColor = StaticBorderColor::OpaqueBlack;
204+
Sampler.BorderColor = llvm::dxbc::StaticBorderColor::OpaqueBlack;
205205
Sampler.MinLOD = 1.0f;
206206
Sampler.MaxLOD = 32.0f;
207207
Sampler.Space = 7;

0 commit comments

Comments
 (0)