Skip to content

[SPIR-V] Define-only include files are missing in -fspv-debug=vulkan-with-source #6907

Closed

Description

Description

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 in the RenderDoc's shader viewer/editor. It doesn't have source tabs for any such include files.

Without those files it is impossible for RenderDoc to recompile the edited shaders.

Steps to Reproduce

This setup:

// test.hlsl
#define OUT_COL float4(1, 0, 1, 1)
// source.hlsl
#include "test.hlsl"

float4 main() : SV_Target0 {
  return OUT_COL;
}

built with

dxc                                                 ^
    -spirv                                          ^
    -fspv-debug=vulkan-with-source source.hlsl      ^
    -T ps_6_0                                       ^
    -Fo test.spv

only includes the source of source.hlsl in the output, as verified with spirv-dis.

If you make a small change:

// test.hlsl
#define OUT_COL float4(1, 0, 1, 1)

void helper() { }
// source.hlsl
#include "test.hlsl"

float4 main() : SV_Target0 {
  helper();
  return OUT_COL;
}

Then the same build works correctly and includes the test.hlsl source.

Expected result

Compilation success. DXC produces SPIR-V binaries with all include files.

Actual Behavior

SPIR-V binary missing source code for #define only include files.

Environment

  • git submodule update --init has been invoked before build
  • hctbuild build parameters: -official -rel -x64 -vs2022 -speak-up -no-dxilconv -spirv
  • Visual Studio 2022 Community components were up to date.
  • Windows 11 Pro 64-bit (22621.1992, Version 22H2)
  • dxc.exe v1.8.2407.10013 executable, commit SHA-1 a2a220bc616ca28848ec0af77ad33a09f92fa43a

Would you kindly help?

P.S. Original issue was observed in RenderDoc's issue #3425 and described in details.

Activity

  1. added
    bug
    needs-triage
    spirv
    on Sep 9, 2024
  2. moved this from For Google to Triaged in HLSL Triageon Sep 13, 2024
  3. moved this from New to In progress in HLSL Roadmapon Sep 13, 2024
  4. moved this from In progress to Done in HLSL Roadmapon Sep 26, 2024
  5. Goshido commented on Sep 28, 2024

    @Goshido
    Author

    Fixed in DirectX Shader Compiler 1.8.2407.10091 75ff50caa046a054747ae15b5c1910a4c8aa1917. Thx! 👍

    image_2024-09-28_10-17-38

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

Metadata

Metadata

Labels

bugspirv

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions