Skip to content

Commit ad66e54

Browse files
authored
[DirectX] Revise descriptions of DXIL module flags (#133543)
This PR revises the descriptions of DXIL module flags. Descriptions such as `D3D11_1_SB_GLOBAL_FLAG_SKIP_OPTIMIZATION` are referring to Global Flags in DXBC. DXBC is not a supported backend target, so references to DXBC should not be present. There is also confusion with regards to the description of the `LowPrecisionPresent` DXIL module flag, which currently reads `D3D11_1_SB_GLOBAL_FLAG_ENABLE_MINIMUM_PRECISION` and implies the use of minimum-precision to handle 16-bit types. However this is not true, because both the flags `LowPrecisionPresent` and `UseNativeLowPrecision` can simultaneously be set in the same DXIL module, and minimum precision mode is mutually exclusive with native low precision. This PR revises the description of the `LowPrecisionPresent` flag to accurately describe what it represents.
1 parent f37ab15 commit ad66e54

17 files changed

+36
-22
lines changed

llvm/include/llvm/BinaryFormat/DXContainerConstants.def

+12-10
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ CONTAINER_PART(PSG1)
1717
// SHADER_FEATURE_FLAG(bit offset for the shader info flag, bit offset for DXIL module flag, name, description.
1818

1919
SHADER_FEATURE_FLAG(0, 2, Doubles, "Double-precision floating point")
20-
SHADER_FEATURE_FLAG(1, 17, ComputeShadersPlusRawAndStructuredBuffers, "Raw and Structured buffers")
20+
SHADER_FEATURE_FLAG(1, 17, ComputeShadersPlusRawAndStructuredBuffers, "CS4 raw and structured buffers")
2121
SHADER_FEATURE_FLAG(2, 16, UAVsAtEveryStage, "UAVs at every shader stage")
2222
SHADER_FEATURE_FLAG(3, 15, Max64UAVs, "64 UAV slots")
2323
SHADER_FEATURE_FLAG(4, -1, MinimumPrecision, "Minimum-precision data types")
@@ -43,12 +43,14 @@ SHADER_FEATURE_FLAG(23, 28, AtomicInt64OnGroupShared, "64-bit Atomics on Group S
4343
SHADER_FEATURE_FLAG(24, 29, DerivativesInMeshAndAmpShaders, "Derivatives in mesh and amplification shaders")
4444
SHADER_FEATURE_FLAG(25, 30, ResourceDescriptorHeapIndexing, "Resource descriptor heap indexing")
4545
SHADER_FEATURE_FLAG(26, 31, SamplerDescriptorHeapIndexing, "Sampler descriptor heap indexing")
46-
SHADER_FEATURE_FLAG(27, 63, RESERVED, "<RESERVED>")
46+
SHADER_FEATURE_FLAG(27, 36, RESERVED, "<RESERVED>")
4747
SHADER_FEATURE_FLAG(28, 32, AtomicInt64OnHeapResource, "64-bit Atomics on Heap Resources")
4848
SHADER_FEATURE_FLAG(29, 34, AdvancedTextureOps, "Advanced Texture Ops")
4949
SHADER_FEATURE_FLAG(30, 35, WriteableMSAATextures, "Writeable MSAA Textures")
50+
SHADER_FEATURE_FLAG(31, 37, SampleCmpWithGradientOrBias, "SampleCmp with gradient or bias")
51+
SHADER_FEATURE_FLAG(32, 38, ExtendedCommandInfo, "Extended command information")
5052

51-
SHADER_FEATURE_FLAG(31, 36, NextUnusedBit, "Next reserved shader flag bit (not a flag)")
53+
SHADER_FEATURE_FLAG(33, 39, NextUnusedBit, "Next reserved shader flag bit (not a flag)")
5254

5355
#undef SHADER_FEATURE_FLAG
5456
#endif // SHADER_FEATURE_FLAG
@@ -94,13 +96,13 @@ SHADER_VISIBILITY(7, Mesh)
9496
#ifdef DXIL_MODULE_FLAG
9597

9698
// Only save DXIL module flags which not map to feature flags here.
97-
DXIL_MODULE_FLAG( 0, DisableOptimizations, "D3D11_1_SB_GLOBAL_FLAG_SKIP_OPTIMIZATION")
98-
DXIL_MODULE_FLAG( 1, DisableMathRefactoring, "D3D10_SB_GLOBAL_FLAG_REFACTORING_ALLOWED")
99-
DXIL_MODULE_FLAG( 3, ForceEarlyDepthStencil, "D3D11_SB_GLOBAL_FLAG_FORCE_EARLY_DEPTH_STENCIL")
100-
DXIL_MODULE_FLAG( 4, EnableRawAndStructuredBuffers, "Raw and Structured buffers")
101-
DXIL_MODULE_FLAG( 5, LowPrecisionPresent, "D3D11_1_SB_GLOBAL_FLAG_ENABLE_MINIMUM_PRECISION")
102-
DXIL_MODULE_FLAG( 8, AllResourcesBound, "D3D12_SB_GLOBAL_FLAG_ALL_RESOURCES_BOUND")
103-
DXIL_MODULE_FLAG(23, UseNativeLowPrecision, "Native 16bit types enabled")
99+
DXIL_MODULE_FLAG( 0, DisableOptimizations, "Disable shader optimizations")
100+
DXIL_MODULE_FLAG( 1, DisableMathRefactoring, "Disable math refactoring")
101+
DXIL_MODULE_FLAG( 3, ForceEarlyDepthStencil, "Force early depth-stencil test")
102+
DXIL_MODULE_FLAG( 4, EnableRawAndStructuredBuffers, "Raw and structured buffers")
103+
DXIL_MODULE_FLAG( 5, LowPrecisionPresent, "Low-precision data types")
104+
DXIL_MODULE_FLAG( 8, AllResourcesBound, "All resources bound for the duration of shader execution")
105+
DXIL_MODULE_FLAG(23, UseNativeLowPrecision, "Use native low precision")
104106
DXIL_MODULE_FLAG(33, ResMayNotAlias, "Any UAV may not alias any other UAV")
105107

106108
#undef DXIL_MODULE_FLAG

llvm/test/CodeGen/DirectX/ShaderFlags/disable-opt-cs.ll

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
; CHECK-NEXT: ; Shader Flags Value: 0x00000001
66

77
; CHECK: ; Note: extra DXIL module flags:
8-
; CHECK-NEXT: ; D3D11_1_SB_GLOBAL_FLAG_SKIP_OPTIMIZATION
8+
; CHECK-NEXT: ; Disable shader optimizations
99

1010
; CHECK: ; Shader Flags for Module Functions
1111
; CHECK: ; Function main : 0x00000000

llvm/test/CodeGen/DirectX/ShaderFlags/disable-opt-lib.ll

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
; CHECK-NEXT: ; Shader Flags Value: 0x00000001
66

77
; CHECK: ; Note: extra DXIL module flags:
8-
; CHECK-NEXT: ; D3D11_1_SB_GLOBAL_FLAG_SKIP_OPTIMIZATION
8+
; CHECK-NEXT: ; Disable shader optimizations
99

1010
; CHECK: ; Shader Flags for Module Functions
1111
; CHECK: ; Function main : 0x00000000

llvm/test/CodeGen/DirectX/ShaderFlags/low-precision.ll

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ target triple = "dxil-pc-shadermodel6.7-library"
77
;CHECK-NEXT: ;
88
;CHECK-NEXT: ; Note: shader requires additional functionality:
99
;CHECK-NEXT: ; Note: extra DXIL module flags:
10-
;CHECK-NEXT: ; D3D11_1_SB_GLOBAL_FLAG_ENABLE_MINIMUM_PRECISION
10+
;CHECK-NEXT: ; Low-precision data types
1111
;CHECK-NEXT: ;
1212
;CHECK-NEXT: ; Shader Flags for Module Functions
1313

llvm/test/CodeGen/DirectX/ShaderFlags/raw-and-structured-buffers.ll

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ target triple = "dxil-pc-shadermodel6.7-library"
99
; CHECK-NEXT: Shader Flags Value: 0x00000010
1010

1111
; CHECK: Note: shader requires additional functionality:
12-
; CHECK: Raw and Structured buffers
12+
; CHECK: Raw and structured buffers
1313

1414
; CHECK: Function rawbuf : 0x00000010
1515
define float @rawbuf() "hlsl.export" {

llvm/test/CodeGen/DirectX/ShaderFlags/res-may-alias-0.ll

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ target triple = "dxil-pc-shadermodel6.8-library"
1010
; CHECK-NEXT: Shader Flags Value: 0x200000010
1111

1212
; CHECK: Note: extra DXIL module flags:
13-
; CHECK: Raw and Structured buffers
13+
; CHECK: Raw and structured buffers
1414
; CHECK: Any UAV may not alias any other UAV
1515
;
1616

llvm/test/CodeGen/DirectX/ShaderFlags/res-may-alias-1.ll

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ target triple = "dxil-pc-shadermodel6.8-library"
1010
; CHECK-NEXT: Shader Flags Value: 0x00000010
1111

1212
; CHECK: Note: extra DXIL module flags:
13-
; CHECK: Raw and Structured buffers
13+
; CHECK: Raw and structured buffers
1414
; CHECK-NOT: Any UAV may not alias any other UAV
1515
;
1616

llvm/test/CodeGen/DirectX/ShaderFlags/res-may-not-alias-sm6.6.ll

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ target triple = "dxil-pc-shadermodel6.6-library"
1010
; CHECK-NEXT: Shader Flags Value: 0x00000010
1111

1212
; CHECK: Note: extra DXIL module flags:
13-
; CHECK: Raw and Structured buffers
13+
; CHECK: Raw and structured buffers
1414
; CHECK-NOT: Any UAV may not alias any other UAV
1515
;
1616

llvm/test/CodeGen/DirectX/ShaderFlags/res-may-not-alias-sm6.7.ll

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ target triple = "dxil-pc-shadermodel6.7-library"
1111
; CHECK-NEXT: Shader Flags Value: 0x200000010
1212

1313
; CHECK: Note: extra DXIL module flags:
14-
; CHECK: Raw and Structured buffers
14+
; CHECK: Raw and structured buffers
1515
; CHECK: Any UAV may not alias any other UAV
1616
;
1717

llvm/test/CodeGen/DirectX/ShaderFlags/res-may-not-alias-valver1.8.ll

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ target triple = "dxil-pc-shadermodel6.7-library"
1111
; CHECK-NEXT: Shader Flags Value: 0x200000010
1212

1313
; CHECK: Note: extra DXIL module flags:
14-
; CHECK: Raw and Structured buffers
14+
; CHECK: Raw and structured buffers
1515
; CHECK: Any UAV may not alias any other UAV
1616
;
1717

llvm/test/CodeGen/DirectX/ShaderFlags/use-native-low-precision-0.ll

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ target triple = "dxil-pc-shadermodel6.7-library"
1010
;CHECK-NEXT: ;
1111
;CHECK-NEXT: ; Note: shader requires additional functionality:
1212
;CHECK-NEXT: ; Note: extra DXIL module flags:
13-
;CHECK-NEXT: ; D3D11_1_SB_GLOBAL_FLAG_ENABLE_MINIMUM_PRECISION
13+
;CHECK-NEXT: ; Low-precision data types
1414
;CHECK-NOT: ; Native 16bit types enabled
1515
;CHECK-NEXT: ;
1616
;CHECK-NEXT: ; Shader Flags for Module Functions

llvm/test/CodeGen/DirectX/ShaderFlags/use-native-low-precision-1.ll

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ target triple = "dxil-pc-shadermodel6.7-library"
77
;CHECK-NEXT: ;
88
;CHECK-NEXT: ; Note: shader requires additional functionality:
99
;CHECK-NEXT: ; Note: extra DXIL module flags:
10-
;CHECK-NEXT: ; D3D11_1_SB_GLOBAL_FLAG_ENABLE_MINIMUM_PRECISION
11-
;CHECK-NEXT: ; Native 16bit types enabled
10+
;CHECK-NEXT: ; Low-precision data types
11+
;CHECK-NEXT: ; Use native low precision
1212
;CHECK-NEXT: ;
1313
;CHECK-NEXT: ; Shader Flags for Module Functions
1414

llvm/test/ObjectYAML/DXContainer/DomainMaskVectors.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ Parts:
4444
AtomicInt64OnHeapResource: false
4545
AdvancedTextureOps: false
4646
WriteableMSAATextures: false
47+
SampleCmpWithGradientOrBias: false
48+
ExtendedCommandInfo: false
4749
NextUnusedBit: false
4850
- Name: ISG1
4951
Size: 52

llvm/test/ObjectYAML/DXContainer/GeometryMaskVectors.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ Parts:
4444
AtomicInt64OnHeapResource: false
4545
AdvancedTextureOps: false
4646
WriteableMSAATextures: false
47+
SampleCmpWithGradientOrBias: false
48+
ExtendedCommandInfo: false
4749
NextUnusedBit: false
4850
- Name: ISG1
4951
Size: 120

llvm/test/ObjectYAML/DXContainer/HullMaskVectors.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ Parts:
4444
AtomicInt64OnHeapResource: false
4545
AdvancedTextureOps: false
4646
WriteableMSAATextures: false
47+
SampleCmpWithGradientOrBias: false
48+
ExtendedCommandInfo: false
4749
NextUnusedBit: false
4850
- Name: ISG1
4951
Size: 60

llvm/test/tools/obj2yaml/DXContainer/ShaderFlags.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ Parts:
4444
AtomicInt64OnHeapResource: false
4545
AdvancedTextureOps: true
4646
WriteableMSAATextures: false
47+
SampleCmpWithGradientOrBias: false
48+
ExtendedCommandInfo: false
4749
NextUnusedBit: true
4850
- Name: FKE0
4951
Size: 8
@@ -84,4 +86,6 @@ Parts:
8486
# CHECK-NEXT: AtomicInt64OnHeapResource: false
8587
# CHECK-NEXT: AdvancedTextureOps: true
8688
# CHECK-NEXT: WriteableMSAATextures: false
89+
# CHECK-NEXT: SampleCmpWithGradientOrBias: false
90+
# CHECK-NEXT: ExtendedCommandInfo: false
8791
# CHECK-NEXT: NextUnusedBit: true

llvm/test/tools/obj2yaml/DXContainer/ShaderFlagsEmpty.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ Parts:
4343
AtomicInt64OnHeapResource: false
4444
AdvancedTextureOps: false
4545
WriteableMSAATextures: false
46+
SampleCmpWithGradientOrBias: false
47+
ExtendedCommandInfo: false
4648
NextUnusedBit: false
4749
- Name: FKE0
4850
Size: 8

0 commit comments

Comments
 (0)