Description
annotateHandle calls associated with global samples do not get attributed to the right source location in debug info.
Steps to Reproduce
Compile
struct A
{
uint i;
};
ConstantBuffer<A> C : register(b0);
Texture2D<float4> T : register(t0);
SamplerState F()
{
return SamplerDescriptorHeap[NonUniformResourceIndex(C.i)];
}
static const SamplerState S = F();
float4 main(float2 uv : TEXCOORD0) : SV_Target
{
return T.Sample(S, uv);
}
dxc.exe repro.hlsl -T ps_6_6 -E main -HV 2021 -Zi -Fd "repro.pdb" -Fo "repro.dxil" -Fc "repro.ll"
Actual Behavior
%7 = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle %6, %dx.types.ResourceProperties { i32 14, i32 0 }), !dbg !90 ; line:14 col:0 ; AnnotateHandle(res,props) resource: SamplerState
!29 = !DISubprogram(name: "F", linkageName: "\01?F@@ya?AUSamplerState@@xz", scope: !1, file: !1, line: 9, type: !30, isLocal: false, isDefinition: true, scopeLine: 10, flags: DIFlagPrototyped, isOptimized: false)
!90 = !DILocation(line: 14, scope: !29)
%7 is physically inside @main, but its debug scope is !29 / F, with no inlinedAt chain back to main.
Also, If DXC wants to attribute %7 to the global initializer (line 14), maybe it should be scoped to the global initializer subprogram, not F? (line 14 isn't in F).
Environment
- DXC version dxcompiler.dll: 1.10(5180-e3554182)(1.9.0.5180) - 1.9.0.5180 (e355418)
- Host Operating System Windows 11
Description
annotateHandle calls associated with global samples do not get attributed to the right source location in debug info.
Steps to Reproduce
Compile
dxc.exe repro.hlsl -T ps_6_6 -E main -HV 2021 -Zi -Fd "repro.pdb" -Fo "repro.dxil" -Fc "repro.ll"
Actual Behavior
%7 = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle %6, %dx.types.ResourceProperties { i32 14, i32 0 }), !dbg !90 ; line:14 col:0 ; AnnotateHandle(res,props) resource: SamplerState
!29 = !DISubprogram(name: "F", linkageName: "\01?F@@ya?AUSamplerState@@xz", scope: !1, file: !1, line: 9, type: !30, isLocal: false, isDefinition: true, scopeLine: 10, flags: DIFlagPrototyped, isOptimized: false)
!90 = !DILocation(line: 14, scope: !29)
%7 is physically inside @main, but its debug scope is !29 / F, with no inlinedAt chain back to main.
Also, If DXC wants to attribute %7 to the global initializer (line 14), maybe it should be scoped to the global initializer subprogram, not F? (line 14 isn't in F).
Environment