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 vulkan validation features for debugPrintfEXT, shader source debugging #78883

Conversation

briansemrau
Copy link
Contributor

@briansemrau briansemrau commented Jun 30, 2023

To debug unusual issues within compute shaders in a project, I had to enable some vulkan features for debugPrintfEXT and shader source debugging in RenderDoc.

This enables you to add this to your shaders:

#extension GL_EXT_debug_printf : enable
// ...
void main() {
    debugPrintfEXT("Running shader!");
}

output:

VALIDATION - Message Id Number: -1841738615 | Message Id Name: UNASSIGNED-DEBUG-PRINTF
        Validation Information: [ UNASSIGNED-DEBUG-PRINTF ] Object 0: handle = 0x145320d9e20, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x92394c89 | Running shader!
        Objects - 1
                Object[0] - VK_OBJECT_TYPE_DEVICE, Handle 1396704124448

To enable this feature, use the command line option --gpu-validation-features and enable the debug printf preset in Vulkan Configurator.


Additionally, this option enables compiling SPIR-V shaders with source strings included for source-level debugging in RenderDoc. (Perhaps this should be a separate option?)

To do this:

  1. open project in editor with --gpu-validation-features and make sure shaders are imported
  2. put a breakpoint in Main::setup
  3. launch the project godot.windows.editor.x86_64.exe --path pathToProj --gpu-validation-features
  4. RenderDoc -> Tools -> Settings -> General -> Enable process injection
  5. inject into godot
  6. resume from breakpoint and debug shaders

@briansemrau briansemrau force-pushed the feature/vulkan-shader-debugging branch from 62281d2 to 85d95e7 Compare June 30, 2023 18:52
@briansemrau briansemrau marked this pull request as ready for review June 30, 2023 18:57
@briansemrau briansemrau requested review from a team as code owners June 30, 2023 18:57
@clayjohn
Copy link
Member

See #77975 which has a few more tweaks in the glslang module

@briansemrau
Copy link
Contributor Author

See #77975 which has a few more tweaks in the glslang module

Ah, didn't see that PR. I could trim that out of this PR and just keep debugPrintfEXT

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

Successfully merging this pull request may close these issues.

None yet

4 participants