Skip to content

[HLSL] Typed buffer with signed int vector is translated as unsigned #130191

@hekota

Description

@hekota

The target type generated for RWBuffer<int4> does not have its isSigned field set to 1 and the resource is treated as unsigned. This probably applies for all typed buffers with integer vector element types.

RWBuffer<int4> Buf : register(u0);

[numthreads(4,1,1)]
void main() {
    Buf[0].x = 42;
}

Clang:

%"class.hlsl::RWBuffer" = type { target("dx.TypedBuffer", <4 x i32>, 1, 0, 0) }
@Buf = internal global %"class.hlsl::RWBuffer" poison, align 4

; Resource Bindings:
;
; Name                                 Type  Format         Dim      ID      HLSL Bind     Count
; ------------------------------ ---------- ------- ----------- ------- -------------- ---------
;                                       UAV     u32         buf      U0             u0         1

DXC:

; Resource Bindings:
;
; Name                                 Type  Format         Dim      ID      HLSL Bind  Count
; ------------------------------ ---------- ------- ----------- ------- -------------- ------
; Buf                                   UAV     i32         buf      U0             u0     1

Metadata

Metadata

Assignees

Labels

HLSLHLSL Language Supportclang:codegenIR generation bugs: mangling, exceptions, etc.

Type

Projects

Status

Closed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions