[Shader Debug] Enable debugging on shaders - vulkan GL_EXT_debug_printf
Hideman85 opened this issue ยท 4 comments
I would like to enable shader debugging to help me find issues in my implementation.
Right now I'm using Vulkan backend only and so I would like to have printf with #extension GL_EXT_debug_printf : enable but no way to have this working.
As soon as I put a string in my shader, I'm getting the compilation error
ERROR : 'string literal' : required extension not requested: Possible extensions include:
GL_EXT_debug_printf
GL_EXT_spirv_intrinsics
And when I put #extension GL_EXT_debug_printf : enable I'm getting
error: invalid preprocessing directive #extension
1 | #extension GL_EXT_debug_printf : enable
I checked the fsl.py compiler and seem no options for enabling this. How can I do so?
This does not work because fsl runs its own preprocessor step, you can use this:
@fsl_extension GL_EXT_debug_printf: enable
float4 PS_MAIN(VSOutput In)
{
INIT_MAIN;
float4 Out;
debugPrintfEXT("Hello World!");
Thanks @david-tf for your reply ๐
It seems it needs something more when using the shader in the app cause now it isnt running.
vkCreateShaderModule(): The SPIR-V Extension (SPV_KHR_non_semantic_info) was declared, but none of the requirements were met to use it. The Vulkan spec states: If pCode declares any of the SPIR-V extensions listed in the SPIR-V Environment appendix, one of the corresponding requirements must be satisfied.
Do you know what I should do in the app code? I havent found something in ShaderLoadDesc that I could flag on.
Thanks in advance for your help ๐
You will need to add VK_KHR_SHADER_NON_SEMANTIC_INFO_EXTENSION_NAME to the ppDeviceExtensions/mDeviceExtensionCount RendererDesc.
Perfect, thanks again ๐
I cant see any logs for some reason even tho my shader is running. Note the documentation said that by default the Debug callback handle it (the one created by The Forge) but nothing is dumped. I tried with the env VK_LAYER_PRINTF_TO_STDOUT=1 that should redirect to stdout but nothing either. Any Idea?