Skip to content
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
33 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
6b191d0
adding metadata static sampler flags
joaosaffran Sep 22, 2025
cc05d4d
adding default flag to frontend root signature
joaosaffran Sep 24, 2025
f02d18e
address suggestion from inbelic
joaosaffran Sep 24, 2025
ddf9945
changing size and remove untested parameters
joaosaffran Sep 24, 2025
284901c
adding suggested comment
joaosaffran Sep 24, 2025
73e6bb5
addressing inbelic comments
joaosaffran Sep 24, 2025
159cd57
addressing inbelic comments
joaosaffran Sep 24, 2025
ae969d4
updating test to account all flags and remove unecessary metadata gen…
joaosaffran Sep 24, 2025
b7f07aa
format
joaosaffran Sep 24, 2025
c25fee8
format
joaosaffran Sep 24, 2025
b5ecf7f
Merge branch 'obj2yaml/root-signature-1.2' into obj2yaml/static-sampl…
joaosaffran Sep 25, 2025
6187125
Merge branch 'obj2yaml/static-sampler-view' into metadata/rootsignatu…
joaosaffran Sep 25, 2025
8d017fa
adding test to check flags
joaosaffran Sep 26, 2025
efcd873
remove test
joaosaffran Sep 26, 2025
9c2c1d3
Merge branch 'obj2yaml/root-signature-1.2' into obj2yaml/static-sampl…
joaosaffran Sep 26, 2025
97e733b
Merge branch 'obj2yaml/static-sampler-view' into metadata/rootsignatu…
joaosaffran Sep 26, 2025
0796e45
Merge branch 'main' into metadata/rootsignature1.2
joaosaffran Sep 26, 2025
066c113
adding default sampler
joaosaffran Sep 26, 2025
f38b4c3
fix
joaosaffran Sep 26, 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
4 changes: 2 additions & 2 deletions clang/test/CodeGenHLSL/RootSignature.hlsl
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 flags
// CHECK-SAME: i32 42, i32 0, i32 0, i32 0}

#define SampleStaticSampler \
"StaticSampler(s42, " \
Expand Down
25 changes: 25 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,22 @@ 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
2 changes: 2 additions & 0 deletions llvm/include/llvm/Frontend/HLSL/RootSignatureValidations.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ LLVM_ABI bool verifyRangeType(uint32_t Type);
LLVM_ABI bool verifyDescriptorRangeFlag(uint32_t Version,
dxil::ResourceClass Type,
dxbc::DescriptorRangeFlags FlagsVal);
LLVM_ABI bool verifyStaticSamplerFlags(uint32_t Version,
dxbc::StaticSamplerFlags Flags);
LLVM_ABI bool verifyNumDescriptors(uint32_t NumDescriptors);
LLVM_ABI bool verifyMipLODBias(float MipLODBias);
LLVM_ABI bool verifyMaxAnisotropy(uint32_t MaxAnisotropy);
Expand Down
2 changes: 2 additions & 0 deletions llvm/include/llvm/MC/DXContainerRootSignature.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ struct StaticSampler {
uint32_t ShaderRegister;
uint32_t RegisterSpace;
dxbc::ShaderVisibility ShaderVisibility;
// Version 3 onwards:
uint32_t Flags = 0;
};

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
22 changes: 20 additions & 2 deletions llvm/lib/Frontend/HLSL/RootSignatureMetadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +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(0))};
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a temporary fix, I am working on the frontend changes in a different PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

Note: we should probably stack the frontend changes to go in before this so that we avoid this temporary state

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think that merge with this temporary fix is better. Since, if we update the frontend first, it is going to break the backend, since it still expect StaticSampler MD Nodes to contain 14 values and not 15. @bogner what do you think is the best direction here?

Copy link
Contributor

@bogner bogner Sep 26, 2025

Choose a reason for hiding this comment

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

There are a few ways to stage this, but I agree that if we're doing either the backend or the frontend first we run into similar problems. However, I do share @inbelic's concern that this is a bit of an awkward temporary state.

It might be worthwhile to just wire up enough of the frontend in this PR that it's explicitly writing out the empty flags. That is, update the StaticSampler definition to include the flags now, but just initialize it to zero in the frontend. This way the metadata stays consistent between the frontend and the backend.

Either way, this deserves a comment in the code saying what's going on.

return MDNode::get(Ctx, Operands);
}

Expand Down Expand Up @@ -411,7 +411,7 @@ Error MetadataParser::parseDescriptorTable(mcdxbc::RootSignatureDesc &RSD,

Error MetadataParser::parseStaticSampler(mcdxbc::RootSignatureDesc &RSD,
MDNode *StaticSamplerNode) {
if (StaticSamplerNode->getNumOperands() != 14)
if (StaticSamplerNode->getNumOperands() != 15)
return make_error<InvalidRSMetadataFormat>("Static Sampler");

mcdxbc::StaticSampler Sampler;
Expand Down Expand Up @@ -495,6 +495,17 @@ Error MetadataParser::parseStaticSampler(mcdxbc::RootSignatureDesc &RSD,
return Error(std::move(E));
Sampler.ShaderVisibility = *Visibility;

if (RSD.Version < 3) {
RSD.StaticSamplers.push_back(Sampler);
return Error::success();
}
assert(RSD.Version >= 3);
Comment on lines +505 to +509
Copy link
Contributor

Choose a reason for hiding this comment

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

The metadata always has a value now, so this early exit isn't necessary

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The metadata always had a value, this version exists just to ignore it if we are using the incorrect version and prevent the Flags to be set in the wrong version. We did the same logic for other flags that got added in different versions, like Root Descriptor

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As per our offline discussion, I've filed an issue to throw an error when we notice the flags are being set in an unsupported version: #161579


if (std::optional<uint32_t> Val = extractMdIntValue(StaticSamplerNode, 14))
Sampler.Flags = *Val;
else
return make_error<InvalidRSMetadataValue>("Static Sampler Flags");

RSD.StaticSamplers.push_back(Sampler);
return Error::success();
}
Expand Down Expand Up @@ -651,6 +662,13 @@ Error MetadataParser::validateRootSignature(
joinErrors(std::move(DeferredErrs),
make_error<RootSignatureValidationError<uint32_t>>(
"RegisterSpace", Sampler.RegisterSpace));

if (!hlsl::rootsig::verifyStaticSamplerFlags(
RSD.Version, dxbc::StaticSamplerFlags(Sampler.Flags)))
DeferredErrs =
joinErrors(std::move(DeferredErrs),
make_error<RootSignatureValidationError<uint32_t>>(
"Static Sampler Flag", Sampler.Flags));
}

return DeferredErrs;
Expand Down
19 changes: 18 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 Expand Up @@ -111,6 +113,21 @@ bool verifyDescriptorRangeFlag(uint32_t Version, dxil::ResourceClass Type,
return (Flags & ~Mask) == FlagT::None;
}

bool verifyStaticSamplerFlags(uint32_t Version,
dxbc::StaticSamplerFlags Flags) {

if (Version <= 2)
return Flags == dxbc::StaticSamplerFlags::None;

assert(Version == 3 && "Provided invalid root signature version");

dxbc::StaticSamplerFlags Mask =
dxbc::StaticSamplerFlags::NonNormalizedCoordinates |
dxbc::StaticSamplerFlags::UintBorderColor |
dxbc::StaticSamplerFlags::None;
return (Flags | Mask) == Mask;
}

bool verifyNumDescriptors(uint32_t NumDescriptors) {
return NumDescriptors > 0;
}
Expand Down
11 changes: 8 additions & 3 deletions llvm/lib/MC/DXContainerRootSignature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ 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);
size_t StaticSamplersSize = sizeof(dxbc::RTS0::v1::StaticSampler);
if (Version > 2)
StaticSamplersSize = sizeof(dxbc::RTS0::v3::StaticSampler);

return size_t(StaticSamplersOffset) + StaticSamplersSize;
return size_t(StaticSamplersOffset) +
(StaticSamplersSize * StaticSamplers.size());
}

uint32_t RootSignatureDesc::computeRootParametersOffset() const {
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
17 changes: 17 additions & 0 deletions llvm/lib/ObjectYAML/DXContainerYAML.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,11 @@ DXContainerYAML::RootSignatureYamlDesc::create(
NewS.RegisterSpace = S.RegisterSpace;
NewS.ShaderVisibility = dxbc::ShaderVisibility(S.ShaderVisibility);

if (Version > 2) {
#define STATIC_SAMPLER_FLAG(Num, Enum, Flag) \
NewS.Enum = (S.Flags & llvm::to_underlying(dxbc::StaticSamplerFlags::Enum));
#include "llvm/BinaryFormat/DXContainerConstants.def"
}
RootSigDesc.StaticSamplers.push_back(NewS);
}

Expand Down Expand Up @@ -245,6 +250,15 @@ uint32_t DXContainerYAML::DescriptorRangeYaml::getEncodedFlags() const {
return Flags;
}

uint32_t DXContainerYAML::StaticSamplerYamlDesc::getEncodedFlags() const {
uint64_t Flags = 0;
#define STATIC_SAMPLER_FLAG(Num, Enum, Flag) \
if (Enum) \
Flags |= (uint32_t)dxbc::StaticSamplerFlags::Enum;
#include "llvm/BinaryFormat/DXContainerConstants.def"
return Flags;
}

uint64_t DXContainerYAML::ShaderFeatureFlags::getEncodedFlags() {
uint64_t Flag = 0;
#define SHADER_FEATURE_FLAG(Num, DxilModuleNum, Val, Str) \
Expand Down Expand Up @@ -512,6 +526,9 @@ void MappingTraits<llvm::DXContainerYAML::StaticSamplerYamlDesc>::mapping(
IO.mapRequired("ShaderRegister", S.ShaderRegister);
IO.mapRequired("RegisterSpace", S.RegisterSpace);
IO.mapRequired("ShaderVisibility", S.ShaderVisibility);
#define STATIC_SAMPLER_FLAG(Num, Enum, Flag) \
IO.mapOptional(#Flag, S.Enum, false);
#include "llvm/BinaryFormat/DXContainerConstants.def"
}

void MappingTraits<DXContainerYAML::Part>::mapping(IO &IO,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
; RUN: not opt -passes='print<dxil-root-signature>' %s -S -o - 2>&1 | FileCheck %s

target triple = "dxil-unknown-shadermodel6.0-compute"


; CHECK: error: Invalid value for Version: 4
; CHECK-NOT: Root Signature Definitions
define void @main() #0 {
entry:
ret void
}
attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }


!dx.rootsignatures = !{!2, !3, !4, !5} ; list of function/root signature pairs
!2 = !{ ptr @main, !6, i32 1 } ; function, root signature
!3 = !{ ptr @main, !6, i32 4 } ; function, root signature
!4 = !{ ptr @main, !6, i32 2 } ; function, root signature
!5 = !{ ptr @main, !6, i32 3 } ; function, root signature
!6 = !{ } ; list of root signature elements
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }
!dx.rootsignatures = !{!2} ; list of function/root signature pairs
!2 = !{ ptr @main, !3, i32 2 } ; function, root signature
!3 = !{ !5 } ; list of root signature elements
!5 = !{ !"StaticSampler", i32 4, i32 666, i32 3, i32 5, float 0x3FF6CCCCC0000000, i32 9, i32 3, i32 2, float -1.280000e+02, float 1.280000e+02, i32 42, i32 0, i32 0 }
!5 = !{ !"StaticSampler", i32 4, i32 666, i32 3, i32 5, float 0x3FF6CCCCC0000000, i32 9, i32 3, i32 2, float -1.280000e+02, float 1.280000e+02, i32 42, i32 0, i32 0, i32 0 }
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }
!dx.rootsignatures = !{!2} ; list of function/root signature pairs
!2 = !{ ptr @main, !3, i32 2 } ; function, root signature
!3 = !{ !5 } ; list of root signature elements
!5 = !{ !"StaticSampler", i32 4, i32 2, i32 666, i32 5, float 0x3FF6CCCCC0000000, i32 9, i32 3, i32 2, float -1.280000e+02, float 1.280000e+02, i32 42, i32 0, i32 0 }
!5 = !{ !"StaticSampler", i32 4, i32 2, i32 666, i32 5, float 0x3FF6CCCCC0000000, i32 9, i32 3, i32 2, float -1.280000e+02, float 1.280000e+02, i32 42, i32 0, i32 0, i32 0 }
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }
!dx.rootsignatures = !{!2} ; list of function/root signature pairs
!2 = !{ ptr @main, !3, i32 2 } ; function, root signature
!3 = !{ !5 } ; list of root signature elements
!5 = !{ !"StaticSampler", i32 4, i32 2, i32 3, i32 666, float 0x3FF6CCCCC0000000, i32 9, i32 3, i32 2, float -1.280000e+02, float 1.280000e+02, i32 42, i32 0, i32 0 }
!5 = !{ !"StaticSampler", i32 4, i32 2, i32 3, i32 666, float 0x3FF6CCCCC0000000, i32 9, i32 3, i32 2, float -1.280000e+02, float 1.280000e+02, i32 42, i32 0, i32 0, i32 0 }
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }
!dx.rootsignatures = !{!2} ; list of function/root signature pairs
!2 = !{ ptr @main, !3, i32 2 } ; function, root signature
!3 = !{ !5 } ; list of root signature elements
!5 = !{ !"StaticSampler", i32 4, i32 2, i32 3, i32 5, float 0x3FF6CCCCC0000000, i32 9, i32 3, i32 666, float -1.280000e+02, float 1.280000e+02, i32 42, i32 0, i32 0 }
!5 = !{ !"StaticSampler", i32 4, i32 2, i32 3, i32 5, float 0x3FF6CCCCC0000000, i32 9, i32 3, i32 666, float -1.280000e+02, float 1.280000e+02, i32 42, i32 0, i32 0, i32 0 }
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }
!dx.rootsignatures = !{!2} ; list of function/root signature pairs
!2 = !{ ptr @main, !3, i32 2 } ; function, root signature
!3 = !{ !5 } ; list of root signature elements
!5 = !{ !"StaticSampler", i32 4, i32 2, i32 3, i32 5, float 0x3FF6CCCCC0000000, i32 9, i32 666, i32 2, float -1.280000e+02, float 1.280000e+02, i32 42, i32 0, i32 0 }
!5 = !{ !"StaticSampler", i32 4, i32 2, i32 3, i32 5, float 0x3FF6CCCCC0000000, i32 9, i32 666, i32 2, float -1.280000e+02, float 1.280000e+02, i32 42, i32 0, i32 0, i32 0 }
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }
!dx.rootsignatures = !{!2} ; list of function/root signature pairs
!2 = !{ ptr @main, !3, i32 2 } ; function, root signature
!3 = !{ !5 } ; list of root signature elements
!5 = !{ !"StaticSampler", i32 45, i32 2, i32 3, i32 5, float 0x3FF6CCCCC0000000, i32 9, i32 3, i32 2, float -1.280000e+02, float 1.280000e+02, i32 42, i32 0, i32 0 }
!5 = !{ !"StaticSampler", i32 45, i32 2, i32 3, i32 5, float 0x3FF6CCCCC0000000, i32 9, i32 3, i32 2, float -1.280000e+02, float 1.280000e+02, i32 42, i32 0, i32 0, i32 0 }
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
; RUN: not opt -passes='print<dxil-root-signature>' %s -S -o - 2>&1 | FileCheck %s


target triple = "dxil-unknown-shadermodel6.0-compute"

; CHECK: error: Invalid value for ShaderVisibility: 666
; CHECK-NOT: Root Signature Definitions

define void @main() #0 {
entry:
ret void
}
attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }


!dx.rootsignatures = !{!2} ; list of function/root signature pairs
!2 = !{ ptr @main, !3, i32 2 } ; function, root signature
!3 = !{ !5 } ; list of root signature elements
!5 = !{ !"StaticSampler", i32 4, i32 2, i32 3, i32 5, float 0x3FF6CCCCC0000000, i32 9, i32 3, i32 2, float -1.280000e+02, float 1.280000e+02, i32 42, i32 0, i32 666 }
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }
!dx.rootsignatures = !{!2} ; list of function/root signature pairs
!2 = !{ ptr @main, !3, i32 2 } ; function, root signature
!3 = !{ !5 } ; list of root signature elements
!5 = !{ !"StaticSampler", i32 4, i32 2, i32 3, i32 5, float 0x3FF6CCCCC0000000, i32 666, i32 3, i32 2, float -1.280000e+02, float 1.280000e+02, i32 42, i32 0, i32 0 }
!5 = !{ !"StaticSampler", i32 4, i32 2, i32 3, i32 5, float 0x3FF6CCCCC0000000, i32 666, i32 3, i32 2, float -1.280000e+02, float 1.280000e+02, i32 42, i32 0, i32 0, i32 0 }
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }
!dx.rootsignatures = !{!2} ; list of function/root signature pairs
!2 = !{ ptr @main, !3, i32 2 } ; function, root signature
!3 = !{ !5 } ; list of root signature elements
!5 = !{ !"StaticSampler", i32 4, i32 2, i32 3, i32 5, float 0x3FF6CCCCC0000000, i32 9, i32 3, i32 2, float -1.280000e+02, float 0x7FF8000000000000, i32 42, i32 0, i32 0 }
!5 = !{ !"StaticSampler", i32 4, i32 2, i32 3, i32 5, float 0x3FF6CCCCC0000000, i32 9, i32 3, i32 2, float -1.280000e+02, float 0x7FF8000000000000, i32 42, i32 0, i32 0, i32 0 }
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }
!dx.rootsignatures = !{!2} ; list of function/root signature pairs
!2 = !{ ptr @main, !3, i32 2 } ; function, root signature
!3 = !{ !5 } ; list of root signature elements
!5 = !{ !"StaticSampler", i32 4, i32 2, i32 3, i32 5, float 0x3FF6CCCCC0000000, i32 9, i32 3, i32 2, float 0x7FF8000000000000, float 1.280000e+02, i32 42, i32 0, i32 0 }
!5 = !{ !"StaticSampler", i32 4, i32 2, i32 3, i32 5, float 0x3FF6CCCCC0000000, i32 9, i32 3, i32 2, float 0x7FF8000000000000, float 1.280000e+02, i32 42, i32 0, i32 0, i32 0 }
Loading