Skip to content

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

Closed
@Goshido

Description

@Goshido

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.

Metadata

Metadata

Assignees

Labels

bugBug, regression, crashspirvWork related to SPIR-V

Type

No type

Projects

Status

Done

Status

Triaged

Relationships

None yet

Development

No branches or pull requests

Issue actions