mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-16 00:17:03 +00:00
HLSL: work around FXC failures when dynamically indexing arrays in structs
FXC fails to compile code that assigns to dynamically-indexed fixed-size arrays in structs on internal shader variables with: error X3500: array reference cannot be used as an l-value; not natively addressable This CL detects this case, and transforms such assignments into copying out the array to a local variable, assigning to that local, and then copying the array back. Also manually regenerate SKIPs for HLSL/FXC after this change, which fixes 30 tests. Also exposes some "compilation aborted unexpectedly" now that "array reference cannot be used as an l-value" has been fixed. For tests that fail for both DXC and FXC, updating SKIPs to the DXC one to help distinguish actual FXC bugs from valid errors. Bug: tint:998 Bug: tint:1206 Change-Id: I09204d8d81ab27d1c257538ad702414ccc386543 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/71620 Reviewed-by: Ben Clayton <bclayton@google.com> Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
committed by
Tint LUCI CQ
parent
5923803f7e
commit
d733fdb85c
@@ -1,21 +0,0 @@
|
||||
SKIP: FAILED
|
||||
|
||||
cbuffer cbuffer_ubo : register(b0, space0) {
|
||||
uint4 ubo[1];
|
||||
};
|
||||
|
||||
struct S {
|
||||
int data[64];
|
||||
};
|
||||
|
||||
RWByteAddressBuffer result : register(u1, space0);
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void f() {
|
||||
S s = (S)0;
|
||||
s.data[asint(ubo[0].x)] = 1;
|
||||
result.Store(0u, asuint(s.data[3]));
|
||||
return;
|
||||
}
|
||||
C:\src\tint\test\Shader@0x000002C587F87250(14,3-25): error X3500: array reference cannot be used as an l-value; not natively addressable
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
SKIP: FAILED
|
||||
|
||||
cbuffer cbuffer_ubo : register(b0, space0) {
|
||||
uint4 ubo[1];
|
||||
};
|
||||
|
||||
struct S {
|
||||
int data[64];
|
||||
};
|
||||
|
||||
RWByteAddressBuffer result : register(u1, space0);
|
||||
|
||||
void x(inout S p) {
|
||||
p.data[asint(ubo[0].x)] = 1;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void f() {
|
||||
S s = (S)0;
|
||||
x(s);
|
||||
result.Store(0u, asuint(s.data[3]));
|
||||
return;
|
||||
}
|
||||
C:\src\tint\test\Shader@0x000002338E919910(12,3-25): error X3500: array reference cannot be used as an l-value; not natively addressable
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
SKIP: FAILED
|
||||
|
||||
cbuffer cbuffer_ubo : register(b0, space0) {
|
||||
uint4 ubo[1];
|
||||
};
|
||||
|
||||
struct S {
|
||||
int data[64];
|
||||
};
|
||||
|
||||
RWByteAddressBuffer result : register(u1, space0);
|
||||
static S s = (S)0;
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void f() {
|
||||
s.data[asint(ubo[0].x)] = 1;
|
||||
result.Store(0u, asuint(s.data[3]));
|
||||
return;
|
||||
}
|
||||
C:\src\tint\test\Shader@0x000001D94063C630(14,3-25): error X3500: array reference cannot be used as an l-value; not natively addressable
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
SKIP: FAILED
|
||||
|
||||
cbuffer cbuffer_ubo : register(b0, space0) {
|
||||
uint4 ubo[1];
|
||||
};
|
||||
|
||||
struct S {
|
||||
int data[64];
|
||||
};
|
||||
|
||||
RWByteAddressBuffer result : register(u1, space0);
|
||||
static S s = (S)0;
|
||||
|
||||
void x(inout S p) {
|
||||
p.data[asint(ubo[0].x)] = 1;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void f() {
|
||||
x(s);
|
||||
result.Store(0u, asuint(s.data[3]));
|
||||
return;
|
||||
}
|
||||
C:\src\tint\test\Shader@0x0000018B80081AA0(13,3-25): error X3500: array reference cannot be used as an l-value; not natively addressable
|
||||
|
||||
Reference in New Issue
Block a user