Skip to content

[DirectX] Incorrect format metadata when using Buffer<double> or Buffer<int64_t> #146735

@bogner

Description

@bogner

HLSL allows Buffer and RWBuffer of double, int64, or 2-element vectors of the same, but when lowering these to DXIL they use 32-bit accesses to the buffer itself and convert the value as needed.

However, we emit the format metadata for a buffer based on what's stored there, not how we use it, so for Buffer<double2> In we currently see from clang:

 ; Name                                 Type  Format         Dim      ID      HLSL Bind     Count
; ------------------------------ ---------- ------- ----------- ------- -------------- ---------
; In                                texture     f64         buf      T0             t0         1

This does not match dxc, which gives:

; Name                                 Type  Format         Dim      ID      HLSL Bind  Count
; ------------------------------ ---------- ------- ----------- ------- -------------- ------
; In                                texture     u32         buf      T0             t0     1

Note the u32 format here.

We need to make sure that dxil::ResourceTypeInfo::getTyped() has the correct ElementTy in these cases.

Metadata

Metadata

Assignees

Type

Projects

Status

Closed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions