Skip to content
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

Add debugPrintf to wgsl #2563

Closed
wants to merge 9 commits into from
Closed

Add debugPrintf to wgsl #2563

wants to merge 9 commits into from

Conversation

exrook
Copy link
Contributor

@exrook exrook commented Oct 16, 2023

Moved to gfx-rs/wgpu#4297

We can have printf in shaders :)

Supports wgsl-in, spv-in, spv-out, hlsl-out, glsl-out

Supporting glsl-in would need changes upstream in https://github.com/Kangz/glslpp-rs/ to parse the format strings.

msl has no support for this sort of feature as far as I can tell.

for more info see: https://github.com/KhronosGroup/Vulkan-ValidationLayers/blob/main/docs/debug_printf.md

cc: gfx-rs/wgpu#4410

@exrook exrook requested a review from a team as a code owner October 16, 2023 20:01
@exrook exrook force-pushed the debug_printf branch 6 times, most recently from fbae219 to 751ca91 Compare October 17, 2023 01:42
@exrook
Copy link
Contributor Author

exrook commented Oct 17, 2023

I'm disabling the test for hlsl-out since dxc doesn't support printf when outputting dxil. I'll keep the hlsl-out feature in since it still does work with fxc, and with dxc when targeting spirv.

@jimblandy
Copy link
Member

If I understand our plan correctly, I think this needs a bit in valid::Capabilities as well.

@jimblandy
Copy link
Member

Tragically, Mesa doesn't support SPV_KHR_non_semantic_info, so I can't try this out.

@exrook
Copy link
Contributor Author

exrook commented Oct 20, 2023

Tragically, Mesa doesn't support SPV_KHR_non_semantic_info, so I can't try this out.

It's working on my machine with mesa 23.2.1 ;) , although I had to explicitly enable printf in the validation layer using the vulkan configurator in order to see output. I think it's possible to programmatically enable as well but I haven't looked into that yet.

I also have a local patch to wgpu that enables VK_KHR_shader_non_semantic_info but that doesn't seem to have any effect, my shader compiles & runs regardless of whether it's enabled or not.

If I understand our plan correctly, I think this needs a bit in valid::Capabilities as well.

I'll try to figure this out, currently no other Statements interact with Capabilities so it's not immediately obvious to me where the check should end up.

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

Successfully merging this pull request may close these issues.

3 participants