Skip to content

DXIL debug locations do not respect #line directives #4615

@maoenpei

Description

@maoenpei

Hi, I'm working on a profiling tool that requires DXIL -> HLSL line mapping for low-level to high-level counters aggregating. However after dxc validator version >= 1.6, the debug locations from DXIL do not respect #line directives anymore. I think this issue is introduced from #2991.

The HLSL source is also extracted from DXIL bytecode. When it has "#line" directives in it, we usually process the source and build virtual source files based on the line numbers followed "#line" directives, before we are able to display the HLSL source / DXIL text and the correlation between them on our UIs. However, when the debug locations do not respect "#line" directives, we have to display the unprocessed source on our UI, otherwise the correlation breaks.

At most cases (like UE4 game development), the processed sources (the virtual sources built from the extracted source of DXIL bytecode) are the original source files of developers and what's embedded in DXIL bytecode is a file merged by some tools before passing it to dxc. The change of dxc makes our displayed source less readable. So the virtual sources are more expected to be displayed to our users.

In my humble opinion, a regular compiler should always respect "#line" directives. And we always extract virtual sources for GLSL -> SPIRV (by glslc) and HLSL -> SPIRV (by dxc), so dxc (with version >= 1.6) compiling HLSL to DXIL is the only exception.

What I expect:

  • Restore the default behavior of "#line" locations processing.
  • If some clients of dxc need the locations of unprocessed source, add an option for dxc to do that.

Does this make sense?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Triaged

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions