-
Notifications
You must be signed in to change notification settings - Fork 796
[NFC] Edit DXIL module flag comments for clarity #7271
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -220,24 +220,36 @@ class ShaderFlags { | |
bool GetRequiresGroup() const { return m_bRequiresGroup; } | ||
|
||
private: | ||
// Each of the shader flags are defined below within a bitfield to form the | ||
// shader flag bitmask of a DXIL module. | ||
// These shader flags are also used to set Shader Feature Info flags via the | ||
// function ShaderFlags::GetFeatureInfo(). | ||
// For DXBC, these shader flags are also used to set Global Flags via the | ||
// function ShaderFlags::GetGlobalFlags(). | ||
|
||
// Bit: 0 | ||
unsigned | ||
m_bDisableOptimizations : 1; // D3D11_1_SB_GLOBAL_FLAG_SKIP_OPTIMIZATION | ||
unsigned | ||
m_bDisableMathRefactoring : 1; //~D3D10_SB_GLOBAL_FLAG_REFACTORING_ALLOWED | ||
unsigned | ||
m_bEnableDoublePrecision : 1; // D3D11_SB_GLOBAL_FLAG_ENABLE_DOUBLE_PRECISION_FLOAT_OPS | ||
// SHADER_FEATURE_DOUBLES | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
unsigned | ||
m_bForceEarlyDepthStencil : 1; // D3D11_SB_GLOBAL_FLAG_FORCE_EARLY_DEPTH_STENCIL | ||
|
||
// Bit: 4 | ||
unsigned | ||
m_bEnableRawAndStructuredBuffers : 1; // D3D11_SB_GLOBAL_FLAG_ENABLE_RAW_AND_STRUCTURED_BUFFERS | ||
unsigned | ||
m_bLowPrecisionPresent : 1; // D3D11_1_SB_GLOBAL_FLAG_ENABLE_MINIMUM_PRECISION | ||
m_bLowPrecisionPresent : 1; // AND ~m_bUseNativeLowPrecision => D3D11_1_SB_GLOBAL_FLAG_ENABLE_MINIMUM_PRECISION | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
// AND ~m_bUseNativeLowPrecision => SHADER_FEATURE_MINIMUM_PRECISION | ||
// AND m_bUseNativeLowPrecision => SHADER_FEATURE_NATIVE_LOW_PRECISION | ||
Comment on lines
+246
to
+247
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
unsigned | ||
m_bEnableDoubleExtensions : 1; // D3D11_1_SB_GLOBAL_FLAG_ENABLE_DOUBLE_EXTENSIONS | ||
// SHADER_FEATURE_11_1_DOUBLE_EXTENSIONS | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
unsigned m_bEnableMSAD : 1; // D3D11_1_SB_GLOBAL_FLAG_ENABLE_SHADER_EXTENSIONS | ||
// SHADER_FEATURE_11_1_SHADER_EXTENSIONS | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
// Bit: 8 | ||
unsigned m_bAllResourcesBound : 1; // D3D12_SB_GLOBAL_FLAG_ALL_RESOURCES_BOUND | ||
|
@@ -253,8 +265,6 @@ class ShaderFlags { | |
m_bUAVLoadAdditionalFormats : 1; // SHADER_FEATURE_TYPED_UAV_LOAD_ADDITIONAL_FORMATS | ||
unsigned | ||
m_bLevel9ComparisonFiltering : 1; // SHADER_FEATURE_LEVEL_9_COMPARISON_FILTERING | ||
// SHADER_FEATURE_11_1_SHADER_EXTENSIONS | ||
// shared with EnableMSAD | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I removed these two lines because I see |
||
unsigned m_b64UAVs : 1; // SHADER_FEATURE_64_UAVS | ||
|
||
// Bit: 16 | ||
|
@@ -277,7 +287,7 @@ class ShaderFlags { | |
unsigned m_bBarycentrics : 1; // SHADER_FEATURE_BARYCENTRICS | ||
|
||
// SM 6.2+ | ||
unsigned m_bUseNativeLowPrecision : 1; | ||
unsigned m_bUseNativeLowPrecision : 1; // see m_bLowPrecisionPresent for uses | ||
|
||
// SM 6.4+ | ||
// Bit: 24 | ||
|
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.
These mappings seem to be taken from
DirectXShaderCompiler/projects/dxilconv/lib/DxbcConverter/DxbcConverter.cpp
Line 439 in 8280d0f
Worryingly they might not all be consistent (this one for example is not equivalent).
Also, if I search for
D3D11_1_SB_GLOBAL_FLAG_SKIP_OPTIMIZATION
in this repo and online I don't really get directed to any documentation that is helpful? Maybe I am missing something.So I might say we could remove these comments and just point to the implementation with your comment?
Uh oh!
There was an error while loading. Please reload this page.
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 best description I can find for
D3D11_1_SB_GLOBAL_FLAG_SKIP_OPTIMIZATION
is fromDirectXShaderCompiler/include/dxc/Support/d3d12TokenizedProgramFormat.hpp
Line 1194 in 8280d0f
Which implies that optimizations should be skipped by the backend/driver compiler when translating to native code.
Uh oh!
There was an error while loading. Please reload this page.
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.
Also, I don't see how the code you linked from DxbcConverter.cpp is inconsistent with these comments in DxilshaderFlags.h
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.
It has the
~
negationThere 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 it's a typo in DxbcConverter.cpp