VulkanTools icon indicating copy to clipboard operation
VulkanTools copied to clipboard

API Dump: Feature request, shader output in SPIR-V or even GLSL

Open mark-lunarg opened this issue 4 years ago • 2 comments

Was surprised to see that selecting the show_shader option in api dump resulted in only the binary data for the shaders being dumped. It'd be super-cool if they'd use SPIRV-Tools to spit out the SPIR-V or GLSL shader source.

mark-lunarg avatar Oct 21 '21 20:10 mark-lunarg

I agree, this is a very worthwhile addition. Printing the binary is of limited use since it requires further processing to look at manually. But I don't think GLSL is an appropriate output format since spir-v can contain constructs which don't necessarily map to glsl. Just printing a textual form of spirv would be ideal.

https://github.com/KhronosGroup/SPIRV-Tools would be the candidate library for the disassembler, since its widely used and lightweight.

charles-lunarg avatar Oct 22 '21 20:10 charles-lunarg

update, I hit this the other day

  1. We should print hex array instead of binary, so if you print out something like
 0x07230203, 0x00010300, 0x0008000b, 0x000000bb, 0x00000000, 0x00020011, 0x00000001, 0x00020011, 0x00000005, 0x00020011, ...

there is now support in SPIRV-Tools (https://github.com/KhronosGroup/SPIRV-Tools/pull/5870) and https://www.khronos.org/spir/visualizer/ to consume these hex strings

  1. We currently only check at VkCreateShaderModule, but there are multiple ways we need to worry about where SPIR-V comes in (see https://github.com/KhronosGroup/Vulkan-Guide/blob/main/chapters/ways_to_provide_spirv.adoc)

spencer-lunarg avatar Nov 21 '24 16:11 spencer-lunarg