Files
wgpu/naga/tests/out/msl/constructors.msl
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

44 lines
1.4 KiB
Plaintext

// language: metal1.0
#include <metal_stdlib>
#include <simd/simd.h>
using metal::uint;
struct Foo {
metal::float4 a;
int b;
};
struct type_5 {
metal::float2x2 inner[1];
};
struct type_9 {
Foo inner[3];
};
struct type_11 {
int inner[4];
};
constant metal::float2x2 const3_ = metal::float2x2(metal::float2(0.0, 1.0), metal::float2(2.0, 3.0));
constant type_5 const4_ = type_5 {metal::float2x2(metal::float2(0.0, 1.0), metal::float2(2.0, 3.0))};
constant bool cz0_ = bool {};
constant int cz1_ = int {};
constant uint cz2_ = uint {};
constant float cz3_ = float {};
constant metal::uint2 cz4_ = metal::uint2 {};
constant metal::float2x2 cz5_ = metal::float2x2 {};
constant type_9 cz6_ = type_9 {};
constant Foo cz7_ = Foo {};
kernel void main_(
) {
Foo foo = {};
foo = Foo {metal::float4(1.0), 1};
metal::float2x2 m0_ = metal::float2x2(metal::float2(1.0, 0.0), metal::float2(0.0, 1.0));
metal::float4x4 m1_ = metal::float4x4(metal::float4(1.0, 0.0, 0.0, 0.0), metal::float4(0.0, 1.0, 0.0, 0.0), metal::float4(0.0, 0.0, 1.0, 0.0), metal::float4(0.0, 0.0, 0.0, 1.0));
metal::uint2 cit0_ = metal::uint2(0u);
metal::float2x2 cit1_ = metal::float2x2(metal::float2(0.0), metal::float2(0.0));
type_11 cit2_ = type_11 {0, 1, 2, 3};
metal::uint2 ic4_ = metal::uint2(0u, 0u);
metal::float2x3 ic5_ = metal::float2x3(metal::float3(0.0, 0.0, 0.0), metal::float3(0.0, 0.0, 0.0));
return;
}