mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-07-06 21:25:58 +00:00
This transform breaks up matNx2<f32> matrices used in uniform buffers into column vectors, which fixes std140 layout rules. Used by the SPIR-V and GLSL backends. Re-enable tests that were disabled for these cases. Bug: tint:1632 Change-Id: I596d016582b4189a0b413d762b3e7eabd3504b22 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100907 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Dan Sinclair <dsinclair@chromium.org> Commit-Queue: Ben Clayton <bclayton@chromium.org>
34 lines
1.1 KiB
Plaintext
34 lines
1.1 KiB
Plaintext
#include <metal_stdlib>
|
|
|
|
using namespace metal;
|
|
|
|
template<typename T, size_t N>
|
|
struct tint_array {
|
|
const constant T& operator[](size_t i) const constant { return elements[i]; }
|
|
device T& operator[](size_t i) device { return elements[i]; }
|
|
const device T& operator[](size_t i) const device { return elements[i]; }
|
|
thread T& operator[](size_t i) thread { return elements[i]; }
|
|
const thread T& operator[](size_t i) const thread { return elements[i]; }
|
|
threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
|
|
const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
|
|
T elements[N];
|
|
};
|
|
|
|
struct S {
|
|
/* 0x0000 */ int before;
|
|
/* 0x0004 */ tint_array<int8_t, 4> tint_pad;
|
|
/* 0x0008 */ float4x2 m;
|
|
/* 0x0028 */ int after;
|
|
/* 0x002c */ tint_array<int8_t, 4> tint_pad_1;
|
|
};
|
|
|
|
kernel void f(const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) {
|
|
thread tint_array<S, 4> tint_symbol = {};
|
|
tint_symbol = *(tint_symbol_1);
|
|
tint_symbol[1] = (*(tint_symbol_1))[2];
|
|
tint_symbol[3].m = (*(tint_symbol_1))[2].m;
|
|
tint_symbol[1].m[0] = float2((*(tint_symbol_1))[0].m[1]).yx;
|
|
return;
|
|
}
|
|
|