Repository navigation
[SPIRV] Generate debug info from original source #9024
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
Open
Steve Urquhart (SteveUrquhart)
wants to merge
2
commits into
microsoft:main
Choose a base branch
from
SteveUrquhart:spirv-debug-no-preprocess
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+71
−37
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| // RUN: %dxc -T ps_6_0 -E main -spirv -fspv-debug=vulkan-with-source %s | FileCheck %s | ||
|
|
||
| #include "spirv.debug.columns.include.hlsli" | ||
| #include "spirv.debug.columns.include.hlsli" | ||
|
|
||
| #define DEFINE_CB(n)\ | ||
| cbuffer CB##n : register(b0, space##n) {\ | ||
| float4 dummy_1;\ | ||
| } | ||
|
|
||
| DEFINE_CB(1) | ||
|
|
||
| float4 main(float4 c : COLOR) : SV_Target0 { | ||
| /* a comment that preprocessing removes */ float v = SCALE_AND_BIAS_THE_VALUE(c.x); float w = v; | ||
|
SteveUrquhart marked this conversation as resolved.
|
||
| return OUT_COL * w + dummy_1; | ||
| } | ||
|
|
||
| // Debug columns refer to the original source, including on lines that contain | ||
| // a macro expansion or a comment, a cbuffer declared through a macro is located | ||
| // at its expansion, and the define-only header included twice gets one | ||
| // DebugSource. | ||
|
|
||
| // CHECK: [[inc:%[0-9]+]] = OpString "{{.*}}spirv.debug.columns.include.hlsli" | ||
| // CHECK: [[w:%[0-9]+]] = OpString "w" | ||
| // CHECK: [[v:%[0-9]+]] = OpString "v" | ||
| // CHECK: [[member:%[0-9]+]] = OpString "dummy_1" | ||
| // CHECK: [[type:%[0-9]+]] = OpString "type.CB1" | ||
| // CHECK: DebugSource [[inc]] | ||
| // CHECK-NOT: DebugSource [[inc]] | ||
| // CHECK: DebugLocalVariable [[w]] {{%[0-9]+}} {{%[0-9]+}} %uint_14 %uint_93 | ||
| // CHECK: DebugLocalVariable [[v]] {{%[0-9]+}} {{%[0-9]+}} %uint_14 %uint_52 | ||
| // CHECK: DebugTypeMember [[member]] {{%[0-9]+}} {{%[0-9]+}} %uint_11 %uint_1 | ||
| // CHECK: DebugTypeComposite [[type]] %uint_1 {{%[0-9]+}} %uint_11 %uint_1 | ||
2 changes: 2 additions & 0 deletions
2
tools/clang/test/CodeGenSPIRV/spirv.debug.columns.include.hlsli
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| #define SCALE_AND_BIAS_THE_VALUE(x) (x * 2.0f + 1.0f) | ||
| #define OUT_COL float4(1, 0, 1, 1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.