-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[DirectX] Updating Root Signature YAML representation to use Enums instead of uint #154827
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DirectX] Updating Root Signature YAML representation to use Enums instead of uint #154827
Conversation
This reverts commit 8c143ba.
@llvm/pr-subscribers-llvm-support @llvm/pr-subscribers-backend-directx Author: None (joaosaffran) ChangesThis PR is updating Root Signature YAML to use enums, this is a required change to remove the use of to_underlying from DirectXContainer binary file. Patch is 42.06 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/154827.diff 18 Files Affected:
diff --git a/llvm/include/llvm/ObjectYAML/DXContainerYAML.h b/llvm/include/llvm/ObjectYAML/DXContainerYAML.h
index 7e0a4c6b07039..add9937717e25 100644
--- a/llvm/include/llvm/ObjectYAML/DXContainerYAML.h
+++ b/llvm/include/llvm/ObjectYAML/DXContainerYAML.h
@@ -92,7 +92,7 @@ struct RootDescriptorYaml {
};
struct DescriptorRangeYaml {
- uint32_t RangeType;
+ dxbc::DescriptorRangeType RangeType;
uint32_t NumDescriptors;
uint32_t BaseShaderRegister;
uint32_t RegisterSpace;
@@ -111,12 +111,12 @@ struct DescriptorTableYaml {
};
struct RootParameterHeaderYaml {
- uint32_t Type;
- uint32_t Visibility;
+ dxbc::RootParameterType Type;
+ dxbc::ShaderVisibility Visibility;
uint32_t Offset;
RootParameterHeaderYaml(){};
- RootParameterHeaderYaml(uint32_t T) : Type(T) {}
+ RootParameterHeaderYaml(dxbc::RootParameterType T) : Type(T) {}
};
struct RootParameterLocationYaml {
@@ -165,21 +165,19 @@ struct RootParameterYamlDesc {
};
struct StaticSamplerYamlDesc {
- uint32_t Filter = llvm::to_underlying(dxbc::SamplerFilter::Anisotropic);
- uint32_t AddressU = llvm::to_underlying(dxbc::TextureAddressMode::Wrap);
- uint32_t AddressV = llvm::to_underlying(dxbc::TextureAddressMode::Wrap);
- uint32_t AddressW = llvm::to_underlying(dxbc::TextureAddressMode::Wrap);
+ dxbc::SamplerFilter Filter = dxbc::SamplerFilter::Anisotropic;
+ dxbc::TextureAddressMode AddressU = dxbc::TextureAddressMode::Wrap;
+ dxbc::TextureAddressMode AddressV = dxbc::TextureAddressMode::Wrap;
+ dxbc::TextureAddressMode AddressW = dxbc::TextureAddressMode::Wrap;
float MipLODBias = 0.f;
uint32_t MaxAnisotropy = 16u;
- uint32_t ComparisonFunc =
- llvm::to_underlying(dxbc::ComparisonFunc::LessEqual);
- uint32_t BorderColor =
- llvm::to_underlying(dxbc::StaticBorderColor::OpaqueWhite);
+ dxbc::ComparisonFunc ComparisonFunc = dxbc::ComparisonFunc::LessEqual;
+ dxbc::StaticBorderColor BorderColor = dxbc::StaticBorderColor::OpaqueWhite;
float MinLOD = 0.f;
float MaxLOD = std::numeric_limits<float>::max();
uint32_t ShaderRegister;
uint32_t RegisterSpace;
- uint32_t ShaderVisibility;
+ dxbc::ShaderVisibility ShaderVisibility;
};
struct RootSignatureYamlDesc {
@@ -321,6 +319,13 @@ LLVM_YAML_DECLARE_ENUM_TRAITS(llvm::dxbc::PSV::ResourceKind)
LLVM_YAML_DECLARE_ENUM_TRAITS(llvm::dxbc::D3DSystemValue)
LLVM_YAML_DECLARE_ENUM_TRAITS(llvm::dxbc::SigComponentType)
LLVM_YAML_DECLARE_ENUM_TRAITS(llvm::dxbc::SigMinPrecision)
+LLVM_YAML_DECLARE_ENUM_TRAITS(llvm::dxbc::RootParameterType)
+LLVM_YAML_DECLARE_ENUM_TRAITS(llvm::dxbc::DescriptorRangeType)
+LLVM_YAML_DECLARE_ENUM_TRAITS(llvm::dxbc::SamplerFilter)
+LLVM_YAML_DECLARE_ENUM_TRAITS(llvm::dxbc::StaticBorderColor)
+LLVM_YAML_DECLARE_ENUM_TRAITS(llvm::dxbc::TextureAddressMode)
+LLVM_YAML_DECLARE_ENUM_TRAITS(llvm::dxbc::ShaderVisibility)
+LLVM_YAML_DECLARE_ENUM_TRAITS(llvm::dxbc::ComparisonFunc)
namespace llvm {
diff --git a/llvm/lib/ObjectYAML/DXContainerEmitter.cpp b/llvm/lib/ObjectYAML/DXContainerEmitter.cpp
index 5a479461b8714..28a21e762c616 100644
--- a/llvm/lib/ObjectYAML/DXContainerEmitter.cpp
+++ b/llvm/lib/ObjectYAML/DXContainerEmitter.cpp
@@ -276,10 +276,6 @@ void DXContainerWriter::writeParts(raw_ostream &OS) {
for (DXContainerYAML::RootParameterLocationYaml &L :
P.RootSignature->Parameters.Locations) {
- assert(dxbc::isValidParameterType(L.Header.Type) &&
- "invalid DXContainer YAML");
- assert(dxbc::isValidShaderVisibility(L.Header.Visibility) &&
- "invalid DXContainer YAML");
dxbc::RootParameterType Type = dxbc::RootParameterType(L.Header.Type);
dxbc::ShaderVisibility Visibility =
dxbc::ShaderVisibility(L.Header.Visibility);
@@ -315,8 +311,6 @@ void DXContainerWriter::writeParts(raw_ostream &OS) {
P.RootSignature->Parameters.getOrInsertTable(L);
mcdxbc::DescriptorTable Table;
for (const auto &R : TableYaml.Ranges) {
- assert(dxbc::isValidRangeType(R.RangeType) &&
- "Invalid Descriptor Range Type");
mcdxbc::DescriptorRange Range;
Range.RangeType = dxbc::DescriptorRangeType(R.RangeType);
Range.NumDescriptors = R.NumDescriptors;
@@ -335,15 +329,6 @@ void DXContainerWriter::writeParts(raw_ostream &OS) {
}
for (const auto &Param : P.RootSignature->samplers()) {
- assert(dxbc::isValidSamplerFilter(Param.Filter) &&
- dxbc::isValidAddress(Param.AddressU) &&
- dxbc::isValidAddress(Param.AddressV) &&
- dxbc::isValidAddress(Param.AddressW) &&
- dxbc::isValidComparisonFunc(Param.ComparisonFunc) &&
- dxbc::isValidBorderColor(Param.BorderColor) &&
- dxbc::isValidShaderVisibility(Param.ShaderVisibility) &&
- "Invalid enum value in static sampler");
-
mcdxbc::StaticSampler NewSampler;
NewSampler.Filter = dxbc::SamplerFilter(Param.Filter);
NewSampler.AddressU = dxbc::TextureAddressMode(Param.AddressU);
diff --git a/llvm/lib/ObjectYAML/DXContainerYAML.cpp b/llvm/lib/ObjectYAML/DXContainerYAML.cpp
index 263f7bdf37bca..e703e34320044 100644
--- a/llvm/lib/ObjectYAML/DXContainerYAML.cpp
+++ b/llvm/lib/ObjectYAML/DXContainerYAML.cpp
@@ -60,7 +60,10 @@ readDescriptorRanges(DXContainerYAML::RootParameterHeaderYaml &Header,
NewR.NumDescriptors = R.NumDescriptors;
NewR.BaseShaderRegister = R.BaseShaderRegister;
NewR.RegisterSpace = R.RegisterSpace;
- NewR.RangeType = R.RangeType;
+ if (!dxbc::isValidRangeType(R.RangeType))
+ return createStringError(std::errc::invalid_argument,
+ "Invalid value for descriptor range type");
+ NewR.RangeType = dxbc::DescriptorRangeType(R.RangeType);
if constexpr (std::is_same_v<T, dxbc::RTS0::v2::DescriptorRange>) {
// Set all flag fields for v2
#define DESCRIPTOR_RANGE_FLAG(Num, Enum, Flag) \
@@ -94,15 +97,14 @@ DXContainerYAML::RootSignatureYamlDesc::create(
return createStringError(std::errc::invalid_argument,
"Invalid value for parameter type");
- RootParameterHeaderYaml Header(PH.ParameterType);
+ RootParameterHeaderYaml Header(dxbc::RootParameterType(PH.ParameterType));
Header.Offset = PH.ParameterOffset;
- Header.Type = PH.ParameterType;
if (!dxbc::isValidShaderVisibility(PH.ShaderVisibility))
return createStringError(std::errc::invalid_argument,
"Invalid value for shader visibility");
- Header.Visibility = PH.ShaderVisibility;
+ Header.Visibility = dxbc::ShaderVisibility(PH.ShaderVisibility);
llvm::Expected<object::DirectX::RootParameterView> ParamViewOrErr =
Data.getParameter(PH);
@@ -162,20 +164,50 @@ DXContainerYAML::RootSignatureYamlDesc::create(
}
for (const auto &S : Data.samplers()) {
+ if (!dxbc::isValidSamplerFilter(S.Filter))
+ return createStringError(std::errc::invalid_argument,
+ "Invalid value for static sampler filter");
+
+ if (!dxbc::isValidAddress(S.AddressU))
+ return createStringError(std::errc::invalid_argument,
+ "Invalid value for static sampler AddressU");
+
+ if (!dxbc::isValidAddress(S.AddressV))
+ return createStringError(std::errc::invalid_argument,
+ "Invalid value for static sampler AddressV");
+
+ if (!dxbc::isValidAddress(S.AddressW))
+ return createStringError(std::errc::invalid_argument,
+ "Invalid value for static sampler AddressW");
+
+ if (!dxbc::isValidComparisonFunc(S.ComparisonFunc))
+ return createStringError(
+ std::errc::invalid_argument,
+ "Invalid value for static sampler ComparisonFunc");
+
+ if (!dxbc::isValidBorderColor(S.BorderColor))
+ return createStringError(std::errc::invalid_argument,
+ "Invalid value for static sampler BorderColor");
+
+ if (!dxbc::isValidShaderVisibility(S.ShaderVisibility))
+ return createStringError(
+ std::errc::invalid_argument,
+ "Invalid value for static sampler ShaderVisibility");
+
StaticSamplerYamlDesc NewS;
- NewS.Filter = S.Filter;
- NewS.AddressU = S.AddressU;
- NewS.AddressV = S.AddressV;
- NewS.AddressW = S.AddressW;
+ NewS.Filter = dxbc::SamplerFilter(S.Filter);
+ NewS.AddressU = dxbc::TextureAddressMode(S.AddressU);
+ NewS.AddressV = dxbc::TextureAddressMode(S.AddressV);
+ NewS.AddressW = dxbc::TextureAddressMode(S.AddressW);
NewS.MipLODBias = S.MipLODBias;
NewS.MaxAnisotropy = S.MaxAnisotropy;
- NewS.ComparisonFunc = S.ComparisonFunc;
- NewS.BorderColor = S.BorderColor;
+ NewS.ComparisonFunc = dxbc::ComparisonFunc(S.ComparisonFunc);
+ NewS.BorderColor = dxbc::StaticBorderColor(S.BorderColor);
NewS.MinLOD = S.MinLOD;
NewS.MaxLOD = S.MaxLOD;
NewS.ShaderRegister = S.ShaderRegister;
NewS.RegisterSpace = S.RegisterSpace;
- NewS.ShaderVisibility = S.ShaderVisibility;
+ NewS.ShaderVisibility = dxbc::ShaderVisibility(S.ShaderVisibility);
RootSigDesc.StaticSamplers.push_back(NewS);
}
@@ -425,21 +457,21 @@ void MappingContextTraits<DXContainerYAML::RootParameterLocationYaml,
IO.mapRequired("ShaderVisibility", L.Header.Visibility);
switch (L.Header.Type) {
- case llvm::to_underlying(dxbc::RootParameterType::Constants32Bit): {
+ case dxbc::RootParameterType::Constants32Bit: {
DXContainerYAML::RootConstantsYaml &Constants =
S.Parameters.getOrInsertConstants(L);
IO.mapRequired("Constants", Constants);
break;
}
- case llvm::to_underlying(dxbc::RootParameterType::CBV):
- case llvm::to_underlying(dxbc::RootParameterType::SRV):
- case llvm::to_underlying(dxbc::RootParameterType::UAV): {
+ case dxbc::RootParameterType::CBV:
+ case dxbc::RootParameterType::SRV:
+ case dxbc::RootParameterType::UAV: {
DXContainerYAML::RootDescriptorYaml &Descriptor =
S.Parameters.getOrInsertDescriptor(L);
IO.mapRequired("Descriptor", Descriptor);
break;
}
- case llvm::to_underlying(dxbc::RootParameterType::DescriptorTable): {
+ case dxbc::RootParameterType::DescriptorTable: {
DXContainerYAML::DescriptorTableYaml &Table =
S.Parameters.getOrInsertTable(L);
IO.mapRequired("Table", Table);
@@ -585,6 +617,48 @@ void ScalarEnumerationTraits<dxbc::SigComponentType>::enumeration(
IO.enumCase(Value, E.Name.str().c_str(), E.Value);
}
+void ScalarEnumerationTraits<dxbc::RootParameterType>::enumeration(
+ IO &IO, dxbc::RootParameterType &Value) {
+ for (const auto &E : dxbc::getRootParameterTypes())
+ IO.enumCase(Value, E.Name.str().c_str(), E.Value);
+}
+
+void ScalarEnumerationTraits<dxbc::DescriptorRangeType>::enumeration(
+ IO &IO, dxbc::DescriptorRangeType &Value) {
+ for (const auto &E : dxbc::getDescriptorRangeTypes())
+ IO.enumCase(Value, E.Name.str().c_str(), E.Value);
+}
+
+void ScalarEnumerationTraits<dxbc::SamplerFilter>::enumeration(
+ IO &IO, dxbc::SamplerFilter &Value) {
+ for (const auto &E : dxbc::getSamplerFilters())
+ IO.enumCase(Value, E.Name.str().c_str(), E.Value);
+}
+
+void ScalarEnumerationTraits<dxbc::StaticBorderColor>::enumeration(
+ IO &IO, dxbc::StaticBorderColor &Value) {
+ for (const auto &E : dxbc::getStaticBorderColors())
+ IO.enumCase(Value, E.Name.str().c_str(), E.Value);
+}
+
+void ScalarEnumerationTraits<dxbc::TextureAddressMode>::enumeration(
+ IO &IO, dxbc::TextureAddressMode &Value) {
+ for (const auto &E : dxbc::getTextureAddressModes())
+ IO.enumCase(Value, E.Name.str().c_str(), E.Value);
+}
+
+void ScalarEnumerationTraits<dxbc::ShaderVisibility>::enumeration(
+ IO &IO, dxbc::ShaderVisibility &Value) {
+ for (const auto &E : dxbc::getShaderVisibility())
+ IO.enumCase(Value, E.Name.str().c_str(), E.Value);
+}
+
+void ScalarEnumerationTraits<dxbc::ComparisonFunc>::enumeration(
+ IO &IO, dxbc::ComparisonFunc &Value) {
+ for (const auto &E : dxbc::getComparisonFuncs())
+ IO.enumCase(Value, E.Name.str().c_str(), E.Value);
+}
+
} // namespace yaml
void DXContainerYAML::PSVInfo::mapInfoForVersion(yaml::IO &IO) {
diff --git a/llvm/test/CodeGen/DirectX/ContainerData/RootSignature-DescriptorTable-AllValidFlagCombinations.ll b/llvm/test/CodeGen/DirectX/ContainerData/RootSignature-DescriptorTable-AllValidFlagCombinations.ll
index 8eb7f90c6b757..09bab575bac5b 100644
--- a/llvm/test/CodeGen/DirectX/ContainerData/RootSignature-DescriptorTable-AllValidFlagCombinations.ll
+++ b/llvm/test/CodeGen/DirectX/ContainerData/RootSignature-DescriptorTable-AllValidFlagCombinations.ll
@@ -61,94 +61,94 @@ attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }
;DXC-NEXT: NumStaticSamplers: 0
;DXC-NEXT: StaticSamplersOffset: 0
;DXC-NEXT: Parameters:
-;DXC-NEXT: - ParameterType: 0
-;DXC-NEXT: ShaderVisibility: 0
+;DXC-NEXT: - ParameterType: DescriptorTable
+;DXC-NEXT: ShaderVisibility: All
;DXC-NEXT: Table:
;DXC-NEXT: NumRanges: 14
;DXC-NEXT: RangesOffset: 44
;DXC-NEXT: Ranges:
-;DXC-NEXT: - RangeType: 3
+;DXC-NEXT: - RangeType: Sampler
;DXC-NEXT: NumDescriptors: 1
;DXC-NEXT: BaseShaderRegister: 0
;DXC-NEXT: RegisterSpace: 1
;DXC-NEXT: OffsetInDescriptorsFromTableStart: 4294967295
-;DXC-NEXT: - RangeType: 3
+;DXC-NEXT: - RangeType: Sampler
;DXC-NEXT: NumDescriptors: 1
;DXC-NEXT: BaseShaderRegister: 0
;DXC-NEXT: RegisterSpace: 3
;DXC-NEXT: OffsetInDescriptorsFromTableStart: 4294967295
;DXC-NEXT: DESCRIPTORS_VOLATILE: true
-;DXC-NEXT: - RangeType: 3
+;DXC-NEXT: - RangeType: Sampler
;DXC-NEXT: NumDescriptors: 1
;DXC-NEXT: BaseShaderRegister: 0
;DXC-NEXT: RegisterSpace: 4
;DXC-NEXT: OffsetInDescriptorsFromTableStart: 4294967295
;DXC-NEXT: DESCRIPTORS_STATIC_KEEPING_BUFFER_BOUNDS_CHECKS: true
-;DXC-NEXT: - RangeType: 0
+;DXC-NEXT: - RangeType: SRV
;DXC-NEXT: NumDescriptors: 1
;DXC-NEXT: BaseShaderRegister: 0
;DXC-NEXT: RegisterSpace: 5
;DXC-NEXT: OffsetInDescriptorsFromTableStart: 4294967295
;DXC-NEXT: DESCRIPTORS_VOLATILE: true
-;DXC-NEXT: - RangeType: 1
+;DXC-NEXT: - RangeType: UAV
;DXC-NEXT: NumDescriptors: 5
;DXC-NEXT: BaseShaderRegister: 1
;DXC-NEXT: RegisterSpace: 6
;DXC-NEXT: OffsetInDescriptorsFromTableStart: 5
;DXC-NEXT: DESCRIPTORS_VOLATILE: true
-;DXC-NEXT: - RangeType: 2
+;DXC-NEXT: - RangeType: CBV
;DXC-NEXT: NumDescriptors: 5
;DXC-NEXT: BaseShaderRegister: 1
;DXC-NEXT: RegisterSpace: 7
;DXC-NEXT: OffsetInDescriptorsFromTableStart: 5
;DXC-NEXT: DATA_VOLATILE: true
-;DXC-NEXT: - RangeType: 0
+;DXC-NEXT: - RangeType: SRV
;DXC-NEXT: NumDescriptors: 5
;DXC-NEXT: BaseShaderRegister: 1
;DXC-NEXT: RegisterSpace: 8
;DXC-NEXT: OffsetInDescriptorsFromTableStart: 5
;DXC-NEXT: DATA_STATIC: true
-;DXC-NEXT: - RangeType: 1
+;DXC-NEXT: - RangeType: UAV
;DXC-NEXT: NumDescriptors: 5
;DXC-NEXT: BaseShaderRegister: 1
;DXC-NEXT: RegisterSpace: 9
;DXC-NEXT: OffsetInDescriptorsFromTableStart: 5
;DXC-NEXT: DATA_STATIC_WHILE_SET_AT_EXECUTE: true
-;DXC-NEXT: - RangeType: 2
+;DXC-NEXT: - RangeType: CBV
;DXC-NEXT: NumDescriptors: 5
;DXC-NEXT: BaseShaderRegister: 1
;DXC-NEXT: RegisterSpace: 10
;DXC-NEXT: OffsetInDescriptorsFromTableStart: 5
;DXC-NEXT: DESCRIPTORS_VOLATILE: true
;DXC-NEXT: DATA_VOLATILE: true
-;DXC-NEXT: - RangeType: 0
+;DXC-NEXT: - RangeType: SRV
;DXC-NEXT: NumDescriptors: 5
;DXC-NEXT: BaseShaderRegister: 1
;DXC-NEXT: RegisterSpace: 11
;DXC-NEXT: OffsetInDescriptorsFromTableStart: 5
;DXC-NEXT: DESCRIPTORS_VOLATILE: true
;DXC-NEXT: DATA_STATIC_WHILE_SET_AT_EXECUTE: true
-;DXC-NEXT: - RangeType: 1
+;DXC-NEXT: - RangeType: UAV
;DXC-NEXT: NumDescriptors: 5
;DXC-NEXT: BaseShaderRegister: 1
;DXC-NEXT: RegisterSpace: 12
;DXC-NEXT: OffsetInDescriptorsFromTableStart: 5
;DXC-NEXT: DESCRIPTORS_STATIC_KEEPING_BUFFER_BOUNDS_CHECKS: true
-;DXC-NEXT: - RangeType: 2
+;DXC-NEXT: - RangeType: CBV
;DXC-NEXT: NumDescriptors: 5
;DXC-NEXT: BaseShaderRegister: 1
;DXC-NEXT: RegisterSpace: 13
;DXC-NEXT: OffsetInDescriptorsFromTableStart: 5
;DXC-NEXT: DATA_VOLATILE: true
;DXC-NEXT: DESCRIPTORS_STATIC_KEEPING_BUFFER_BOUNDS_CHECKS: true
-;DXC-NEXT: - RangeType: 0
+;DXC-NEXT: - RangeType: SRV
;DXC-NEXT: NumDescriptors: 5
;DXC-NEXT: BaseShaderRegister: 1
;DXC-NEXT: RegisterSpace: 14
;DXC-NEXT: OffsetInDescriptorsFromTableStart: 5
;DXC-NEXT: DATA_STATIC: true
;DXC-NEXT: DESCRIPTORS_STATIC_KEEPING_BUFFER_BOUNDS_CHECKS: true
-;DXC-NEXT: - RangeType: 1
+;DXC-NEXT: - RangeType: UAV
;DXC-NEXT: NumDescriptors: 5
;DXC-NEXT: BaseShaderRegister: 1
;DXC-NEXT: RegisterSpace: 15
diff --git a/llvm/test/CodeGen/DirectX/ContainerData/RootSignature-DescriptorTable-AllValidFlagCombinationsV1.ll b/llvm/test/CodeGen/DirectX/ContainerData/RootSignature-DescriptorTable-AllValidFlagCombinationsV1.ll
index 053721de1eb1f..bb8a95fb52ce8 100644
--- a/llvm/test/CodeGen/DirectX/ContainerData/RootSignature-DescriptorTable-AllValidFlagCombinationsV1.ll
+++ b/llvm/test/CodeGen/DirectX/ContainerData/RootSignature-DescriptorTable-AllValidFlagCombinationsV1.ll
@@ -26,18 +26,18 @@ attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }
; DXC-NEXT: NumStaticSamplers: 0
; DXC-NEXT: StaticSamplersOffset: 0
; DXC-NEXT: Parameters:
-; DXC-NEXT: - ParameterType: 0
-; DXC-NEXT: ShaderVisibility: 0
+; DXC-NEXT: - ParameterType: DescriptorTable
+; DXC-NEXT: ShaderVisibility: All
; DXC-NEXT: Table:
; DXC-NEXT: NumRanges: 2
; DXC-NEXT: RangesOffset: 44
; DXC-NEXT: Ranges:
-; DXC-NEXT: - RangeType: 3
+; DXC-NEXT: - RangeType: Sampler
; DXC-NEXT: NumDescriptors: 1
; DXC-NEXT: BaseShaderRegister: 1
; DXC-NEXT: RegisterSpace: 0
; DXC-NEXT: OffsetInDescriptorsFromTableStart: 4294967295
-; DXC-NEXT: - RangeType: 1
+; DXC-NEXT: - RangeType: UAV
; DXC-NEXT: NumDescriptors: 5
; DXC-NEXT: BaseShaderRegister: 1
; DXC-NEXT: RegisterSpace: 10
diff --git a/llvm/test/CodeGen/DirectX/ContainerData/RootSignature-DescriptorTable.ll b/llvm/test/CodeGen/DirectX/ContainerData/RootSignature-DescriptorTable.ll
index 8e9b4b43b11a6..cbd4e4f7276da 100644
--- a/llvm/test/CodeGen/DirectX/ContainerData/RootSignature-DescriptorTable.ll
+++ b/llvm/test/CodeGen/DirectX/ContainerData/RootSignature-DescriptorTable.ll
@@ -23,24 +23,24 @@ attributes #0 = { "hlsl.num...
[truncated]
|
dxbc::RootParameterType Type = dxbc::RootParameterType(L.Header.Type); | ||
dxbc::ShaderVisibility Visibility = | ||
dxbc::ShaderVisibility(L.Header.Visibility); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The casts are no longer needed, since these are already the right type now. Here and throughout this file.
…/updating-static-samplers
assert(dxbc::isValidSamplerFilter(Param.Filter) && | ||
dxbc::isValidAddress(Param.AddressU) && | ||
dxbc::isValidAddress(Param.AddressV) && | ||
dxbc::isValidAddress(Param.AddressW) && | ||
dxbc::isValidComparisonFunc(Param.ComparisonFunc) && | ||
dxbc::isValidBorderColor(Param.BorderColor) && | ||
dxbc::isValidShaderVisibility(Param.ShaderVisibility) && | ||
"Invalid enum value in static sampler"); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since those are now enums, they are validated during enum parsing, therefore, these values don't require validation anymore.
NumStaticSamplers: 0 | ||
StaticSamplersOffset: 44 | ||
Parameters: | ||
- ParameterType: 2 # SRV |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment was wrong
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I do note that none of the objcopy
tests have been updated. Maybe they don't need to be but just a double-check.
NewS.AddressU = S.AddressU; | ||
NewS.AddressV = S.AddressV; | ||
NewS.AddressW = S.AddressW; | ||
NewS.Filter = dxbc::SamplerFilter(S.Filter); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you missed removing these casts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those castings are required here. They are coming from the binary representation, so they are actually uint32_t
, the casting are moving the data into the internal representations, which use the enums.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also ran ninja check-all
, and the objcopy tests passed.
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/190/builds/27338 Here is the relevant piece of the build log for the reference
|
…#440) This patch updates the Root Signature tests to enums, instead of numbers, to represent certain fields in root signatures. This is required since we changed Root Signature's yaml representation recently in this pr: [llvm/llvm-project#154827](llvm/llvm-project#154827)
This PR is updating Root Signature YAML to use enums, this is a required change to remove the use of to_underlying from DirectXContainer binary file.
Closes: #150676