Skip to content
This repository has been archived by the owner on Jan 29, 2025. It is now read-only.

add debug info for spv-out #2379

Merged
merged 4 commits into from
Jun 28, 2023
Merged

add debug info for spv-out #2379

merged 4 commits into from
Jun 28, 2023

Conversation

wicast
Copy link
Contributor

@wicast wicast commented Jun 13, 2023

make the spv with debug info mapping to wgsl

pic

here is the capture file you can try
wgsl_debug_info.zip

@wicast wicast force-pushed the spv_debug_symbol branch 2 times, most recently from 438f3bc to 33f2cd5 Compare June 13, 2023 04:21
Copy link
Member

@teoxoy teoxoy left a comment

Choose a reason for hiding this comment

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

Looks great! I left a few minor comments.

Could you also add a test for this? So that we have this as part of our snapshots.

src/lib.rs Outdated Show resolved Hide resolved
src/back/spv/writer.rs Outdated Show resolved Hide resolved
src/back/spv/writer.rs Outdated Show resolved Hide resolved
src/back/spv/writer.rs Outdated Show resolved Hide resolved
src/back/spv/block.rs Outdated Show resolved Hide resolved
@wicast wicast force-pushed the spv_debug_symbol branch from 33f2cd5 to 7bda4d2 Compare June 25, 2023 15:52
@wicast
Copy link
Contributor Author

wicast commented Jun 25, 2023

I've add some test and re-write the spv writer.
It has some troubles with OpName tracking when it compiles a complex shader see here, some of the local variables are missing,
anyway it's a usable version for debugging shaders.

the complex shader capture with compute shader:
wgsl_terrain.zip

@wicast wicast requested a review from teoxoy June 25, 2023 16:06
src/back/spv/block.rs Outdated Show resolved Hide resolved
src/back/spv/writer.rs Outdated Show resolved Hide resolved
tests/snapshots.rs Outdated Show resolved Hide resolved
@wicast wicast requested a review from teoxoy June 28, 2023 10:32
Copy link
Member

@teoxoy teoxoy left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@teoxoy teoxoy merged commit 25e4f17 into gfx-rs:master Jun 28, 2023
let mut w = Writer::new(options)?;
w.write(module, info, pipeline_options, &mut words)?;

if options.flags.contains(WriterFlags::DEBUG) {}
Copy link
Collaborator

Choose a reason for hiding this comment

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

@wicast This empty if looks like a bug

Copy link
Contributor Author

@wicast wicast Jun 29, 2023

Choose a reason for hiding this comment

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

@wicast This empty if looks like a bug

I've made a PR to fix it, alone with the other debug option fix.
BTW, clippy has add needless_if but only in newer version 1.72.0

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants