Skip to content

Commit 2ff0c01

Browse files
committed
add parsing for minLOD
1 parent caa9a93 commit 2ff0c01

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

clang/include/clang/Parse/ParseHLSLRootSignature.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ class RootSignatureParser {
113113
std::optional<llvm::hlsl::rootsig::Register> Reg;
114114
std::optional<float> MipLODBias;
115115
std::optional<uint32_t> MaxAnisotropy;
116+
std::optional<float> MinLOD;
116117
};
117118
std::optional<ParsedStaticSamplerParams> parseStaticSamplerParams();
118119

clang/lib/Parse/ParseHLSLRootSignature.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,9 @@ std::optional<StaticSampler> RootSignatureParser::parseStaticSampler() {
383383
if (Params->MaxAnisotropy.has_value())
384384
Sampler.MaxAnisotropy= Params->MaxAnisotropy.value();
385385

386+
if (Params->MinLOD.has_value())
387+
Sampler.MinLOD= Params->MinLOD.value();
388+
386389
if (consumeExpectedToken(TokenKind::pu_r_paren,
387390
diag::err_hlsl_unexpected_end_of_params,
388391
/*param of=*/TokenKind::kw_StaticSampler))
@@ -702,6 +705,23 @@ RootSignatureParser::parseStaticSamplerParams() {
702705
return std::nullopt;
703706
Params.MaxAnisotropy = MaxAnisotropy;
704707
}
708+
709+
// `minLOD` `=` NUMBER
710+
if (tryConsumeExpectedToken(TokenKind::kw_minLOD)) {
711+
if (Params.MinLOD.has_value()) {
712+
getDiags().Report(CurToken.TokLoc, diag::err_hlsl_rootsig_repeat_param)
713+
<< CurToken.TokKind;
714+
return std::nullopt;
715+
}
716+
717+
if (consumeExpectedToken(TokenKind::pu_equal))
718+
return std::nullopt;
719+
720+
auto MinLOD= parseFloatParam();
721+
if (!MinLOD.has_value())
722+
return std::nullopt;
723+
Params.MinLOD = MinLOD;
724+
}
705725
} while (tryConsumeExpectedToken(TokenKind::pu_comma));
706726

707727
return Params;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ struct StaticSampler {
163163
Register Reg;
164164
float MipLODBias = 0.f;
165165
uint32_t MaxAnisotropy = 16;
166+
float MinLOD = 0.f;
166167
};
167168

168169
/// Models RootElement : RootFlags | RootConstants | RootParam

0 commit comments

Comments
 (0)