Added new toggle EmitHLSLDebugSymbols to improve shader debugging capabilities by external tools.

Bug: dawn:776
Change-Id: I1a9082463ee61d7b0427740b4075d6a69c3b5946
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/52282
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Francois Guthmann 2021-06-01 18:46:03 +00:00 committed by Dawn LUCI CQ
parent 8d67ca58be
commit f56dab0d72
5 changed files with 23 additions and 10 deletions

View File

@ -176,10 +176,15 @@ namespace dawn_native {
"GPUs which have a driver bug in the execution of CopyTextureRegion() when we copy " "GPUs which have a driver bug in the execution of CopyTextureRegion() when we copy "
"with the formats whose texel block sizes are less than 4 bytes from a greater mip " "with the formats whose texel block sizes are less than 4 bytes from a greater mip "
"level to a smaller mip level on D3D12 backends.", "level to a smaller mip level on D3D12 backends.",
"https://crbug.com/1161355"}} "https://crbug.com/1161355"}},
{Toggle::EmitHLSLDebugSymbols,
{"emit_hlsl_debug_symbols",
"Sets the D3DCOMPILE_SKIP_OPTIMIZATION and D3DCOMPILE_DEBUG compilation flags when "
"compiling HLSL code. Enables better shader debugging with external graphics "
"debugging tools.",
"https://crbug.com/dawn/776"}}
// Dummy comment to separate the }} so it is clearer what to copy-paste to add a toggle. // Dummy comment to separate the }} so it is clearer what to copy-paste to add a toggle.
}}; }};
} // anonymous namespace } // anonymous namespace
void TogglesSet::Set(Toggle toggle, bool enabled) { void TogglesSet::Set(Toggle toggle, bool enabled) {

View File

@ -51,6 +51,7 @@ namespace dawn_native {
UseTintGenerator, UseTintGenerator,
FlushBeforeClientWaitSync, FlushBeforeClientWaitSync,
UseTempBufferInSmallFormatTextureToTextureCopyFromGreaterToLessMipLevel, UseTempBufferInSmallFormatTextureToTextureCopyFromGreaterToLessMipLevel,
EmitHLSLDebugSymbols,
EnumCount, EnumCount,
InvalidEnum = EnumCount, InvalidEnum = EnumCount,

View File

@ -35,10 +35,11 @@ namespace dawn_native { namespace d3d12 {
MaybeError ComputePipeline::Initialize(const ComputePipelineDescriptor* descriptor) { MaybeError ComputePipeline::Initialize(const ComputePipelineDescriptor* descriptor) {
Device* device = ToBackend(GetDevice()); Device* device = ToBackend(GetDevice());
uint32_t compileFlags = 0; uint32_t compileFlags = 0;
#if defined(_DEBUG)
// Enable better shader debugging with the graphics debugging tools. if (device->IsToggleEnabled(Toggle::EmitHLSLDebugSymbols)) {
compileFlags |= D3DCOMPILE_DEBUG | D3DCOMPILE_SKIP_OPTIMIZATION; compileFlags |= D3DCOMPILE_DEBUG | D3DCOMPILE_SKIP_OPTIMIZATION;
#endif }
// SPRIV-cross does matrix multiplication expecting row major matrices // SPRIV-cross does matrix multiplication expecting row major matrices
compileFlags |= D3DCOMPILE_PACK_MATRIX_ROW_MAJOR; compileFlags |= D3DCOMPILE_PACK_MATRIX_ROW_MAJOR;

View File

@ -541,6 +541,11 @@ namespace dawn_native { namespace d3d12 {
SetToggle(Toggle::UseDXC, false); SetToggle(Toggle::UseDXC, false);
SetToggle(Toggle::UseTintGenerator, false); SetToggle(Toggle::UseTintGenerator, false);
#if defined(_DEBUG)
// Enable better shader debugging with the graphics debugging tools.
SetToggle(Toggle::EmitHLSLDebugSymbols, true);
#endif
// By default use the maximum shader-visible heap size allowed. // By default use the maximum shader-visible heap size allowed.
SetToggle(Toggle::UseD3D12SmallShaderVisibleHeapForTesting, false); SetToggle(Toggle::UseD3D12SmallShaderVisibleHeapForTesting, false);

View File

@ -335,10 +335,11 @@ namespace dawn_native { namespace d3d12 {
MaybeError RenderPipeline::Initialize(const RenderPipelineDescriptor* descriptor) { MaybeError RenderPipeline::Initialize(const RenderPipelineDescriptor* descriptor) {
Device* device = ToBackend(GetDevice()); Device* device = ToBackend(GetDevice());
uint32_t compileFlags = 0; uint32_t compileFlags = 0;
#if defined(_DEBUG)
// Enable better shader debugging with the graphics debugging tools. if (device->IsToggleEnabled(Toggle::EmitHLSLDebugSymbols)) {
compileFlags |= D3DCOMPILE_DEBUG | D3DCOMPILE_SKIP_OPTIMIZATION; compileFlags |= D3DCOMPILE_DEBUG | D3DCOMPILE_SKIP_OPTIMIZATION;
#endif }
// SPRIV-cross does matrix multiplication expecting row major matrices // SPRIV-cross does matrix multiplication expecting row major matrices
compileFlags |= D3DCOMPILE_PACK_MATRIX_ROW_MAJOR; compileFlags |= D3DCOMPILE_PACK_MATRIX_ROW_MAJOR;