Skip to content

Commit 4ed8cdd

Browse files
committed
add parsing for minLOD
1 parent 79d817f commit 4ed8cdd

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
@@ -387,6 +387,9 @@ std::optional<StaticSampler> RootSignatureParser::parseStaticSampler() {
387387
if (Params->MaxAnisotropy.has_value())
388388
Sampler.MaxAnisotropy= Params->MaxAnisotropy.value();
389389

390+
if (Params->MinLOD.has_value())
391+
Sampler.MinLOD= Params->MinLOD.value();
392+
390393
if (consumeExpectedToken(TokenKind::pu_r_paren,
391394
diag::err_hlsl_unexpected_end_of_params,
392395
/*param of=*/TokenKind::kw_StaticSampler))
@@ -706,6 +709,23 @@ RootSignatureParser::parseStaticSamplerParams() {
706709
return std::nullopt;
707710
Params.MaxAnisotropy = MaxAnisotropy;
708711
}
712+
713+
// `minLOD` `=` NUMBER
714+
if (tryConsumeExpectedToken(TokenKind::kw_minLOD)) {
715+
if (Params.MinLOD.has_value()) {
716+
getDiags().Report(CurToken.TokLoc, diag::err_hlsl_rootsig_repeat_param)
717+
<< CurToken.TokKind;
718+
return std::nullopt;
719+
}
720+
721+
if (consumeExpectedToken(TokenKind::pu_equal))
722+
return std::nullopt;
723+
724+
auto MinLOD= parseFloatParam();
725+
if (!MinLOD.has_value())
726+
return std::nullopt;
727+
Params.MinLOD = MinLOD;
728+
}
709729
} while (tryConsumeExpectedToken(TokenKind::pu_comma));
710730

711731
return Params;

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

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

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

0 commit comments

Comments
 (0)