Skip to content

[Debug info] Unbounded resource array is described as DISubrange(count: 1) #8748

Description

@hbystuff

Version: dxcompiler.dll 1.9(5402-0d3ee6b5)(1.9.0.5402) - 1.9.0.5402 (0d3ee6b55-dirty)

Repro files: unbounded_texture_array.zip

dxc -T cs_6_6 -Zi -Qembed_debug -Od -Fc unbounded_texture_array.ll unbounded_texture_array.hlsl
Texture2D<float4>          tex[]   : register(t0);              // unbounded
Texture2D<float4>          tex8[8] : register(t0, space1);      // bounded, for comparison
SamplerState               samp    : register(s0);
RWStructuredBuffer<float4> outBuf  : register(u0);

[numthreads(1, 1, 1)]
void main(uint2 tid : SV_DispatchThreadID)
{
    float2 uv = float2(tid) / 2.0;
    outBuf[0] = tex[tid.x].SampleLevel(samp, uv, 0) + tex8[tid.y].SampleLevel(samp, uv, 0);
}

Actual

; unbounded  Texture2D<float4> tex[]
!27 = !DIGlobalVariable(name: "tex", ..., type: !28, ...)
!28 = !DICompositeType(tag: DW_TAG_array_type, baseType: !29, size: 160, align: 32, elements: !40)
!40 = !{!41}
!41 = !DISubrange(count: 1)

; bounded    Texture2D<float4> tex8[8]
!42 = !DIGlobalVariable(name: "tex8", ..., type: !43, ...)
!43 = !DICompositeType(tag: DW_TAG_array_type, baseType: !29, size: 1280, align: 32, elements: !44)
!44 = !{!45}
!45 = !DISubrange(count: 8)

The unbounded array is emitted as if declared Texture2D<float4> tex[1]:
count: 1 and size: 160 (one element). Nothing in the metadata distinguishes
tex[] from tex[1].

Expected

A subrange with no upper bound, should probably be !DISubrange(count: -1), and 0
for size: on the DICompositeType.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug, regression, crashneeds-triageAwaiting triage

    Type

    No type

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions