Skip to content

[NFC] Update Shader Flags section of DXIL.rst#7295

Merged
Icohedron merged 11 commits into
microsoft:mainfrom
Icohedron:dxil-rst-shader-flags
Jun 10, 2026
Merged

[NFC] Update Shader Flags section of DXIL.rst#7295
Icohedron merged 11 commits into
microsoft:mainfrom
Icohedron:dxil-rst-shader-flags

Conversation

@Icohedron

@Icohedron Icohedron commented Apr 2, 2025

Copy link
Copy Markdown
Collaborator

Fixes #7294

This PR updates DXIL.rst to list and describe all current shader flags in DXC (from DxilShaderFlags.h).
Also adds extra columns to the table of shader flags to document the minimum shader model version and the conditions or criteria under which each shader flag is set (as seen in DxilShaderFlags.cpp and DxilModule.cpp).

Comment thread docs/DXIL.rst Outdated
Bit SM Description Criteria to set shader flag
=== ==== ======================================================================================== ==========================================================================================================================================================================================================================================================================================================================================================
0 Disable shader optimizations Command-line flag ``-disable-llvm-optzns`` provided to DXC's internal frontend
1 Disable math refactoring Not set

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It is not immediately clear what 'Not set' means in this context? Same for the others with the same criteria.

Is it that there is no set criteria, or, just if the flag is not set?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It just means the flag is not set

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I believe this is an older shader model flag. Maybe something more like: "Removed in Shader Model 6.0" is appropriate. @tex3d any thoughts?

@Icohedron Icohedron Apr 2, 2025

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Though I suppose the wording is a bit awkward because I think the intention for some of these flags is that you can set it if you wish to have its effects? Like if you want to disable math refactoring, you can set the bit for it?

The criteria is more like describing the conditions under which the flag is required to be set and the validator will complain if you use a capability without setting its corresponding bit, or set a capability bit without actually utilizing it in the shader. Though, again, this isn't entirely the case because the shader flags enabled by a command-line flag don't fall into this category.

@tex3d tex3d Jun 9, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This flag is used in the DXBC shader converter to capture the inverse of the global flag D3D10_SB_GLOBAL_FLAG_REFACTORING_ALLOWED, which may be present in the DXBC.
The closest equivalent would be -Gis, which is partly what would have driven this flag in FXC (the other part depends on the shader profile).

DXC doesn't set this flag for shaders compiled from HLSL to DXIL, since using -Gis will control this property at the operation level through fast math flags and the precise metadata.

So perhaps the more appropriate wording would be:
"Only used by DxilConv; corresponds to ~D3D10_SB_GLOBAL_FLAG_REFACTORING_ALLOWED in DXBC"

Comment thread docs/DXIL.rst Outdated
Comment thread docs/DXIL.rst Outdated
Bit SM Description Criteria to set shader flag
=== ==== ======================================================================================== ==========================================================================================================================================================================================================================================================================================================================================================
0 Disable shader optimizations Command-line flag ``-disable-llvm-optzns`` provided to DXC's internal frontend
1 Disable math refactoring Not set

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I believe this is an older shader model flag. Maybe something more like: "Removed in Shader Model 6.0" is appropriate. @tex3d any thoughts?

Comment thread docs/DXIL.rst Outdated
11 Stencil reference value The StencilRef semantic is present in the output signature of a pixel shader
12 Tiled resources Use of the CheckAccessFullyMapped instruction or, if DXIL validator version >= 1.8, the use of LodClamp in intrinsics SampleGrad, SampleCmpGrad, Sample, SampleBias, SampleCmp, or SampleCmpBias
13 Typed UAV load additional formats Use of TextureLoad or BufferLoad on a UAV with a multi-component data type. If DXIL validator version == 1.0 then this flag is set when a TextureLoad or BufferLoad is used on any UAV, regardless of its data type
14 Comparison filtering for feature level 9 Not set

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It would be good to know the context in which this was valid, but I suspect this was also removed in SM 6.0.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This maps a feature flag that is not used for DXIL shaders. We could have gotten away with omitting the flag entirely here originally, but it's here now.

I might say "Not set; Unused legacy feature requirement flag" if you wanted more context here.

Comment thread docs/DXIL.rst Outdated
@inbelic

inbelic commented Jun 17, 2025

Copy link
Copy Markdown
Collaborator

What is the status of this pr?

@Icohedron

Copy link
Copy Markdown
Collaborator Author

What is the status of this pr?

The PR needs input from @tex3d to address the comments @llvm-beanz made.

However, this PR doesn't seem urgent at the moment.

@Icohedron Icohedron requested a review from tex3d June 17, 2025 21:43
Comment thread docs/DXIL.rst Outdated
Comment thread docs/DXIL.rst Outdated
Comment thread docs/DXIL.rst Outdated
…NG_ALLOWED` for RST formatting

Co-authored-by: Tex Riddell <texr@microsoft.com>
@Icohedron Icohedron enabled auto-merge (squash) June 10, 2026 19:59
@Icohedron Icohedron merged commit c207c7b into microsoft:main Jun 10, 2026
13 checks passed
@github-project-automation github-project-automation Bot moved this from New to Done in HLSL Roadmap Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Update shader flag documentation in DXIL.rst

5 participants