Repository navigation
Description
Description
I added VK_KHR_shader_non_semantic_info device extension and made capture from RenderDoc.
I do get HLSL shader code. But if I try to modify shader source I get compilation error from DXC under RenderDoc. For example
#include "blit_program.inc"
[[vk::binding ( BIND_IMAGE, SET_BLIT )]] <-------------------------------------------
Texture2D<float32_t4> g_image: register ( t0 );
...
Running "D:/Development/VulkanSDK/1.3.290.0/Bin/dxc.exe" ...
C:/Users/Goshido/AppData/Local/Temp/shader_input:8:17: error: use of undeclared identifier 'BIND_IMAGE'
[[vk::binding ( BIND_IMAGE, SET_BLIT )]]
^I started experimenting. I modified each -I parameter to compiler in RenderDoc command window and provided absolute paths to every single include directory. Still got same error.
My next experiment: I intentionally made mistake in include file name like this
#include "blit_program-oopsy.inc"
...
Compiler error did not change again. It looks like RenderDoc removes #include from source files and fed them into DXC. Would you kindly help?
Steps to reproduce
- Take Vulkan HLSL shader code which contains
#include's - Compile it with
-Odand-fspv-debug=vulkan-with-source - Use that SPIR-V blob in Vulkan 1.1 application with extension
VK_KHR_shader_non_semantic_infoenabled - Capture application
- Go to corresponding drawcall/dispatch and try to modify shader
- Apply changes
Problem: RenderDoc reports compilation error from DXC backend.
Expected: Shader source compiled successfully and changes are visible in RenderDoc
Environment
- RenderDoc version: 1.34
- Operating System: Windows 11 Pro (23H2, Build 22631.4112)
- Graphics API: Vulkan 1.1
- GPU: NVIDIA GeForce RTX 4080, game ready driver 560.94
- DXC:
- RenderDoc uses binary from official Vulkan SKD 1.3.290.0, v1.8.0.4650(
49d1ae9a0) - SPIR-V blobs are compiled with v1.8.2407.10013 from commit
a2a220bc616ca28848ec0af77ad33a09f92fa43a
- RenderDoc uses binary from official Vulkan SKD 1.3.290.0, v1.8.0.4650(
Additional information
Default compilation command after Edit shader button press:
-T {hlsl_stage2}_6_0 -E {entry_point} -spirv -fspv-target-env={vulkan_ver} -E PS -T ps_6_8 -HV 2021 -spirv
-fvk-use-dx-layout -fspv-reduce-load-size -fspv-target-env=vulkan1.1 -enable-16bit-types -WX -I tools\editor\hlsl
-I tools\editor\include -I app\src\main\hlsl -I app\src\main\cpp\include\pbr -Od -fspv-debug=vulkan-with-source
-Fo tools\editor\editor-assets\shaders\blit.ps.spv -Qembed_debugLink to device report on Vulkan GPU info web-resource.
Activity
baldurk commentedon Sep 9, 2024
I can't verify with 100% certainty as you didn't include a full reproducible test case but this looks like a DXC bug to me. From a bit of experimentation and checking the source, it looks like the SPIR-V backend doesn't include debug information for include files that only have definitions but no code. You should be able to see that the shader viewer/editor doesn't have source tabs for any such include files.
Without those files it is impossible for RenderDoc to recompile the edited shaders.
This setup:
built with
dxc -spirv -fspv-debug=vulkan-with-source source.hlsl -T ps_6_0 -Fo test.spvonly includes the source ofsource.hlslin the output, as verified withspirv-dis.If I make a small change:
Then the same build works correctly and includes the
test.hlslsource. You could use this as a workaround until the compiler is fixed.If you do see the source for those include files in RenderDoc when editing then it's a different bug, but in that case you need to provide a specific repro case as I followed your steps and only by partial luck managed to reproduce this, as if I had used a function in the first place I would not have been able to repro the bug.
Goshido commentedon Sep 9, 2024
Thanks for investigation @baldurk !👍
I created an issue in DXC repo.