Skip to content

[HLSL] Static resources should be assignable #166458

@hekota

Description

@hekota

It should be possible to assign a resource instance into a static resource variable.
Clang currently reports error: assignment to global resource variable 'R' is not allowed.
DXC compiles this fine.

RWStructuredBuffer<float> Array[4][2] : register(u10, space6);
RWStructuredBuffer<float> B : register(u1, space5);

static RWStructuredBuffer<float> Mine;

[numthreads(4,1,1)]
void main(uint GI : SV_GroupIndex) {
  static RWStructuredBuffer<float> MineToo;

  Mine = Array[2][0];
  MineToo = B;
  Mine[0] = 123;
  MineToo[0] = 456;
}

https://godbolt.org/z/cd9EG98nM

Metadata

Metadata

Assignees

Labels

HLSLHLSL Language Support

Type

Projects

Status

Active

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions