Files
wgpu/naga/tests/out/glsl/constructors.main.Compute.glsl
T
Jamie Nicol dd2d53814d [naga wgsl-in] Do not eagerly concretize global const declarations of abstract types
Instead allow the const to be converted and each time it is const
evaluated as part of another expression. This allows an abstract const
to be used as a different type depending on the context.

A consequence of this is that abstract types may now find their way to
the validation stage, which we don't want. We therefore additionally
now ensure that the compact pass removes global constants of abstract
types. This will have no *functional* effect on shaders generated by
the backends, as the expressions belonging to the abstract consts in
the IR will not actually be used, as any usage in the input shader
will have been const-evaluated away. Certain unused const declarations
will now be removed, however, as can be seen by the effect on the
snapshot outputs.
2025-02-25 09:25:25 +00:00

37 lines
1.1 KiB
GLSL

#version 310 es
precision highp float;
precision highp int;
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
struct Foo {
vec4 a;
int b;
};
const mat2x2 const3_ = mat2x2(vec2(0.0, 1.0), vec2(2.0, 3.0));
const mat2x2 const4_[1] = mat2x2[1](mat2x2(vec2(0.0, 1.0), vec2(2.0, 3.0)));
const bool cz0_ = false;
const int cz1_ = 0;
const uint cz2_ = 0u;
const float cz3_ = 0.0;
const uvec2 cz4_ = uvec2(0u);
const mat2x2 cz5_ = mat2x2(0.0);
const Foo cz6_[3] = Foo[3](Foo(vec4(0.0), 0), Foo(vec4(0.0), 0), Foo(vec4(0.0), 0));
const Foo cz7_ = Foo(vec4(0.0), 0);
void main() {
Foo foo = Foo(vec4(0.0), 0);
foo = Foo(vec4(1.0), 1);
mat2x2 m0_ = mat2x2(vec2(1.0, 0.0), vec2(0.0, 1.0));
mat4x4 m1_ = mat4x4(vec4(1.0, 0.0, 0.0, 0.0), vec4(0.0, 1.0, 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(0.0, 0.0, 0.0, 1.0));
uvec2 cit0_ = uvec2(0u);
mat2x2 cit1_ = mat2x2(vec2(0.0), vec2(0.0));
int cit2_[4] = int[4](0, 1, 2, 3);
uvec2 ic4_ = uvec2(0u, 0u);
mat2x3 ic5_ = mat2x3(vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0));
return;
}