Skip to content
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
787c776
adding yaml representation and updating write logic
joaosaffran Sep 18, 2025
57fd710
fix test
joaosaffran Sep 18, 2025
d72adfe
adding missing test
joaosaffran Sep 19, 2025
23803b7
Merge branch 'main' into obj2yaml/root-signature-1.2
joaosaffran Sep 19, 2025
fefd58c
fix test
joaosaffran Sep 19, 2025
13d945d
Merge branch 'main' into obj2yaml/static-sampler-view
joaosaffran Sep 19, 2025
1d0cbd3
adding samplers_iterator
joaosaffran Sep 22, 2025
e530bcc
this was easier than I thought
joaosaffran Sep 22, 2025
79ea587
adding new test
joaosaffran Sep 22, 2025
367ac8c
Merge branch 'main' into obj2yaml/root-signature-1.2
joaosaffran Sep 22, 2025
a08c05e
Merge branch 'obj2yaml/root-signature-1.2' of github.com:joaosaffran/…
joaosaffran Sep 22, 2025
159388d
Merge branch 'obj2yaml/root-signature-1.2' into obj2yaml/static-sampl…
joaosaffran Sep 22, 2025
905d5d3
clean up
joaosaffran Sep 22, 2025
b73bf24
clean up
joaosaffran Sep 22, 2025
bc393fd
adding flags to static sampler parser
joaosaffran Sep 22, 2025
e8f7b94
add tests
Sep 23, 2025
589668e
adding more test
Sep 24, 2025
e8b973f
adding operator << to print StaticSamplerFlags
joaosaffran Sep 25, 2025
190cfcd
updating comment with inbelic suggestion
joaosaffran Sep 25, 2025
79e9564
format
joaosaffran Sep 25, 2025
1b1c37d
fix test
joaosaffran Sep 25, 2025
daa5714
update Root Signature Version flag
joaosaffran Sep 25, 2025
32a2c89
Merge branch 'main' into frontend/update-flags
joaosaffran Sep 25, 2025
11770c5
fix objcopy test
joaosaffran Sep 25, 2025
09eb8f3
Merge branch 'main' into frontend/adding-new-tokens
joaosaffran Sep 26, 2025
c374634
foramt
joaosaffran Sep 26, 2025
0e80c63
addressing comments from bogner
joaosaffran Sep 26, 2025
a2a00a9
add test
joaosaffran Sep 26, 2025
c8f7e13
fix test
joaosaffran Sep 26, 2025
900c796
adding more tests
joaosaffran Oct 1, 2025
b85b876
fix version
joaosaffran Oct 1, 2025
deb02eb
removing initialization
joaosaffran Oct 1, 2025
2113929
addressing comments from bogner
joaosaffran Oct 1, 2025
6d87804
Merge branch 'main' into frontend/adding-new-tokens
joaosaffran Oct 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions clang/include/clang/Lex/HLSLRootSignatureTokenKinds.def
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@
#ifndef STATIC_BORDER_COLOR_ENUM
#define STATIC_BORDER_COLOR_ENUM(NAME, LIT) ENUM(NAME, LIT)
#endif
#ifndef STATIC_SAMPLER_FLAG_ENUM
#define STATIC_SAMPLER_FLAG_ENUM(NAME, LIT) ENUM(NAME, LIT)
#endif

// General Tokens:
TOK(invalid, "invalid identifier")
Expand Down Expand Up @@ -228,6 +231,10 @@ STATIC_BORDER_COLOR_ENUM(OpaqueWhite, "STATIC_BORDER_COLOR_OPAQUE_WHITE")
STATIC_BORDER_COLOR_ENUM(OpaqueBlackUint, "STATIC_BORDER_COLOR_OPAQUE_BLACK_UINT")
STATIC_BORDER_COLOR_ENUM(OpaqueWhiteUint, "STATIC_BORDER_COLOR_OPAQUE_WHITE_UINT")

// Root Descriptor Flag Enums:
STATIC_SAMPLER_FLAG_ENUM(UintBorderColor, "UINT_BORDER_COLOR")
STATIC_SAMPLER_FLAG_ENUM(NonNormalizedCoordinates, "NON_NORMALIZED_COORDINATES")

#undef STATIC_BORDER_COLOR_ENUM
#undef COMPARISON_FUNC_ENUM
#undef TEXTURE_ADDRESS_MODE_ENUM
Expand All @@ -237,6 +244,7 @@ STATIC_BORDER_COLOR_ENUM(OpaqueWhiteUint, "STATIC_BORDER_COLOR_OPAQUE_WHITE_UINT
#undef DESCRIPTOR_RANGE_FLAG_ENUM_OFF
#undef DESCRIPTOR_RANGE_FLAG_ENUM_ON
#undef ROOT_DESCRIPTOR_FLAG_ENUM
#undef STATIC_SAMPLER_FLAG_ENUM
#undef ROOT_FLAG_ENUM
#undef DESCRIPTOR_RANGE_OFFSET_ENUM
#undef UNBOUNDED_ENUM
Expand Down
3 changes: 3 additions & 0 deletions clang/include/clang/Parse/ParseHLSLRootSignature.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ class RootSignatureParser {
std::optional<float> MaxLOD;
std::optional<uint32_t> Space;
std::optional<llvm::dxbc::ShaderVisibility> Visibility;
std::optional<llvm::dxbc::StaticSamplerFlags> Flags;
};
std::optional<ParsedStaticSamplerParams> parseStaticSamplerParams();

Expand All @@ -153,6 +154,8 @@ class RootSignatureParser {
parseRootDescriptorFlags(RootSignatureToken::Kind Context);
std::optional<llvm::dxbc::DescriptorRangeFlags>
parseDescriptorRangeFlags(RootSignatureToken::Kind Context);
std::optional<llvm::dxbc::StaticSamplerFlags>
parseStaticSamplerFlags(RootSignatureToken::Kind Context);

/// Use NumericLiteralParser to convert CurToken.NumSpelling into a unsigned
/// 32-bit integer
Expand Down
61 changes: 61 additions & 0 deletions clang/lib/Parse/ParseHLSLRootSignature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,9 @@ std::optional<StaticSampler> RootSignatureParser::parseStaticSampler() {
if (Params->Visibility.has_value())
Sampler.Visibility = Params->Visibility.value();

if (Params->Flags.has_value())
Sampler.Flags = Params->Flags.value();

return Sampler;
}

Expand Down Expand Up @@ -926,6 +929,20 @@ RootSignatureParser::parseStaticSamplerParams() {
if (!Visibility.has_value())
return std::nullopt;
Params.Visibility = Visibility;
} else if (tryConsumeExpectedToken(TokenKind::kw_flags)) {
// `flags` `=` UINT_BORDER_COLOR
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

Suggested change
// `flags` `=` UINT_BORDER_COLOR
// `flags` `=` STATIC_SAMPLE_FLAGS

if (Params.Flags.has_value()) {
reportDiag(diag::err_hlsl_rootsig_repeat_param) << CurToken.TokKind;
return std::nullopt;
}

if (consumeExpectedToken(TokenKind::pu_equal))
return std::nullopt;

auto Flags = parseStaticSamplerFlags(TokenKind::kw_flags);
if (!Flags.has_value())
return std::nullopt;
Params.Flags = Flags;
} else {
consumeNextToken(); // let diagnostic be at the start of invalid token
reportDiag(diag::err_hlsl_invalid_token)
Expand Down Expand Up @@ -1255,6 +1272,50 @@ RootSignatureParser::parseDescriptorRangeFlags(TokenKind Context) {
return Flags;
}

std::optional<llvm::dxbc::StaticSamplerFlags>
RootSignatureParser::parseStaticSamplerFlags(TokenKind Context) {
assert(CurToken.TokKind == TokenKind::pu_equal &&
"Expects to only be invoked starting at given keyword");

// Handle the edge-case of '0' to specify no flags set
if (tryConsumeExpectedToken(TokenKind::int_literal)) {
if (!verifyZeroFlag()) {
reportDiag(diag::err_hlsl_rootsig_non_zero_flag);
return std::nullopt;
}
return llvm::dxbc::StaticSamplerFlags::None;
}

TokenKind Expected[] = {
#define STATIC_SAMPLER_FLAG_ENUM(NAME, LIT) TokenKind::en_##NAME,
#include "clang/Lex/HLSLRootSignatureTokenKinds.def"
};

std::optional<llvm::dxbc::StaticSamplerFlags> Flags;

do {
if (tryConsumeExpectedToken(Expected)) {
switch (CurToken.TokKind) {
#define STATIC_SAMPLER_FLAG_ENUM(NAME, LIT) \
case TokenKind::en_##NAME: \
Flags = maybeOrFlag<llvm::dxbc::StaticSamplerFlags>( \
Flags, llvm::dxbc::StaticSamplerFlags::NAME); \
break;
#include "clang/Lex/HLSLRootSignatureTokenKinds.def"
default:
llvm_unreachable("Switch for consumed enum token was not provided");
}
} else {
consumeNextToken(); // consume token to point at invalid token
reportDiag(diag::err_hlsl_invalid_token)
<< /*value=*/1 << /*value of*/ Context;
return std::nullopt;
}
} while (tryConsumeExpectedToken(TokenKind::pu_or));

return Flags;
}

std::optional<uint32_t> RootSignatureParser::handleUIntLiteral() {
// Parse the numeric value and do semantic checks on its specification
clang::NumericLiteralParser Literal(
Expand Down
5 changes: 3 additions & 2 deletions clang/test/CodeGenHLSL/RootSignature.hlsl
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also update https://github.com/llvm/llvm-project/blob/main/clang/test/AST/HLSL/RootSignatures-AST.hlsl to ensure the flags field is generated in the ast

Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ void RootDescriptorsEntry() {}
// checking minLOD, maxLOD
// CHECK-SAME: float -1.280000e+02, float 1.280000e+02,

// checking register, space and visibility
// CHECK-SAME: i32 42, i32 0, i32 0}
// checking register, space, visibility and flag
// CHECK-SAME: i32 42, i32 0, i32 0, i32 1}

#define SampleStaticSampler \
"StaticSampler(s42, " \
Expand All @@ -96,6 +96,7 @@ void RootDescriptorsEntry() {}
" borderColor = STATIC_BORDER_COLOR_OPAQUE_WHITE, " \
" minLOD = -128.f, maxLOD = 128.f, " \
" space = 0, visibility = SHADER_VISIBILITY_ALL, " \
" flags = UINT_BORDER_COLOR" \
")"
[shader("compute"), RootSignature(SampleStaticSampler)]
[numthreads(1,1,1)]
Expand Down
3 changes: 3 additions & 0 deletions clang/unittests/Lex/LexHLSLRootSignatureTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,9 @@ TEST_F(LexHLSLRootSignatureTest, ValidLexAllTokensTest) {
STATIC_BORDER_COLOR_OPAQUE_WHITE
STATIC_BORDER_COLOR_OPAQUE_BLACK_UINT
STATIC_BORDER_COLOR_OPAQUE_WHITE_UINT
UINT_BORDER_COLOR
NON_NORMALIZED_COORDINATES
)cc";
hlsl::RootSignatureLexer Lexer(Source);

Expand Down
34 changes: 33 additions & 1 deletion clang/unittests/Parse/ParseHLSLRootSignatureTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,8 @@ TEST_F(ParseHLSLRootSignatureTest, ValidParseStaticSamplerTest) {
filter = FILTER_MAXIMUM_MIN_POINT_MAG_LINEAR_MIP_POINT,
maxLOD = 9000, addressU = TEXTURE_ADDRESS_MIRROR,
comparisonFunc = COMPARISON_NOT_EQUAL,
borderColor = STATIC_BORDER_COLOR_OPAQUE_BLACK_UINT
borderColor = STATIC_BORDER_COLOR_OPAQUE_BLACK_UINT,
flags = 0
)
)cc";

Expand Down Expand Up @@ -336,6 +337,37 @@ TEST_F(ParseHLSLRootSignatureTest, ValidParseStaticSamplerTest) {
ASSERT_TRUE(Consumer->isSatisfied());
}

TEST_F(ParseHLSLRootSignatureTest, ValidStaticSamplerFlagsTest) {
const llvm::StringLiteral Source = R"cc(
StaticSampler(s0, flags = UINT_BORDER_COLOR | NON_NORMALIZED_COORDINATES)
)cc";

auto Ctx = createMinimalASTContext();
StringLiteral *Signature = wrapSource(Ctx, Source);

TrivialModuleLoader ModLoader;
auto PP = createPP(Source, ModLoader);

hlsl::RootSignatureParser Parser(RootSignatureVersion::V1_1, Signature, *PP);

// Test no diagnostics produced
Consumer->setNoDiag();

ASSERT_FALSE(Parser.parse());

auto Elements = Parser.getElements();
ASSERT_EQ(Elements.size(), 1u);

RootElement Elem = Elements[0].getElement();
ASSERT_TRUE(std::holds_alternative<StaticSampler>(Elem));
auto ValidStaticSamplerFlags =
llvm::dxbc::StaticSamplerFlags::NonNormalizedCoordinates |
llvm::dxbc::StaticSamplerFlags::UintBorderColor;
ASSERT_EQ(std::get<StaticSampler>(Elem).Flags, ValidStaticSamplerFlags);

ASSERT_TRUE(Consumer->isSatisfied());
}

TEST_F(ParseHLSLRootSignatureTest, ValidParseFloatsTest) {
const llvm::StringLiteral Source = R"cc(
StaticSampler(s0, mipLODBias = 0),
Expand Down
24 changes: 24 additions & 0 deletions llvm/include/llvm/BinaryFormat/DXContainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,15 @@ enum class DescriptorRangeFlags : uint32_t {

LLVM_ABI ArrayRef<EnumEntry<DescriptorRangeFlags>> getDescriptorRangeFlags();

#define STATIC_SAMPLER_FLAG(Num, Enum, Flag) Enum = Num,
enum class StaticSamplerFlags : uint32_t {
#include "DXContainerConstants.def"

LLVM_MARK_AS_BITMASK_ENUM(NonNormalizedCoordinates)
};

LLVM_ABI ArrayRef<EnumEntry<StaticSamplerFlags>> getStaticSamplerFlags();

#define ROOT_PARAMETER(Val, Enum) Enum = Val,
enum class RootParameterType : uint32_t {
#include "DXContainerConstants.def"
Expand Down Expand Up @@ -813,6 +822,21 @@ struct DescriptorRange {
}
};
} // namespace v2
namespace v3 {
struct StaticSampler : public v1::StaticSampler {
uint32_t Flags;

StaticSampler() = default;
explicit StaticSampler(v1::StaticSampler &Base)
: v1::StaticSampler(Base), Flags(0U) {}

void swapBytes() {
v1::StaticSampler::swapBytes();
sys::swapByteOrder(Flags);
}
};

} // namespace v3
} // namespace RTS0

// D3D_ROOT_SIGNATURE_VERSION
Expand Down
10 changes: 10 additions & 0 deletions llvm/include/llvm/BinaryFormat/DXContainerConstants.def
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,16 @@ DESCRIPTOR_RANGE_FLAG(0x10000, DescriptorsStaticKeepingBufferBoundsChecks, DESCR
#undef DESCRIPTOR_RANGE_FLAG
#endif // DESCRIPTOR_RANGE_FLAG

// STATIC_SAMPLER_FLAG(flag value, name, flag).
#ifdef STATIC_SAMPLER_FLAG

STATIC_SAMPLER_FLAG(0x0, None, SAMPLER_FLAG_NONE)
STATIC_SAMPLER_FLAG(0x1, UintBorderColor, SAMPLER_FLAG_UINT_BORDER_COLOR)
STATIC_SAMPLER_FLAG(0x2, NonNormalizedCoordinates, SAMPLER_FLAG_NON_NORMALIZED_COORDINATES)

#undef STATIC_SAMPLER_FLAG
#endif // STATIC_SAMPLER_FLAG

#ifdef ROOT_PARAMETER

ROOT_PARAMETER(0, DescriptorTable)
Expand Down
1 change: 1 addition & 0 deletions llvm/include/llvm/Frontend/HLSL/HLSLRootSignature.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ struct StaticSampler {
float MaxLOD = std::numeric_limits<float>::max();
uint32_t Space = 0;
dxbc::ShaderVisibility Visibility = dxbc::ShaderVisibility::All;
dxbc::StaticSamplerFlags Flags = dxbc::StaticSamplerFlags::None;
};

/// Models RootElement : RootFlags | RootConstants | RootParam
Expand Down
1 change: 1 addition & 0 deletions llvm/include/llvm/MC/DXContainerRootSignature.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ struct StaticSampler {
uint32_t ShaderRegister;
uint32_t RegisterSpace;
dxbc::ShaderVisibility ShaderVisibility;
uint32_t Flags;
};

struct RootParametersContainer {
Expand Down
4 changes: 2 additions & 2 deletions llvm/include/llvm/Object/DXContainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,11 @@ class RootSignature {
uint32_t Flags;
ViewArray<dxbc::RTS0::v1::RootParameterHeader> ParametersHeaders;
StringRef PartData;
ViewArray<dxbc::RTS0::v1::StaticSampler> StaticSamplers;
ViewArray<dxbc::RTS0::v3::StaticSampler> StaticSamplers;

using param_header_iterator =
ViewArray<dxbc::RTS0::v1::RootParameterHeader>::iterator;
using samplers_iterator = ViewArray<dxbc::RTS0::v1::StaticSampler>::iterator;
using samplers_iterator = ViewArray<dxbc::RTS0::v3::StaticSampler>::iterator;

public:
RootSignature(StringRef PD) : PartData(PD) {}
Expand Down
5 changes: 5 additions & 0 deletions llvm/include/llvm/ObjectYAML/DXContainerYAML.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@ struct StaticSamplerYamlDesc {
uint32_t ShaderRegister;
uint32_t RegisterSpace;
dxbc::ShaderVisibility ShaderVisibility;

LLVM_ABI uint32_t getEncodedFlags() const;

#define STATIC_SAMPLER_FLAG(Num, Enum, Flag) bool Enum = false;
#include "llvm/BinaryFormat/DXContainerConstants.def"
};

struct RootSignatureYamlDesc {
Expand Down
9 changes: 9 additions & 0 deletions llvm/lib/BinaryFormat/DXContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@ ArrayRef<EnumEntry<DescriptorRangeFlags>> dxbc::getDescriptorRangeFlags() {
return ArrayRef(DescriptorRangeFlagNames);
}

static const EnumEntry<StaticSamplerFlags> StaticSamplerFlagNames[] = {
#define STATIC_SAMPLER_FLAG(Val, Enum, Flag) {#Enum, StaticSamplerFlags::Enum},
#include "llvm/BinaryFormat/DXContainerConstants.def"
};

ArrayRef<EnumEntry<StaticSamplerFlags>> dxbc::getStaticSamplerFlags() {
return ArrayRef(StaticSamplerFlagNames);
}

#define SHADER_VISIBILITY(Val, Enum) {#Enum, ShaderVisibility::Enum},

static const EnumEntry<ShaderVisibility> ShaderVisibilityValues[] = {
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Frontend/HLSL/HLSLRootSignature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ raw_ostream &operator<<(raw_ostream &OS, const StaticSampler &Sampler) {
<< ", borderColor = " << Sampler.BorderColor
<< ", minLOD = " << Sampler.MinLOD << ", maxLOD = " << Sampler.MaxLOD
<< ", space = " << Sampler.Space << ", visibility = " << Sampler.Visibility
<< ")";
<< ", flags = " << Sampler.Flags << ")";
return OS;
}

Expand Down
1 change: 1 addition & 0 deletions llvm/lib/Frontend/HLSL/RootSignatureMetadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ MDNode *MetadataBuilder::BuildStaticSampler(const StaticSampler &Sampler) {
ConstantAsMetadata::get(Builder.getInt32(Sampler.Space)),
ConstantAsMetadata::get(
Builder.getInt32(to_underlying(Sampler.Visibility))),
ConstantAsMetadata::get(Builder.getInt32(to_underlying(Sampler.Flags))),
};
return MDNode::get(Ctx, Operands);
}
Expand Down
4 changes: 3 additions & 1 deletion llvm/lib/Frontend/HLSL/RootSignatureValidations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ namespace rootsig {

bool verifyRootFlag(uint32_t Flags) { return (Flags & ~0xfff) == 0; }

bool verifyVersion(uint32_t Version) { return (Version == 1 || Version == 2); }
bool verifyVersion(uint32_t Version) {
return (Version == 1 || Version == 2 || Version == 3);
}

bool verifyRegisterValue(uint32_t RegisterValue) {
return RegisterValue != ~0U;
Expand Down
7 changes: 6 additions & 1 deletion llvm/lib/MC/DXContainerRootSignature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ static uint32_t rewriteOffsetToCurrentByte(raw_svector_ostream &Stream,
size_t RootSignatureDesc::getSize() const {
uint32_t StaticSamplersOffset = computeStaticSamplersOffset();
size_t StaticSamplersSize =
StaticSamplers.size() * sizeof(dxbc::RTS0::v1::StaticSampler);
(Version > 2 ? sizeof(dxbc::RTS0::v3::StaticSampler)
: sizeof(dxbc::RTS0::v1::StaticSampler)) *
StaticSamplers.size();

return size_t(StaticSamplersOffset) + StaticSamplersSize;
}
Expand Down Expand Up @@ -171,6 +173,9 @@ void RootSignatureDesc::write(raw_ostream &OS) const {
support::endian::write(BOS, S.ShaderRegister, llvm::endianness::little);
support::endian::write(BOS, S.RegisterSpace, llvm::endianness::little);
support::endian::write(BOS, S.ShaderVisibility, llvm::endianness::little);

if (Version > 2)
support::endian::write(BOS, S.Flags, llvm::endianness::little);
}
assert(Storage.size() == getSize());
OS.write(Storage.data(), Storage.size());
Expand Down
11 changes: 7 additions & 4 deletions llvm/lib/Object/DXContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,13 @@ Error DirectX::RootSignature::parse() {
RootParametersOffset,
NumParameters * sizeof(dxbc::RTS0::v1::RootParameterHeader));

StaticSamplers.Stride = sizeof(dxbc::RTS0::v1::StaticSampler);
StaticSamplers.Data = PartData.substr(
StaticSamplersOffset,
NumStaticSamplers * sizeof(dxbc::RTS0::v1::StaticSampler));
StaticSamplers.Stride = (Version <= 2)
? sizeof(dxbc::RTS0::v1::StaticSampler)
: sizeof(dxbc::RTS0::v3::StaticSampler);

StaticSamplers.Data = PartData.substr(StaticSamplersOffset,
static_cast<size_t>(NumStaticSamplers) *
StaticSamplers.Stride);

return Error::success();
}
Expand Down
3 changes: 3 additions & 0 deletions llvm/lib/ObjectYAML/DXContainerEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,9 @@ Error DXContainerWriter::writeParts(raw_ostream &OS) {
NewSampler.RegisterSpace = Param.RegisterSpace;
NewSampler.ShaderVisibility = Param.ShaderVisibility;

if (RS.Version > 2)
NewSampler.Flags = Param.getEncodedFlags();

RS.StaticSamplers.push_back(NewSampler);
}

Expand Down
Loading