[llvm] [DirectX][NFC] Rename ShaderFlag to SHADER_FEATURE_FLAG. (PR #82700)
Xiang Li via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 27 12:05:05 PST 2024
https://github.com/python3kgae updated https://github.com/llvm/llvm-project/pull/82700
>From 7c4aa7a26afd00fe24effeae0fde738ef1ef3a07 Mon Sep 17 00:00:00 2001
From: Xiang Li <python3kgae at outlook.com>
Date: Thu, 22 Feb 2024 17:15:32 -0500
Subject: [PATCH 1/5] [DirectX][NFC] Rename ShaderFlag to Shader_FEATURE_INFO.
This is prepare for add ShaderFlag in DXIL.
For #57925
---
llvm/include/llvm/BinaryFormat/DXContainer.h | 2 +-
.../BinaryFormat/DXContainerConstants.def | 74 +++++++++----------
.../include/llvm/ObjectYAML/DXContainerYAML.h | 2 +-
llvm/lib/ObjectYAML/DXContainerYAML.cpp | 6 +-
llvm/lib/Target/DirectX/DXILShaderFlags.cpp | 2 +-
llvm/lib/Target/DirectX/DXILShaderFlags.h | 6 +-
6 files changed, 46 insertions(+), 46 deletions(-)
diff --git a/llvm/include/llvm/BinaryFormat/DXContainer.h b/llvm/include/llvm/BinaryFormat/DXContainer.h
index c3dcd568216b71..fa786af0d9cda1 100644
--- a/llvm/include/llvm/BinaryFormat/DXContainer.h
+++ b/llvm/include/llvm/BinaryFormat/DXContainer.h
@@ -141,7 +141,7 @@ enum class PartType {
#include "DXContainerConstants.def"
};
-#define SHADER_FLAG(Num, Val, Str) Val = 1ull << Num,
+#define SHADER_FEATURE_INFO(Num, Val, Str) Val = 1ull << Num,
enum class FeatureFlags : uint64_t {
#include "DXContainerConstants.def"
};
diff --git a/llvm/include/llvm/BinaryFormat/DXContainerConstants.def b/llvm/include/llvm/BinaryFormat/DXContainerConstants.def
index 87dd0a5cb6ba70..00caefcfd9d03f 100644
--- a/llvm/include/llvm/BinaryFormat/DXContainerConstants.def
+++ b/llvm/include/llvm/BinaryFormat/DXContainerConstants.def
@@ -11,43 +11,43 @@ CONTAINER_PART(PSG1)
#undef CONTAINER_PART
#endif
-#ifdef SHADER_FLAG
-
-SHADER_FLAG(0, Doubles, "Double-precision floating point")
-SHADER_FLAG(1, ComputeShadersPlusRawAndStructuredBuffers, "Raw and Structured buffers")
-SHADER_FLAG(2, UAVsAtEveryStage, "UAVs at every shader stage")
-SHADER_FLAG(3, Max64UAVs, "64 UAV slots")
-SHADER_FLAG(4, MinimumPrecision, "Minimum-precision data types")
-SHADER_FLAG(5, DX11_1_DoubleExtensions, "Double-precision extensions for 11.1")
-SHADER_FLAG(6, DX11_1_ShaderExtensions, "Shader extensions for 11.1")
-SHADER_FLAG(7, LEVEL9ComparisonFiltering, "Comparison filtering for feature level 9")
-SHADER_FLAG(8, TiledResources, "Tiled resources")
-SHADER_FLAG(9, StencilRef, "PS Output Stencil Ref")
-SHADER_FLAG(10, InnerCoverage, "PS Inner Coverage")
-SHADER_FLAG(11, TypedUAVLoadAdditionalFormats, "Typed UAV Load Additional Formats")
-SHADER_FLAG(12, ROVs, "Raster Ordered UAVs")
-SHADER_FLAG(13, ViewportAndRTArrayIndexFromAnyShaderFeedingRasterizer, "SV_RenderTargetArrayIndex or SV_ViewportArrayIndex from any shader feeding rasterizer")
-SHADER_FLAG(14, WaveOps, "Wave level operations")
-SHADER_FLAG(15, Int64Ops, "64-Bit integer")
-SHADER_FLAG(16, ViewID, "View Instancing")
-SHADER_FLAG(17, Barycentrics, "Barycentrics")
-SHADER_FLAG(18, NativeLowPrecision, "Use native low precision")
-SHADER_FLAG(19, ShadingRate, "Shading Rate")
-SHADER_FLAG(20, Raytracing_Tier_1_1, "Raytracing tier 1.1 features")
-SHADER_FLAG(21, SamplerFeedback, "Sampler feedback")
-SHADER_FLAG(22, AtomicInt64OnTypedResource, "64-bit Atomics on Typed Resources")
-SHADER_FLAG(23, AtomicInt64OnGroupShared, "64-bit Atomics on Group Shared")
-SHADER_FLAG(24, DerivativesInMeshAndAmpShaders, "Derivatives in mesh and amplification shaders")
-SHADER_FLAG(25, ResourceDescriptorHeapIndexing, "Resource descriptor heap indexing")
-SHADER_FLAG(26, SamplerDescriptorHeapIndexing, "Sampler descriptor heap indexing")
-SHADER_FLAG(27, RESERVED, "<RESERVED>")
-SHADER_FLAG(28, AtomicInt64OnHeapResource, "64-bit Atomics on Heap Resources")
-SHADER_FLAG(29, AdvancedTextureOps, "Advanced Texture Ops")
-SHADER_FLAG(30, WriteableMSAATextures, "Writeable MSAA Textures")
-
-SHADER_FLAG(31, NextUnusedBit, "Next reserved shader flag bit (not a flag)")
-
-#undef SHADER_FLAG
+#ifdef SHADER_FEATURE_INFO
+
+SHADER_FEATURE_INFO(0, Doubles, "Double-precision floating point")
+SHADER_FEATURE_INFO(1, ComputeShadersPlusRawAndStructuredBuffers, "Raw and Structured buffers")
+SHADER_FEATURE_INFO(2, UAVsAtEveryStage, "UAVs at every shader stage")
+SHADER_FEATURE_INFO(3, Max64UAVs, "64 UAV slots")
+SHADER_FEATURE_INFO(4, MinimumPrecision, "Minimum-precision data types")
+SHADER_FEATURE_INFO(5, DX11_1_DoubleExtensions, "Double-precision extensions for 11.1")
+SHADER_FEATURE_INFO(6, DX11_1_ShaderExtensions, "Shader extensions for 11.1")
+SHADER_FEATURE_INFO(7, LEVEL9ComparisonFiltering, "Comparison filtering for feature level 9")
+SHADER_FEATURE_INFO(8, TiledResources, "Tiled resources")
+SHADER_FEATURE_INFO(9, StencilRef, "PS Output Stencil Ref")
+SHADER_FEATURE_INFO(10, InnerCoverage, "PS Inner Coverage")
+SHADER_FEATURE_INFO(11, TypedUAVLoadAdditionalFormats, "Typed UAV Load Additional Formats")
+SHADER_FEATURE_INFO(12, ROVs, "Raster Ordered UAVs")
+SHADER_FEATURE_INFO(13, ViewportAndRTArrayIndexFromAnyShaderFeedingRasterizer, "SV_RenderTargetArrayIndex or SV_ViewportArrayIndex from any shader feeding rasterizer")
+SHADER_FEATURE_INFO(14, WaveOps, "Wave level operations")
+SHADER_FEATURE_INFO(15, Int64Ops, "64-Bit integer")
+SHADER_FEATURE_INFO(16, ViewID, "View Instancing")
+SHADER_FEATURE_INFO(17, Barycentrics, "Barycentrics")
+SHADER_FEATURE_INFO(18, NativeLowPrecision, "Use native low precision")
+SHADER_FEATURE_INFO(19, ShadingRate, "Shading Rate")
+SHADER_FEATURE_INFO(20, Raytracing_Tier_1_1, "Raytracing tier 1.1 features")
+SHADER_FEATURE_INFO(21, SamplerFeedback, "Sampler feedback")
+SHADER_FEATURE_INFO(22, AtomicInt64OnTypedResource, "64-bit Atomics on Typed Resources")
+SHADER_FEATURE_INFO(23, AtomicInt64OnGroupShared, "64-bit Atomics on Group Shared")
+SHADER_FEATURE_INFO(24, DerivativesInMeshAndAmpShaders, "Derivatives in mesh and amplification shaders")
+SHADER_FEATURE_INFO(25, ResourceDescriptorHeapIndexing, "Resource descriptor heap indexing")
+SHADER_FEATURE_INFO(26, SamplerDescriptorHeapIndexing, "Sampler descriptor heap indexing")
+SHADER_FEATURE_INFO(27, RESERVED, "<RESERVED>")
+SHADER_FEATURE_INFO(28, AtomicInt64OnHeapResource, "64-bit Atomics on Heap Resources")
+SHADER_FEATURE_INFO(29, AdvancedTextureOps, "Advanced Texture Ops")
+SHADER_FEATURE_INFO(30, WriteableMSAATextures, "Writeable MSAA Textures")
+
+SHADER_FEATURE_INFO(31, NextUnusedBit, "Next reserved shader flag bit (not a flag)")
+
+#undef SHADER_FEATURE_INFO
#endif
#ifdef SEMANTIC_KIND
diff --git a/llvm/include/llvm/ObjectYAML/DXContainerYAML.h b/llvm/include/llvm/ObjectYAML/DXContainerYAML.h
index 66a6ac70bbea10..1ad30df36cdbf2 100644
--- a/llvm/include/llvm/ObjectYAML/DXContainerYAML.h
+++ b/llvm/include/llvm/ObjectYAML/DXContainerYAML.h
@@ -56,7 +56,7 @@ struct DXILProgram {
std::optional<std::vector<llvm::yaml::Hex8>> DXIL;
};
-#define SHADER_FLAG(Num, Val, Str) bool Val = false;
+#define SHADER_FEATURE_INFO(Num, Val, Str) bool Val = false;
struct ShaderFlags {
ShaderFlags() = default;
ShaderFlags(uint64_t FlagData);
diff --git a/llvm/lib/ObjectYAML/DXContainerYAML.cpp b/llvm/lib/ObjectYAML/DXContainerYAML.cpp
index 1f03f2c7d39966..1dadcb987f215b 100644
--- a/llvm/lib/ObjectYAML/DXContainerYAML.cpp
+++ b/llvm/lib/ObjectYAML/DXContainerYAML.cpp
@@ -24,14 +24,14 @@ static_assert((uint64_t)dxbc::FeatureFlags::NextUnusedBit <= 1ull << 63,
"Shader flag bits exceed enum size.");
DXContainerYAML::ShaderFlags::ShaderFlags(uint64_t FlagData) {
-#define SHADER_FLAG(Num, Val, Str) \
+#define SHADER_FEATURE_INFO(Num, Val, Str) \
Val = (FlagData & (uint64_t)dxbc::FeatureFlags::Val) > 0;
#include "llvm/BinaryFormat/DXContainerConstants.def"
}
uint64_t DXContainerYAML::ShaderFlags::getEncodedFlags() {
uint64_t Flag = 0;
-#define SHADER_FLAG(Num, Val, Str) \
+#define SHADER_FEATURE_INFO(Num, Val, Str) \
if (Val) \
Flag |= (uint64_t)dxbc::FeatureFlags::Val;
#include "llvm/BinaryFormat/DXContainerConstants.def"
@@ -105,7 +105,7 @@ void MappingTraits<DXContainerYAML::DXILProgram>::mapping(
void MappingTraits<DXContainerYAML::ShaderFlags>::mapping(
IO &IO, DXContainerYAML::ShaderFlags &Flags) {
-#define SHADER_FLAG(Num, Val, Str) IO.mapRequired(#Val, Flags.Val);
+#define SHADER_FEATURE_INFO(Num, Val, Str) IO.mapRequired(#Val, Flags.Val);
#include "llvm/BinaryFormat/DXContainerConstants.def"
}
diff --git a/llvm/lib/Target/DirectX/DXILShaderFlags.cpp b/llvm/lib/Target/DirectX/DXILShaderFlags.cpp
index bbb56435660211..73606dcef1c874 100644
--- a/llvm/lib/Target/DirectX/DXILShaderFlags.cpp
+++ b/llvm/lib/Target/DirectX/DXILShaderFlags.cpp
@@ -51,7 +51,7 @@ void ComputedShaderFlags::print(raw_ostream &OS) const {
if (FlagVal == 0)
return;
OS << "; Note: shader requires additional functionality:\n";
-#define SHADER_FLAG(bit, FlagName, Str) \
+#define SHADER_FEATURE_INFO(bit, FlagName, Str) \
if (FlagName) \
OS << "; " Str "\n";
#include "llvm/BinaryFormat/DXContainerConstants.def"
diff --git a/llvm/lib/Target/DirectX/DXILShaderFlags.h b/llvm/lib/Target/DirectX/DXILShaderFlags.h
index 4f51873a2d0b34..40931be1c51561 100644
--- a/llvm/lib/Target/DirectX/DXILShaderFlags.h
+++ b/llvm/lib/Target/DirectX/DXILShaderFlags.h
@@ -29,17 +29,17 @@ class GlobalVariable;
namespace dxil {
struct ComputedShaderFlags {
-#define SHADER_FLAG(bit, FlagName, Str) bool FlagName : 1;
+#define SHADER_FEATURE_INFO(bit, FlagName, Str) bool FlagName : 1;
#include "llvm/BinaryFormat/DXContainerConstants.def"
-#define SHADER_FLAG(bit, FlagName, Str) FlagName = false;
+#define SHADER_FEATURE_INFO(bit, FlagName, Str) FlagName = false;
ComputedShaderFlags() {
#include "llvm/BinaryFormat/DXContainerConstants.def"
}
operator uint64_t() const {
uint64_t FlagValue = 0;
-#define SHADER_FLAG(bit, FlagName, Str) \
+#define SHADER_FEATURE_INFO(bit, FlagName, Str) \
FlagValue |= \
FlagName ? static_cast<uint64_t>(dxbc::FeatureFlags::FlagName) : 0ull;
#include "llvm/BinaryFormat/DXContainerConstants.def"
>From 469cd7b4dae2582056e0e62cb90df61e0798d6bc Mon Sep 17 00:00:00 2001
From: Xiang Li <python3kgae at outlook.com>
Date: Thu, 22 Feb 2024 17:28:53 -0500
Subject: [PATCH 2/5] Fix format.
---
llvm/lib/ObjectYAML/DXContainerYAML.cpp | 4 ++--
llvm/lib/Target/DirectX/DXILShaderFlags.cpp | 2 +-
llvm/lib/Target/DirectX/DXILShaderFlags.h | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/llvm/lib/ObjectYAML/DXContainerYAML.cpp b/llvm/lib/ObjectYAML/DXContainerYAML.cpp
index 1dadcb987f215b..494f93095251e4 100644
--- a/llvm/lib/ObjectYAML/DXContainerYAML.cpp
+++ b/llvm/lib/ObjectYAML/DXContainerYAML.cpp
@@ -24,14 +24,14 @@ static_assert((uint64_t)dxbc::FeatureFlags::NextUnusedBit <= 1ull << 63,
"Shader flag bits exceed enum size.");
DXContainerYAML::ShaderFlags::ShaderFlags(uint64_t FlagData) {
-#define SHADER_FEATURE_INFO(Num, Val, Str) \
+#define SHADER_FEATURE_INFO(Num, Val, Str) \
Val = (FlagData & (uint64_t)dxbc::FeatureFlags::Val) > 0;
#include "llvm/BinaryFormat/DXContainerConstants.def"
}
uint64_t DXContainerYAML::ShaderFlags::getEncodedFlags() {
uint64_t Flag = 0;
-#define SHADER_FEATURE_INFO(Num, Val, Str) \
+#define SHADER_FEATURE_INFO(Num, Val, Str) \
if (Val) \
Flag |= (uint64_t)dxbc::FeatureFlags::Val;
#include "llvm/BinaryFormat/DXContainerConstants.def"
diff --git a/llvm/lib/Target/DirectX/DXILShaderFlags.cpp b/llvm/lib/Target/DirectX/DXILShaderFlags.cpp
index 73606dcef1c874..824647072ec643 100644
--- a/llvm/lib/Target/DirectX/DXILShaderFlags.cpp
+++ b/llvm/lib/Target/DirectX/DXILShaderFlags.cpp
@@ -51,7 +51,7 @@ void ComputedShaderFlags::print(raw_ostream &OS) const {
if (FlagVal == 0)
return;
OS << "; Note: shader requires additional functionality:\n";
-#define SHADER_FEATURE_INFO(bit, FlagName, Str) \
+#define SHADER_FEATURE_INFO(bit, FlagName, Str) \
if (FlagName) \
OS << "; " Str "\n";
#include "llvm/BinaryFormat/DXContainerConstants.def"
diff --git a/llvm/lib/Target/DirectX/DXILShaderFlags.h b/llvm/lib/Target/DirectX/DXILShaderFlags.h
index 40931be1c51561..7a9a1bc29eb481 100644
--- a/llvm/lib/Target/DirectX/DXILShaderFlags.h
+++ b/llvm/lib/Target/DirectX/DXILShaderFlags.h
@@ -39,7 +39,7 @@ struct ComputedShaderFlags {
operator uint64_t() const {
uint64_t FlagValue = 0;
-#define SHADER_FEATURE_INFO(bit, FlagName, Str) \
+#define SHADER_FEATURE_INFO(bit, FlagName, Str) \
FlagValue |= \
FlagName ? static_cast<uint64_t>(dxbc::FeatureFlags::FlagName) : 0ull;
#include "llvm/BinaryFormat/DXContainerConstants.def"
>From c61d196741fbed46b899cf1c44436618adb35621 Mon Sep 17 00:00:00 2001
From: Xiang Li <python3kgae at outlook.com>
Date: Thu, 22 Feb 2024 20:41:32 -0500
Subject: [PATCH 3/5] Rename to Shader feature flag.
---
llvm/include/llvm/BinaryFormat/DXContainer.h | 2 +-
.../BinaryFormat/DXContainerConstants.def | 74 +++++++++----------
.../include/llvm/ObjectYAML/DXContainerYAML.h | 2 +-
llvm/lib/ObjectYAML/DXContainerYAML.cpp | 6 +-
llvm/lib/Target/DirectX/DXILShaderFlags.cpp | 2 +-
llvm/lib/Target/DirectX/DXILShaderFlags.h | 6 +-
6 files changed, 46 insertions(+), 46 deletions(-)
diff --git a/llvm/include/llvm/BinaryFormat/DXContainer.h b/llvm/include/llvm/BinaryFormat/DXContainer.h
index fa786af0d9cda1..a28e19edb4c6a6 100644
--- a/llvm/include/llvm/BinaryFormat/DXContainer.h
+++ b/llvm/include/llvm/BinaryFormat/DXContainer.h
@@ -141,7 +141,7 @@ enum class PartType {
#include "DXContainerConstants.def"
};
-#define SHADER_FEATURE_INFO(Num, Val, Str) Val = 1ull << Num,
+#define SHADER_FEATURE_FLAG(Num, Val, Str) Val = 1ull << Num,
enum class FeatureFlags : uint64_t {
#include "DXContainerConstants.def"
};
diff --git a/llvm/include/llvm/BinaryFormat/DXContainerConstants.def b/llvm/include/llvm/BinaryFormat/DXContainerConstants.def
index 00caefcfd9d03f..80ed86bc3a499e 100644
--- a/llvm/include/llvm/BinaryFormat/DXContainerConstants.def
+++ b/llvm/include/llvm/BinaryFormat/DXContainerConstants.def
@@ -11,43 +11,43 @@ CONTAINER_PART(PSG1)
#undef CONTAINER_PART
#endif
-#ifdef SHADER_FEATURE_INFO
-
-SHADER_FEATURE_INFO(0, Doubles, "Double-precision floating point")
-SHADER_FEATURE_INFO(1, ComputeShadersPlusRawAndStructuredBuffers, "Raw and Structured buffers")
-SHADER_FEATURE_INFO(2, UAVsAtEveryStage, "UAVs at every shader stage")
-SHADER_FEATURE_INFO(3, Max64UAVs, "64 UAV slots")
-SHADER_FEATURE_INFO(4, MinimumPrecision, "Minimum-precision data types")
-SHADER_FEATURE_INFO(5, DX11_1_DoubleExtensions, "Double-precision extensions for 11.1")
-SHADER_FEATURE_INFO(6, DX11_1_ShaderExtensions, "Shader extensions for 11.1")
-SHADER_FEATURE_INFO(7, LEVEL9ComparisonFiltering, "Comparison filtering for feature level 9")
-SHADER_FEATURE_INFO(8, TiledResources, "Tiled resources")
-SHADER_FEATURE_INFO(9, StencilRef, "PS Output Stencil Ref")
-SHADER_FEATURE_INFO(10, InnerCoverage, "PS Inner Coverage")
-SHADER_FEATURE_INFO(11, TypedUAVLoadAdditionalFormats, "Typed UAV Load Additional Formats")
-SHADER_FEATURE_INFO(12, ROVs, "Raster Ordered UAVs")
-SHADER_FEATURE_INFO(13, ViewportAndRTArrayIndexFromAnyShaderFeedingRasterizer, "SV_RenderTargetArrayIndex or SV_ViewportArrayIndex from any shader feeding rasterizer")
-SHADER_FEATURE_INFO(14, WaveOps, "Wave level operations")
-SHADER_FEATURE_INFO(15, Int64Ops, "64-Bit integer")
-SHADER_FEATURE_INFO(16, ViewID, "View Instancing")
-SHADER_FEATURE_INFO(17, Barycentrics, "Barycentrics")
-SHADER_FEATURE_INFO(18, NativeLowPrecision, "Use native low precision")
-SHADER_FEATURE_INFO(19, ShadingRate, "Shading Rate")
-SHADER_FEATURE_INFO(20, Raytracing_Tier_1_1, "Raytracing tier 1.1 features")
-SHADER_FEATURE_INFO(21, SamplerFeedback, "Sampler feedback")
-SHADER_FEATURE_INFO(22, AtomicInt64OnTypedResource, "64-bit Atomics on Typed Resources")
-SHADER_FEATURE_INFO(23, AtomicInt64OnGroupShared, "64-bit Atomics on Group Shared")
-SHADER_FEATURE_INFO(24, DerivativesInMeshAndAmpShaders, "Derivatives in mesh and amplification shaders")
-SHADER_FEATURE_INFO(25, ResourceDescriptorHeapIndexing, "Resource descriptor heap indexing")
-SHADER_FEATURE_INFO(26, SamplerDescriptorHeapIndexing, "Sampler descriptor heap indexing")
-SHADER_FEATURE_INFO(27, RESERVED, "<RESERVED>")
-SHADER_FEATURE_INFO(28, AtomicInt64OnHeapResource, "64-bit Atomics on Heap Resources")
-SHADER_FEATURE_INFO(29, AdvancedTextureOps, "Advanced Texture Ops")
-SHADER_FEATURE_INFO(30, WriteableMSAATextures, "Writeable MSAA Textures")
-
-SHADER_FEATURE_INFO(31, NextUnusedBit, "Next reserved shader flag bit (not a flag)")
-
-#undef SHADER_FEATURE_INFO
+#ifdef SHADER_FEATURE_FLAG
+
+SHADER_FEATURE_FLAG(0, Doubles, "Double-precision floating point")
+SHADER_FEATURE_FLAG(1, ComputeShadersPlusRawAndStructuredBuffers, "Raw and Structured buffers")
+SHADER_FEATURE_FLAG(2, UAVsAtEveryStage, "UAVs at every shader stage")
+SHADER_FEATURE_FLAG(3, Max64UAVs, "64 UAV slots")
+SHADER_FEATURE_FLAG(4, MinimumPrecision, "Minimum-precision data types")
+SHADER_FEATURE_FLAG(5, DX11_1_DoubleExtensions, "Double-precision extensions for 11.1")
+SHADER_FEATURE_FLAG(6, DX11_1_ShaderExtensions, "Shader extensions for 11.1")
+SHADER_FEATURE_FLAG(7, LEVEL9ComparisonFiltering, "Comparison filtering for feature level 9")
+SHADER_FEATURE_FLAG(8, TiledResources, "Tiled resources")
+SHADER_FEATURE_FLAG(9, StencilRef, "PS Output Stencil Ref")
+SHADER_FEATURE_FLAG(10, InnerCoverage, "PS Inner Coverage")
+SHADER_FEATURE_FLAG(11, TypedUAVLoadAdditionalFormats, "Typed UAV Load Additional Formats")
+SHADER_FEATURE_FLAG(12, ROVs, "Raster Ordered UAVs")
+SHADER_FEATURE_FLAG(13, ViewportAndRTArrayIndexFromAnyShaderFeedingRasterizer, "SV_RenderTargetArrayIndex or SV_ViewportArrayIndex from any shader feeding rasterizer")
+SHADER_FEATURE_FLAG(14, WaveOps, "Wave level operations")
+SHADER_FEATURE_FLAG(15, Int64Ops, "64-Bit integer")
+SHADER_FEATURE_FLAG(16, ViewID, "View Instancing")
+SHADER_FEATURE_FLAG(17, Barycentrics, "Barycentrics")
+SHADER_FEATURE_FLAG(18, NativeLowPrecision, "Use native low precision")
+SHADER_FEATURE_FLAG(19, ShadingRate, "Shading Rate")
+SHADER_FEATURE_FLAG(20, Raytracing_Tier_1_1, "Raytracing tier 1.1 features")
+SHADER_FEATURE_FLAG(21, SamplerFeedback, "Sampler feedback")
+SHADER_FEATURE_FLAG(22, AtomicInt64OnTypedResource, "64-bit Atomics on Typed Resources")
+SHADER_FEATURE_FLAG(23, AtomicInt64OnGroupShared, "64-bit Atomics on Group Shared")
+SHADER_FEATURE_FLAG(24, DerivativesInMeshAndAmpShaders, "Derivatives in mesh and amplification shaders")
+SHADER_FEATURE_FLAG(25, ResourceDescriptorHeapIndexing, "Resource descriptor heap indexing")
+SHADER_FEATURE_FLAG(26, SamplerDescriptorHeapIndexing, "Sampler descriptor heap indexing")
+SHADER_FEATURE_FLAG(27, RESERVED, "<RESERVED>")
+SHADER_FEATURE_FLAG(28, AtomicInt64OnHeapResource, "64-bit Atomics on Heap Resources")
+SHADER_FEATURE_FLAG(29, AdvancedTextureOps, "Advanced Texture Ops")
+SHADER_FEATURE_FLAG(30, WriteableMSAATextures, "Writeable MSAA Textures")
+
+SHADER_FEATURE_FLAG(31, NextUnusedBit, "Next reserved shader flag bit (not a flag)")
+
+#undef SHADER_FEATURE_FLAG
#endif
#ifdef SEMANTIC_KIND
diff --git a/llvm/include/llvm/ObjectYAML/DXContainerYAML.h b/llvm/include/llvm/ObjectYAML/DXContainerYAML.h
index 1ad30df36cdbf2..5e8c894a0f4052 100644
--- a/llvm/include/llvm/ObjectYAML/DXContainerYAML.h
+++ b/llvm/include/llvm/ObjectYAML/DXContainerYAML.h
@@ -56,7 +56,7 @@ struct DXILProgram {
std::optional<std::vector<llvm::yaml::Hex8>> DXIL;
};
-#define SHADER_FEATURE_INFO(Num, Val, Str) bool Val = false;
+#define SHADER_FEATURE_FLAG(Num, Val, Str) bool Val = false;
struct ShaderFlags {
ShaderFlags() = default;
ShaderFlags(uint64_t FlagData);
diff --git a/llvm/lib/ObjectYAML/DXContainerYAML.cpp b/llvm/lib/ObjectYAML/DXContainerYAML.cpp
index 494f93095251e4..2804adb1dd919a 100644
--- a/llvm/lib/ObjectYAML/DXContainerYAML.cpp
+++ b/llvm/lib/ObjectYAML/DXContainerYAML.cpp
@@ -24,14 +24,14 @@ static_assert((uint64_t)dxbc::FeatureFlags::NextUnusedBit <= 1ull << 63,
"Shader flag bits exceed enum size.");
DXContainerYAML::ShaderFlags::ShaderFlags(uint64_t FlagData) {
-#define SHADER_FEATURE_INFO(Num, Val, Str) \
+#define SHADER_FEATURE_FLAG(Num, Val, Str) \
Val = (FlagData & (uint64_t)dxbc::FeatureFlags::Val) > 0;
#include "llvm/BinaryFormat/DXContainerConstants.def"
}
uint64_t DXContainerYAML::ShaderFlags::getEncodedFlags() {
uint64_t Flag = 0;
-#define SHADER_FEATURE_INFO(Num, Val, Str) \
+#define SHADER_FEATURE_FLAG(Num, Val, Str) \
if (Val) \
Flag |= (uint64_t)dxbc::FeatureFlags::Val;
#include "llvm/BinaryFormat/DXContainerConstants.def"
@@ -105,7 +105,7 @@ void MappingTraits<DXContainerYAML::DXILProgram>::mapping(
void MappingTraits<DXContainerYAML::ShaderFlags>::mapping(
IO &IO, DXContainerYAML::ShaderFlags &Flags) {
-#define SHADER_FEATURE_INFO(Num, Val, Str) IO.mapRequired(#Val, Flags.Val);
+#define SHADER_FEATURE_FLAG(Num, Val, Str) IO.mapRequired(#Val, Flags.Val);
#include "llvm/BinaryFormat/DXContainerConstants.def"
}
diff --git a/llvm/lib/Target/DirectX/DXILShaderFlags.cpp b/llvm/lib/Target/DirectX/DXILShaderFlags.cpp
index 824647072ec643..66a9dc46bcbfbf 100644
--- a/llvm/lib/Target/DirectX/DXILShaderFlags.cpp
+++ b/llvm/lib/Target/DirectX/DXILShaderFlags.cpp
@@ -51,7 +51,7 @@ void ComputedShaderFlags::print(raw_ostream &OS) const {
if (FlagVal == 0)
return;
OS << "; Note: shader requires additional functionality:\n";
-#define SHADER_FEATURE_INFO(bit, FlagName, Str) \
+#define SHADER_FEATURE_FLAG(bit, FlagName, Str) \
if (FlagName) \
OS << "; " Str "\n";
#include "llvm/BinaryFormat/DXContainerConstants.def"
diff --git a/llvm/lib/Target/DirectX/DXILShaderFlags.h b/llvm/lib/Target/DirectX/DXILShaderFlags.h
index 7a9a1bc29eb481..574a7b090f5281 100644
--- a/llvm/lib/Target/DirectX/DXILShaderFlags.h
+++ b/llvm/lib/Target/DirectX/DXILShaderFlags.h
@@ -29,17 +29,17 @@ class GlobalVariable;
namespace dxil {
struct ComputedShaderFlags {
-#define SHADER_FEATURE_INFO(bit, FlagName, Str) bool FlagName : 1;
+#define SHADER_FEATURE_FLAG(bit, FlagName, Str) bool FlagName : 1;
#include "llvm/BinaryFormat/DXContainerConstants.def"
-#define SHADER_FEATURE_INFO(bit, FlagName, Str) FlagName = false;
+#define SHADER_FEATURE_FLAG(bit, FlagName, Str) FlagName = false;
ComputedShaderFlags() {
#include "llvm/BinaryFormat/DXContainerConstants.def"
}
operator uint64_t() const {
uint64_t FlagValue = 0;
-#define SHADER_FEATURE_INFO(bit, FlagName, Str) \
+#define SHADER_FEATURE_FLAG(bit, FlagName, Str) \
FlagValue |= \
FlagName ? static_cast<uint64_t>(dxbc::FeatureFlags::FlagName) : 0ull;
#include "llvm/BinaryFormat/DXContainerConstants.def"
>From dd75cc021c78ff0df8b5565d45ce3ddf5bc0c604 Mon Sep 17 00:00:00 2001
From: Xiang Li <python3kgae at outlook.com>
Date: Mon, 26 Feb 2024 15:04:05 -0500
Subject: [PATCH 4/5] Rename ShaderFlags to ShaderFeatureFlags for DXContainer.
---
llvm/include/llvm/Object/DXContainer.h | 6 +++---
llvm/include/llvm/ObjectYAML/DXContainerYAML.h | 12 ++++++------
llvm/lib/Object/DXContainer.cpp | 8 ++++----
llvm/lib/ObjectYAML/DXContainerYAML.cpp | 8 ++++----
llvm/tools/obj2yaml/dxcontainer2yaml.cpp | 4 ++--
5 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/llvm/include/llvm/Object/DXContainer.h b/llvm/include/llvm/Object/DXContainer.h
index a7f18c79969803..765f2e530de3a9 100644
--- a/llvm/include/llvm/Object/DXContainer.h
+++ b/llvm/include/llvm/Object/DXContainer.h
@@ -276,7 +276,7 @@ class DXContainer {
dxbc::Header Header;
SmallVector<uint32_t, 4> PartOffsets;
std::optional<DXILData> DXIL;
- std::optional<uint64_t> ShaderFlags;
+ std::optional<uint64_t> ShaderFeatureFlags;
std::optional<dxbc::ShaderHash> Hash;
std::optional<DirectX::PSVRuntimeInfo> PSVInfo;
DirectX::Signature InputSignature;
@@ -286,7 +286,7 @@ class DXContainer {
Error parseHeader();
Error parsePartOffsets();
Error parseDXILHeader(StringRef Part);
- Error parseShaderFlags(StringRef Part);
+ Error parseShaderFeatureFlags(StringRef Part);
Error parseHash(StringRef Part);
Error parsePSVInfo(StringRef Part);
Error parseSignature(StringRef Part, DirectX::Signature &Array);
@@ -368,7 +368,7 @@ class DXContainer {
const std::optional<DXILData> &getDXIL() const { return DXIL; }
- std::optional<uint64_t> getShaderFlags() const { return ShaderFlags; }
+ std::optional<uint64_t> getShaderFeatureFlags() const { return ShaderFeatureFlags; }
std::optional<dxbc::ShaderHash> getShaderHash() const { return Hash; }
diff --git a/llvm/include/llvm/ObjectYAML/DXContainerYAML.h b/llvm/include/llvm/ObjectYAML/DXContainerYAML.h
index 5e8c894a0f4052..497f82bbd0f32a 100644
--- a/llvm/include/llvm/ObjectYAML/DXContainerYAML.h
+++ b/llvm/include/llvm/ObjectYAML/DXContainerYAML.h
@@ -57,9 +57,9 @@ struct DXILProgram {
};
#define SHADER_FEATURE_FLAG(Num, Val, Str) bool Val = false;
-struct ShaderFlags {
- ShaderFlags() = default;
- ShaderFlags(uint64_t FlagData);
+struct ShaderFeatureFlags {
+ ShaderFeatureFlags() = default;
+ ShaderFeatureFlags(uint64_t FlagData);
uint64_t getEncodedFlags();
#include "llvm/BinaryFormat/DXContainerConstants.def"
};
@@ -151,7 +151,7 @@ struct Part {
std::string Name;
uint32_t Size;
std::optional<DXILProgram> Program;
- std::optional<ShaderFlags> Flags;
+ std::optional<ShaderFeatureFlags> Flags;
std::optional<ShaderHash> Hash;
std::optional<PSVInfo> Info;
std::optional<DXContainerYAML::Signature> Signature;
@@ -195,8 +195,8 @@ template <> struct MappingTraits<DXContainerYAML::DXILProgram> {
static void mapping(IO &IO, DXContainerYAML::DXILProgram &Program);
};
-template <> struct MappingTraits<DXContainerYAML::ShaderFlags> {
- static void mapping(IO &IO, DXContainerYAML::ShaderFlags &Flags);
+template <> struct MappingTraits<DXContainerYAML::ShaderFeatureFlags> {
+ static void mapping(IO &IO, DXContainerYAML::ShaderFeatureFlags &Flags);
};
template <> struct MappingTraits<DXContainerYAML::ShaderHash> {
diff --git a/llvm/lib/Object/DXContainer.cpp b/llvm/lib/Object/DXContainer.cpp
index 0401c20b98ec8e..935749afe33852 100644
--- a/llvm/lib/Object/DXContainer.cpp
+++ b/llvm/lib/Object/DXContainer.cpp
@@ -72,13 +72,13 @@ Error DXContainer::parseDXILHeader(StringRef Part) {
return Error::success();
}
-Error DXContainer::parseShaderFlags(StringRef Part) {
- if (ShaderFlags)
+Error DXContainer::parseShaderFeatureFlags(StringRef Part) {
+ if (ShaderFeatureFlags)
return parseFailed("More than one SFI0 part is present in the file");
uint64_t FlagValue = 0;
if (Error Err = readInteger(Part, Part.begin(), FlagValue))
return Err;
- ShaderFlags = FlagValue;
+ ShaderFeatureFlags = FlagValue;
return Error::success();
}
@@ -168,7 +168,7 @@ Error DXContainer::parsePartOffsets() {
return Err;
break;
case dxbc::PartType::SFI0:
- if (Error Err = parseShaderFlags(PartData))
+ if (Error Err = parseShaderFeatureFlags(PartData))
return Err;
break;
case dxbc::PartType::HASH:
diff --git a/llvm/lib/ObjectYAML/DXContainerYAML.cpp b/llvm/lib/ObjectYAML/DXContainerYAML.cpp
index 2804adb1dd919a..7dc9822bdd221d 100644
--- a/llvm/lib/ObjectYAML/DXContainerYAML.cpp
+++ b/llvm/lib/ObjectYAML/DXContainerYAML.cpp
@@ -23,13 +23,13 @@ namespace llvm {
static_assert((uint64_t)dxbc::FeatureFlags::NextUnusedBit <= 1ull << 63,
"Shader flag bits exceed enum size.");
-DXContainerYAML::ShaderFlags::ShaderFlags(uint64_t FlagData) {
+DXContainerYAML::ShaderFeatureFlags::ShaderFeatureFlags(uint64_t FlagData) {
#define SHADER_FEATURE_FLAG(Num, Val, Str) \
Val = (FlagData & (uint64_t)dxbc::FeatureFlags::Val) > 0;
#include "llvm/BinaryFormat/DXContainerConstants.def"
}
-uint64_t DXContainerYAML::ShaderFlags::getEncodedFlags() {
+uint64_t DXContainerYAML::ShaderFeatureFlags::getEncodedFlags() {
uint64_t Flag = 0;
#define SHADER_FEATURE_FLAG(Num, Val, Str) \
if (Val) \
@@ -103,8 +103,8 @@ void MappingTraits<DXContainerYAML::DXILProgram>::mapping(
IO.mapOptional("DXIL", Program.DXIL);
}
-void MappingTraits<DXContainerYAML::ShaderFlags>::mapping(
- IO &IO, DXContainerYAML::ShaderFlags &Flags) {
+void MappingTraits<DXContainerYAML::ShaderFeatureFlags>::mapping(
+ IO &IO, DXContainerYAML::ShaderFeatureFlags &Flags) {
#define SHADER_FEATURE_FLAG(Num, Val, Str) IO.mapRequired(#Val, Flags.Val);
#include "llvm/BinaryFormat/DXContainerConstants.def"
}
diff --git a/llvm/tools/obj2yaml/dxcontainer2yaml.cpp b/llvm/tools/obj2yaml/dxcontainer2yaml.cpp
index b58d7cd952aff0..69d9b9a2f784f7 100644
--- a/llvm/tools/obj2yaml/dxcontainer2yaml.cpp
+++ b/llvm/tools/obj2yaml/dxcontainer2yaml.cpp
@@ -71,10 +71,10 @@ dumpDXContainer(MemoryBufferRef Source) {
break;
}
case dxbc::PartType::SFI0: {
- std::optional<uint64_t> Flags = Container.getShaderFlags();
+ std::optional<uint64_t> Flags = Container.getShaderFeatureFlags();
// Omit the flags in the YAML if they are missing or zero.
if (Flags && *Flags > 0)
- NewPart.Flags = DXContainerYAML::ShaderFlags(*Flags);
+ NewPart.Flags = DXContainerYAML::ShaderFeatureFlags(*Flags);
break;
}
case dxbc::PartType::HASH: {
>From a573e036723a07c8baf6e0d73e7c616655699f51 Mon Sep 17 00:00:00 2001
From: Xiang Li <python3kgae at outlook.com>
Date: Mon, 26 Feb 2024 15:14:54 -0500
Subject: [PATCH 5/5] Fix format.
---
llvm/include/llvm/Object/DXContainer.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/llvm/include/llvm/Object/DXContainer.h b/llvm/include/llvm/Object/DXContainer.h
index 765f2e530de3a9..b6e3d321da2461 100644
--- a/llvm/include/llvm/Object/DXContainer.h
+++ b/llvm/include/llvm/Object/DXContainer.h
@@ -368,7 +368,9 @@ class DXContainer {
const std::optional<DXILData> &getDXIL() const { return DXIL; }
- std::optional<uint64_t> getShaderFeatureFlags() const { return ShaderFeatureFlags; }
+ std::optional<uint64_t> getShaderFeatureFlags() const {
+ return ShaderFeatureFlags;
+ }
std::optional<dxbc::ShaderHash> getShaderHash() const { return Hash; }
More information about the llvm-commits
mailing list