Skip to content

[DirectX] Revise descriptions of DXIL module flags #133543

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

Merged
merged 10 commits into from
Apr 29, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
16 changes: 8 additions & 8 deletions llvm/include/llvm/BinaryFormat/DXContainerConstants.def
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ CONTAINER_PART(PSG1)
// SHADER_FEATURE_FLAG(bit offset for the shader info flag, bit offset for DXIL module flag, name, description.

SHADER_FEATURE_FLAG(0, 2, Doubles, "Double-precision floating point")
SHADER_FEATURE_FLAG(1, 17, ComputeShadersPlusRawAndStructuredBuffers, "Raw and Structured buffers")
SHADER_FEATURE_FLAG(1, 17, ComputeShadersPlusRawAndStructuredBuffers, "CS4 raw and structured buffers")
Copy link
Contributor

Choose a reason for hiding this comment

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

What does CS4 mean/denote? We are also not currently checking for it in the FileCheck

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A Compute Shader in Shader Model 4.x.

Clang isn't going to support SM 4.x (AFAIK), so there shouldn't be a need to test for it.

SHADER_FEATURE_FLAG(2, 16, UAVsAtEveryStage, "UAVs at every shader stage")
SHADER_FEATURE_FLAG(3, 15, Max64UAVs, "64 UAV slots")
SHADER_FEATURE_FLAG(4, -1, MinimumPrecision, "Minimum-precision data types")
Expand Down Expand Up @@ -76,13 +76,13 @@ ROOT_ELEMENT_FLAG(11, SamplerHeapDirectlyIndexed)
#ifdef DXIL_MODULE_FLAG

// Only save DXIL module flags which not map to feature flags here.
DXIL_MODULE_FLAG( 0, DisableOptimizations, "D3D11_1_SB_GLOBAL_FLAG_SKIP_OPTIMIZATION")
DXIL_MODULE_FLAG( 1, DisableMathRefactoring, "D3D10_SB_GLOBAL_FLAG_REFACTORING_ALLOWED")
DXIL_MODULE_FLAG( 3, ForceEarlyDepthStencil, "D3D11_SB_GLOBAL_FLAG_FORCE_EARLY_DEPTH_STENCIL")
DXIL_MODULE_FLAG( 4, EnableRawAndStructuredBuffers, "Raw and Structured buffers")
DXIL_MODULE_FLAG( 5, LowPrecisionPresent, "D3D11_1_SB_GLOBAL_FLAG_ENABLE_MINIMUM_PRECISION")
DXIL_MODULE_FLAG( 8, AllResourcesBound, "D3D12_SB_GLOBAL_FLAG_ALL_RESOURCES_BOUND")
DXIL_MODULE_FLAG(23, UseNativeLowPrecision, "Native 16bit types enabled")
DXIL_MODULE_FLAG( 0, DisableOptimizations, "Disable shader optimizations")
DXIL_MODULE_FLAG( 1, DisableMathRefactoring, "Disable math refactoring")
DXIL_MODULE_FLAG( 3, ForceEarlyDepthStencil, "Force early depth-stencil test")
DXIL_MODULE_FLAG( 4, EnableRawAndStructuredBuffers, "Raw and structured buffers")
DXIL_MODULE_FLAG( 5, LowPrecisionPresent, "Low-precision data types")
DXIL_MODULE_FLAG( 8, AllResourcesBound, "All resources bound")
DXIL_MODULE_FLAG(23, UseNativeLowPrecision, "Native 16-bit types enabled")
DXIL_MODULE_FLAG(33, ResMayNotAlias, "Any UAV may not alias any other UAV")

#undef DXIL_MODULE_FLAG
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/DirectX/ShaderFlags/disable-opt-cs.ll
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
; CHECK-NEXT: ; Shader Flags Value: 0x00000001

; CHECK: ; Note: extra DXIL module flags:
; CHECK-NEXT: ; D3D11_1_SB_GLOBAL_FLAG_SKIP_OPTIMIZATION
; CHECK-NEXT: ; Disable shader optimizations

; CHECK: ; Shader Flags for Module Functions
; CHECK: ; Function main : 0x00000000
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/DirectX/ShaderFlags/disable-opt-lib.ll
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
; CHECK-NEXT: ; Shader Flags Value: 0x00000001

; CHECK: ; Note: extra DXIL module flags:
; CHECK-NEXT: ; D3D11_1_SB_GLOBAL_FLAG_SKIP_OPTIMIZATION
; CHECK-NEXT: ; Disable shader optimizations

; CHECK: ; Shader Flags for Module Functions
; CHECK: ; Function main : 0x00000000
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/DirectX/ShaderFlags/low-precision.ll
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ target triple = "dxil-pc-shadermodel6.7-library"
;CHECK-NEXT: ;
;CHECK-NEXT: ; Note: shader requires additional functionality:
;CHECK-NEXT: ; Note: extra DXIL module flags:
;CHECK-NEXT: ; D3D11_1_SB_GLOBAL_FLAG_ENABLE_MINIMUM_PRECISION
;CHECK-NEXT: ; Low-precision data types
;CHECK-NEXT: ;
;CHECK-NEXT: ; Shader Flags for Module Functions

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ target triple = "dxil-pc-shadermodel6.7-library"
; CHECK-NEXT: Shader Flags Value: 0x00000010

; CHECK: Note: shader requires additional functionality:
; CHECK: Raw and Structured buffers
; CHECK: Raw and structured buffers

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