Ben Clayton 657e61d43d tint: Add and use new Std140 transform
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>
2022-09-01 22:12:19 +00:00

35 lines
500 B
GLSL

#version 310 es
precision mediump float;
struct S {
mat3x2 matrix;
vec3 vector;
};
struct S_std140 {
vec2 matrix_0;
vec2 matrix_1;
vec2 matrix_2;
vec3 vector;
};
layout(binding = 0) uniform S_std140_1 {
vec2 matrix_0;
vec2 matrix_1;
vec2 matrix_2;
vec3 vector;
} data;
mat3x2 load_data_matrix() {
return mat3x2(data.matrix_0, data.matrix_1, data.matrix_2);
}
void tint_symbol() {
vec2 x = (load_data_matrix() * data.vector);
}
void main() {
tint_symbol();
return;
}