Skip to content

Commit 9d1b45e

Browse files
committed
add test cases
1 parent 3163d7e commit 9d1b45e

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

llvm/unittests/Frontend/HLSLRootSignatureDumpTest.cpp

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,4 +233,69 @@ TEST(HLSLRootSignatureTest, RootUAVDump) {
233233
EXPECT_EQ(Out, Expected);
234234
}
235235

236+
TEST(HLSLRootSignatureTest, DefaultStaticSamplerDump) {
237+
StaticSampler Sampler;
238+
Sampler.Reg = {RegisterType::SReg, 0};
239+
240+
std::string Out;
241+
llvm::raw_string_ostream OS(Out);
242+
OS << Sampler;
243+
OS.flush();
244+
245+
std::string Expected = "StaticSampler(s0, "
246+
"filter = Anisotropic, "
247+
"addressU = Wrap, "
248+
"addressV = Wrap, "
249+
"addressW = Wrap, "
250+
"mipLODBias = 0.000000e+00, "
251+
"maxAnisotropy = 16, "
252+
"comparisonFunc = LessEqual, "
253+
"borderColor = OpaqueWhite, "
254+
"minLOD = 0.000000e+00, "
255+
"maxLOD = 3.402823e+38, "
256+
"space = 0, "
257+
"visibility = All"
258+
")";
259+
EXPECT_EQ(Out, Expected);
260+
}
261+
262+
TEST(HLSLRootSignatureTest, DefinedStaticSamplerDump) {
263+
StaticSampler Sampler;
264+
Sampler.Reg = {RegisterType::SReg, 0};
265+
266+
Sampler.Filter = SamplerFilter::ComparisonMinMagLinearMipPoint;
267+
Sampler.AddressU = TextureAddressMode::Mirror;
268+
Sampler.AddressV = TextureAddressMode::Border;
269+
Sampler.AddressW = TextureAddressMode::Clamp;
270+
Sampler.MipLODBias = 4.8f;
271+
Sampler.MaxAnisotropy = 32;
272+
Sampler.CompFunc = ComparisonFunc::NotEqual;
273+
Sampler.BorderColor = StaticBorderColor::OpaqueBlack;
274+
Sampler.MinLOD = 1.0f;
275+
Sampler.MaxLOD = 32.0f;
276+
Sampler.Space = 7;
277+
Sampler.Visibility = ShaderVisibility::Domain;
278+
279+
std::string Out;
280+
llvm::raw_string_ostream OS(Out);
281+
OS << Sampler;
282+
OS.flush();
283+
284+
std::string Expected = "StaticSampler(s0, "
285+
"filter = ComparisonMinMagLinearMipPoint, "
286+
"addressU = Mirror, "
287+
"addressV = Border, "
288+
"addressW = Clamp, "
289+
"mipLODBias = 4.800000e+00, "
290+
"maxAnisotropy = 32, "
291+
"comparisonFunc = NotEqual, "
292+
"borderColor = OpaqueBlack, "
293+
"minLOD = 1.000000e+00, "
294+
"maxLOD = 3.200000e+01, "
295+
"space = 7, "
296+
"visibility = Domain"
297+
")";
298+
EXPECT_EQ(Out, Expected);
299+
}
300+
236301
} // namespace

0 commit comments

Comments
 (0)