dawn-cmake/test/tint/bug/tint/977.spvasm.expected.glsl
Stephen White 66abf3ed14 GLSL: don't emit structs w/runtime-sized arrays.
In GLSL, runtime-sized arrays are only valid in interface blocks, not
in structs. The existing code was attempting to avoid emitting structs
containing runtime-sized arrays but was confused by type aliases in
the AST resulting in arrays being missed.

The fix is to do the work on the semantic types instead, where type
aliases have been resolved.

Bug: tint:1339
Change-Id: I8c305ee9bddd75f975dd13f1d19d623d71410693
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82360
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2022-03-02 14:09:22 +00:00

59 lines
1.2 KiB
GLSL

#version 310 es
struct Uniforms {
float NAN;
int sizeA;
int sizeB;
};
uvec3 tint_symbol = uvec3(0u, 0u, 0u);
layout(binding = 2, std430) buffer ResultMatrix_1 {
float numbers[];
} resultMatrix;
float binaryOperation_f1_f1_(inout float a, inout float b) {
float x_26 = 0.0f;
float x_13 = b;
if ((x_13 == 0.0f)) {
return 1.0f;
}
float x_21 = b;
if (!((round((x_21 - (2.0f * floor((x_21 / 2.0f))))) == 1.0f))) {
float x_29 = a;
float x_31 = b;
x_26 = pow(abs(x_29), x_31);
} else {
float x_34 = a;
float x_36 = a;
float x_38 = b;
x_26 = (sign(x_34) * pow(abs(x_36), x_38));
}
return x_26;
}
void main_1() {
int index = 0;
int a_1 = 0;
float param = 0.0f;
float param_1 = 0.0f;
uint x_54 = tint_symbol.x;
index = int(x_54);
a_1 = -10;
int x_63 = index;
param = -4.0f;
param_1 = -3.0f;
float x_68 = binaryOperation_f1_f1_(param, param_1);
resultMatrix.numbers[x_63] = x_68;
return;
}
void tint_symbol_1(uvec3 tint_symbol_2) {
tint_symbol = tint_symbol_2;
main_1();
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
tint_symbol_1(gl_GlobalInvocationID);
return;
}