mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-09 21:47:47 +00:00
msl: Handle buffer variables in transform
This removes a lot of awkward logic from the MSL writer, and means that we now handle all module-scope variables with the same transform. Change-Id: I782e36a4b88dafbc3f8364f7caa7f95c6ae3f5f1 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/67643 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
@@ -31,20 +31,20 @@ struct S {
|
||||
/* 0x0000 */ Inner arr[1];
|
||||
};
|
||||
|
||||
void tint_symbol_inner(const device S& s, uint idx) {
|
||||
int3 const a = s.arr[idx].a;
|
||||
int const b = s.arr[idx].b;
|
||||
uint3 const c = s.arr[idx].c;
|
||||
uint const d = s.arr[idx].d;
|
||||
float3 const e = s.arr[idx].e;
|
||||
float const f = s.arr[idx].f;
|
||||
float2x3 const g = s.arr[idx].g;
|
||||
float3x2 const h = s.arr[idx].h;
|
||||
tint_array_wrapper const i = s.arr[idx].i;
|
||||
void tint_symbol_inner(uint idx, const device S* const tint_symbol_1) {
|
||||
int3 const a = (*(tint_symbol_1)).arr[idx].a;
|
||||
int const b = (*(tint_symbol_1)).arr[idx].b;
|
||||
uint3 const c = (*(tint_symbol_1)).arr[idx].c;
|
||||
uint const d = (*(tint_symbol_1)).arr[idx].d;
|
||||
float3 const e = (*(tint_symbol_1)).arr[idx].e;
|
||||
float const f = (*(tint_symbol_1)).arr[idx].f;
|
||||
float2x3 const g = (*(tint_symbol_1)).arr[idx].g;
|
||||
float3x2 const h = (*(tint_symbol_1)).arr[idx].h;
|
||||
tint_array_wrapper const i = (*(tint_symbol_1)).arr[idx].i;
|
||||
}
|
||||
|
||||
kernel void tint_symbol(uint idx [[thread_index_in_threadgroup]], const device S& s [[buffer(0)]]) {
|
||||
tint_symbol_inner(s, idx);
|
||||
kernel void tint_symbol(const device S* tint_symbol_2 [[buffer(0)]], uint idx [[thread_index_in_threadgroup]]) {
|
||||
tint_symbol_inner(idx, tint_symbol_2);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,21 +31,21 @@ struct S {
|
||||
/* 0x0000 */ Inner arr[1];
|
||||
};
|
||||
|
||||
void tint_symbol_inner(device S& s, uint idx) {
|
||||
s.arr[idx].a = int3();
|
||||
s.arr[idx].b = int();
|
||||
s.arr[idx].c = uint3();
|
||||
s.arr[idx].d = uint();
|
||||
s.arr[idx].e = float3();
|
||||
s.arr[idx].f = float();
|
||||
s.arr[idx].g = float2x3();
|
||||
s.arr[idx].h = float3x2();
|
||||
void tint_symbol_inner(uint idx, device S* const tint_symbol_2) {
|
||||
(*(tint_symbol_2)).arr[idx].a = int3();
|
||||
(*(tint_symbol_2)).arr[idx].b = int();
|
||||
(*(tint_symbol_2)).arr[idx].c = uint3();
|
||||
(*(tint_symbol_2)).arr[idx].d = uint();
|
||||
(*(tint_symbol_2)).arr[idx].e = float3();
|
||||
(*(tint_symbol_2)).arr[idx].f = float();
|
||||
(*(tint_symbol_2)).arr[idx].g = float2x3();
|
||||
(*(tint_symbol_2)).arr[idx].h = float3x2();
|
||||
tint_array_wrapper const tint_symbol_1 = {.arr={}};
|
||||
s.arr[idx].i = tint_symbol_1;
|
||||
(*(tint_symbol_2)).arr[idx].i = tint_symbol_1;
|
||||
}
|
||||
|
||||
kernel void tint_symbol(uint idx [[thread_index_in_threadgroup]], device S& s [[buffer(0)]]) {
|
||||
tint_symbol_inner(s, idx);
|
||||
kernel void tint_symbol(device S* tint_symbol_3 [[buffer(0)]], uint idx [[thread_index_in_threadgroup]]) {
|
||||
tint_symbol_inner(idx, tint_symbol_3);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user