Run your own Vulkan Compute shaders & Renderdoc API support. (Update #3)


TL;DR:

  • Uploaded v0.1.1 for Linux & Windows.
  • Run your own Vulkan Compute shaders. (Select "External" from the shader selection pop-up menu & enter full file path.)
  • Added Renderdoc API support on Linux. (This was required in order to capture Vulkan Compute shaders when running within a standard Godot 3 OpenGL-based application & when running headless without generating any presentation frames.)

Thanks to everyone who took the time to take a look at my Godot Add-On Jam entry, comment & even download it to try out!

Godot 3 Vulkan Compute shader capture with Renderdoc

Here we see v0.1.1 of the downloadable demo application running (launched via Renderdoc) while Renderdoc runs in the background. At this point Renderdoc has recorded two captures of Vulkan Compute shaders manually triggered by the application via the Renderdoc API.


The Renderdoc window overlay shows that it initially sees only the OpenGL usage which is why the Vulkan Compute capture needs to be triggered manually by the application.

Here is Renderdoc displaying some of the debug output captured while running the externally supplied `.spv` compute shader file:


The shader source is:

#version 450
#extension GL_EXT_debug_printf : enable
#extension GL_EXT_device_group : enable
#extension GL_KHR_shader_subgroup_basic : enable
//
layout (local_size_x = 4, local_size_y = 4) in;
//
void main() {
//
  int some_value = 41 + 1;
//
  debugPrintfEXT("Hello Godot <3 from a Vulkan & SPIR-V Compute shader!");
  debugPrintfEXT("This value DOES Compute: %d", some_value);
  debugPrintfEXT("| %d | %v3d | %v3d |", gl_LocalInvocationIndex, gl_GlobalInvocationID, gl_WorkGroupID);
  debugPrintfEXT("| %v3d | %v3d |", gl_WorkGroupSize, gl_NumWorkGroups);
  debugPrintfEXT("| %d | %d | %d | %d | %d | ", gl_DeviceIndex, gl_NumSubgroups, gl_SubgroupID, gl_SubgroupInvocationID, gl_SubgroupSize);
//
}

So the values visible are example output from a number of different threads, e.g.:

Hello Godot <3 from a Vulkan & SPIR-V Compute shader!
This value DOES Compute: 42
| 0 | 0, 0, 0 | 0, 0, 0 |
| 4, 4, 1 | 1, 1, 1 |
| 0 | 1 | 0 | 0 | 32 |
//
Hello Godot <3 from a Vulkan & SPIR-V Compute shader!
This value DOES Compute: 42
| 4 | 0, 1, 0 | 0, 0, 0 |
| 4, 4, 1 | 1, 1, 1 |
| 0 | 1 | 0 | 4 | 32 |
//
Hello Godot <3 from a Vulkan & SPIR-V Compute shader!
This value DOES Compute: 42
| 8 | 0, 2, 0 | 0, 0, 0 |
| 4, 4, 1 | 1, 1, 1 |
| 0 | 1 | 0 | 8 | 32 |

Also in this update

Other items:

  • Added some more built-in shader examples which debug print various thread/subgroup/workgroup related values.
  • Now possible to run more than one shader per application start. :D
  • Manual control of `VK_KHR_shader_non_semantic_info` / `SPV_KHR_non_semantic_info` extension enablement via `shader_non_semantic_info` toggle. This may need to be enabled to see debug print output via Vulkan Validation Layers. It turns out it's not necessary in order for Renderdoc to capture debug print output--which is handy for GPUs/drivers that don't support the extension.
  • Still no input or output buffers.
  • Still copious amount of log spam. :D

Have fun!

Why not download the new v0.1.1 update, write a Vulkan Compute shader, compile it to a `.spv` and try it out? :)

It'll probably only take a few hours to figure it all out. :D

Files

Godot-Three-Vulkan-Compute-Addon-Demo-Linux-debug-v0.1.1.tar.gz 16 MB
Feb 07, 2022
Godot-Three-Vulkan-Compute-Addon-Demo-Win64-debug-v0.1.1.zip 15 MB
Feb 07, 2022

Get Godot 3 Vulkan Compute Addon

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.