When emitting a MSL struct initializer emit the struct name.

This CL changes the MSL emission for struct initializers to emit the
struct name first.

`const a = {.f=float3(1)}` becomes `const a = Normals{.f=float3(1)}`.

This fixes an issues where the initialization happens inside an array
which the downstream compiler rejected without the explicit struct
naming.

Bug: tint:1641
Change-Id: I948b9ca94f4b89eac6d5bbbaa615b3d71d50c737
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98760
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
dan sinclair 2022-08-11 02:28:01 +00:00 committed by Dawn LUCI CQ
parent 7126ed9111
commit 3abad2c125
59 changed files with 224 additions and 72 deletions

View File

@ -1698,7 +1698,7 @@ bool GeneratorImpl::EmitConstant(std::ostream& out, const sem::Constant* constan
return true; return true;
}, },
[&](const sem::Struct* s) { [&](const sem::Struct* s) {
out << "{"; out << program_->Symbols().NameFor(s->Name()) << "{";
TINT_DEFER(out << "}"); TINT_DEFER(out << "}");
if (constant->AllZero()) { if (constant->AllZero()) {

View File

@ -224,7 +224,7 @@ struct tint_symbol {
}; };
Interface vert_main_inner() { Interface vert_main_inner() {
Interface const tint_symbol_3 = {.col1=0.5f, .col2=0.25f, .pos=float4(0.0f)}; Interface const tint_symbol_3 = Interface{.col1=0.5f, .col2=0.25f, .pos=float4(0.0f)};
return tint_symbol_3; return tint_symbol_3;
} }

View File

@ -117,7 +117,7 @@ struct Out {
}; };
vertex Out vert_main() { vertex Out vert_main() {
return {}; return Out{};
} }
)"); )");
@ -147,7 +147,7 @@ struct Out {
}; };
vertex Out vert_main() { vertex Out vert_main() {
return {}; return Out{};
} }
)"); )");
@ -283,7 +283,7 @@ struct tint_symbol_4 {
void comp_main_inner(uint local_invocation_index, threadgroup S2* const tint_symbol_1) { void comp_main_inner(uint local_invocation_index, threadgroup S2* const tint_symbol_1) {
{ {
S2 const tint_symbol = {}; S2 const tint_symbol = S2{};
*(tint_symbol_1) = tint_symbol; *(tint_symbol_1) = tint_symbol;
} }
threadgroup_barrier(mem_flags::mem_threadgroup); threadgroup_barrier(mem_flags::mem_threadgroup);

View File

@ -24,7 +24,7 @@ tint_array<int4, 4> ret_arr() {
} }
S ret_struct_arr() { S ret_struct_arr() {
S const tint_symbol_2 = {}; S const tint_symbol_2 = S{};
return tint_symbol_2; return tint_symbol_2;
} }

View File

@ -24,7 +24,7 @@ tint_array<int4, 4> ret_arr() {
} }
S ret_struct_arr() { S ret_struct_arr() {
S const tint_symbol_2 = {}; S const tint_symbol_2 = S{};
return tint_symbol_2; return tint_symbol_2;
} }

View File

@ -28,7 +28,7 @@ tint_array<int4, 4> ret_arr() {
} }
S ret_struct_arr() { S ret_struct_arr() {
S const tint_symbol_3 = {}; S const tint_symbol_3 = S{};
return tint_symbol_3; return tint_symbol_3;
} }

View File

@ -24,7 +24,7 @@ tint_array<int4, 4> ret_arr() {
} }
S ret_struct_arr() { S ret_struct_arr() {
S const tint_symbol_2 = {}; S const tint_symbol_2 = S{};
return tint_symbol_2; return tint_symbol_2;
} }

View File

@ -51,7 +51,7 @@ kernel void tint_symbol(device S* tint_symbol_3 [[buffer(0)]]) {
(*(tint_symbol_3)).f = 0.0f; (*(tint_symbol_3)).f = 0.0f;
(*(tint_symbol_3)).g = float2x3(float3(0.0f), float3(0.0f)); (*(tint_symbol_3)).g = float2x3(float3(0.0f), float3(0.0f));
(*(tint_symbol_3)).h = float3x2(float2(0.0f), float2(0.0f), float2(0.0f)); (*(tint_symbol_3)).h = float3x2(float2(0.0f), float2(0.0f), float2(0.0f));
Inner const tint_symbol_1 = {}; Inner const tint_symbol_1 = Inner{};
(*(tint_symbol_3)).i = tint_symbol_1; (*(tint_symbol_3)).i = tint_symbol_1;
tint_array<Inner, 4> const tint_symbol_2 = tint_array<Inner, 4>{}; tint_array<Inner, 4> const tint_symbol_2 = tint_array<Inner, 4>{};
(*(tint_symbol_3)).j = tint_symbol_2; (*(tint_symbol_3)).j = tint_symbol_2;

View File

@ -10,7 +10,7 @@ struct B {
}; };
B f(A a) { B f(A a) {
B const tint_symbol = {}; B const tint_symbol = B{};
return tint_symbol; return tint_symbol;
} }

View File

@ -89,7 +89,7 @@ fragment tint_symbol_3 fs_main(texture2d<float, access::sample> tint_symbol_11 [
float4 const inner_result_1 = fs_main_inner(tint_symbol_1.texcoord, &(tint_symbol_10), tint_symbol_11, tint_symbol_12); float4 const inner_result_1 = fs_main_inner(tint_symbol_1.texcoord, &(tint_symbol_10), tint_symbol_11, tint_symbol_12);
if (tint_symbol_10) { if (tint_symbol_10) {
tint_discard_func(); tint_discard_func();
tint_symbol_3 const tint_symbol_4 = {}; tint_symbol_3 const tint_symbol_4 = tint_symbol_3{};
return tint_symbol_4; return tint_symbol_4;
} }
tint_symbol_3 wrapper_result_1 = {}; tint_symbol_3 wrapper_result_1 = {};

View File

@ -40,7 +40,7 @@ fragment tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) {
int const inner_result = tint_symbol_inner(tint_symbol_1.x, &(tint_symbol_7)); int const inner_result = tint_symbol_inner(tint_symbol_1.x, &(tint_symbol_7));
if (tint_symbol_7) { if (tint_symbol_7) {
tint_discard_func(); tint_discard_func();
tint_symbol_3 const tint_symbol_4 = {}; tint_symbol_3 const tint_symbol_4 = tint_symbol_3{};
return tint_symbol_4; return tint_symbol_4;
} }
tint_symbol_3 wrapper_result = {}; tint_symbol_3 wrapper_result = {};

View File

@ -137,7 +137,7 @@ main_out tint_symbol_inner(float fClipDistance3_param, float fClipDistance4_para
*(tint_symbol_15) = fClipDistance4_param; *(tint_symbol_15) = fClipDistance4_param;
main_1(tint_symbol_14, tint_symbol_16, tint_symbol_15, tint_symbol_17, tint_symbol_18, tint_symbol_19, tint_symbol_20); main_1(tint_symbol_14, tint_symbol_16, tint_symbol_15, tint_symbol_17, tint_symbol_18, tint_symbol_19, tint_symbol_20);
if (*(tint_symbol_16)) { if (*(tint_symbol_16)) {
main_out const tint_symbol_4 = {}; main_out const tint_symbol_4 = main_out{};
return tint_symbol_4; return tint_symbol_4;
} }
main_out const tint_symbol_5 = {.glFragColor_1=*(tint_symbol_20)}; main_out const tint_symbol_5 = {.glFragColor_1=*(tint_symbol_20)};
@ -156,7 +156,7 @@ fragment tint_symbol_3 tint_symbol(const constant Scene* tint_symbol_24 [[buffer
main_out const inner_result = tint_symbol_inner(tint_symbol_1.fClipDistance3_param, tint_symbol_1.fClipDistance4_param, &(tint_symbol_21), &(tint_symbol_22), &(tint_symbol_23), tint_symbol_24, tint_symbol_25, tint_symbol_26, &(tint_symbol_27)); main_out const inner_result = tint_symbol_inner(tint_symbol_1.fClipDistance3_param, tint_symbol_1.fClipDistance4_param, &(tint_symbol_21), &(tint_symbol_22), &(tint_symbol_23), tint_symbol_24, tint_symbol_25, tint_symbol_26, &(tint_symbol_27));
if (tint_symbol_23) { if (tint_symbol_23) {
tint_discard_func(); tint_discard_func();
tint_symbol_3 const tint_symbol_6 = {}; tint_symbol_3 const tint_symbol_6 = tint_symbol_3{};
return tint_symbol_6; return tint_symbol_6;
} }
tint_symbol_3 wrapper_result = {}; tint_symbol_3 wrapper_result = {};

View File

@ -0,0 +1,11 @@
struct Normals {
f : vec3<f32>,
}
const faceNormals = array<Normals, 1>(
Normals(vec3(0, 0, 1)),
);
@vertex
fn main() -> @builtin(position) vec4<f32> {
return vec4(faceNormals[0].f, 1.);
}

View File

@ -0,0 +1,19 @@
struct Normals {
float3 f;
};
struct tint_symbol {
float4 value : SV_Position;
};
float4 main_inner() {
const Normals tint_symbol_1[1] = {{float3(0.0f, 0.0f, 1.0f)}};
return float4(tint_symbol_1[0].f, 1.0f);
}
tint_symbol main() {
const float4 inner_result = main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.value = inner_result;
return wrapper_result;
}

View File

@ -0,0 +1,19 @@
struct Normals {
float3 f;
};
struct tint_symbol {
float4 value : SV_Position;
};
float4 main_inner() {
const Normals tint_symbol_1[1] = {{float3(0.0f, 0.0f, 1.0f)}};
return float4(tint_symbol_1[0].f, 1.0f);
}
tint_symbol main() {
const float4 inner_result = main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.value = inner_result;
return wrapper_result;
}

View File

@ -0,0 +1,19 @@
#version 310 es
struct Normals {
vec3 f;
};
vec4 tint_symbol() {
Normals tint_symbol_1[1] = Normals[1](Normals(vec3(0.0f, 0.0f, 1.0f)));
return vec4(tint_symbol_1[0].f, 1.0f);
}
void main() {
gl_PointSize = 1.0;
vec4 inner_result = tint_symbol();
gl_Position = inner_result;
gl_Position.y = -(gl_Position.y);
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}

View File

@ -0,0 +1,36 @@
#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 Normals {
float3 f;
};
struct tint_symbol_1 {
float4 value [[position]];
};
float4 tint_symbol_inner() {
tint_array<Normals, 1> const tint_symbol_2 = tint_array<Normals, 1>{Normals{.f=float3(0.0f, 0.0f, 1.0f)}};
return float4(tint_symbol_2[0].f, 1.0f);
}
vertex tint_symbol_1 tint_symbol() {
float4 const inner_result = tint_symbol_inner();
tint_symbol_1 wrapper_result = {};
wrapper_result.value = inner_result;
return wrapper_result;
}

View File

@ -0,0 +1,38 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 19
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %main "main" %value %vertex_point_size
OpName %value "value"
OpName %vertex_point_size "vertex_point_size"
OpName %main_inner "main_inner"
OpName %main "main"
OpDecorate %value BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%value = OpVariable %_ptr_Output_v4float Output %5
%_ptr_Output_float = OpTypePointer Output %float
%8 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
%9 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%13 = OpConstantComposite %v4float %8 %8 %float_1 %float_1
%void = OpTypeVoid
%14 = OpTypeFunction %void
%main_inner = OpFunction %v4float None %9
%11 = OpLabel
OpReturnValue %13
OpFunctionEnd
%main = OpFunction %void None %14
%17 = OpLabel
%18 = OpFunctionCall %v4float %main_inner
OpStore %value %18
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,10 @@
struct Normals {
f : vec3<f32>,
}
const faceNormals = array<Normals, 1>(Normals(vec3(0, 0, 1)));
@vertex
fn main() -> @builtin(position) vec4<f32> {
return vec4(faceNormals[0].f, 1.0);
}

View File

@ -26,7 +26,7 @@ struct x__atomic_compare_exchange_resulti32 {
}; };
void atomicCompareExchangeWeak_1bd40a(device SB_RW_atomic* const tint_symbol_2) { void atomicCompareExchangeWeak_1bd40a(device SB_RW_atomic* const tint_symbol_2) {
x__atomic_compare_exchange_resulti32 res = {}; x__atomic_compare_exchange_resulti32 res = x__atomic_compare_exchange_resulti32{};
atomic_compare_exchange_resulti32 const tint_symbol = atomicCompareExchangeWeak_1(&((*(tint_symbol_2)).arg_0), 1, 1); atomic_compare_exchange_resulti32 const tint_symbol = atomicCompareExchangeWeak_1(&((*(tint_symbol_2)).arg_0), 1, 1);
int const old_value_1 = tint_symbol.old_value; int const old_value_1 = tint_symbol.old_value;
int const x_19 = old_value_1; int const x_19 = old_value_1;

View File

@ -26,7 +26,7 @@ struct x__atomic_compare_exchange_resultu32 {
}; };
void atomicCompareExchangeWeak_63d8e6(device SB_RW_atomic* const tint_symbol_2) { void atomicCompareExchangeWeak_63d8e6(device SB_RW_atomic* const tint_symbol_2) {
x__atomic_compare_exchange_resultu32 res = {}; x__atomic_compare_exchange_resultu32 res = x__atomic_compare_exchange_resultu32{};
atomic_compare_exchange_resultu32 const tint_symbol = atomicCompareExchangeWeak_1(&((*(tint_symbol_2)).arg_0), 1u, 1u); atomic_compare_exchange_resultu32 const tint_symbol = atomicCompareExchangeWeak_1(&((*(tint_symbol_2)).arg_0), 1u, 1u);
uint const old_value_1 = tint_symbol.old_value; uint const old_value_1 = tint_symbol.old_value;
uint const x_17 = old_value_1; uint const x_17 = old_value_1;

View File

@ -18,7 +18,7 @@ struct x__atomic_compare_exchange_resulti32 {
}; };
void atomicCompareExchangeWeak_e88938(threadgroup atomic_int* const tint_symbol_2) { void atomicCompareExchangeWeak_e88938(threadgroup atomic_int* const tint_symbol_2) {
x__atomic_compare_exchange_resulti32 res = {}; x__atomic_compare_exchange_resulti32 res = x__atomic_compare_exchange_resulti32{};
atomic_compare_exchange_resulti32 const tint_symbol = atomicCompareExchangeWeak_1(tint_symbol_2, 1, 1); atomic_compare_exchange_resulti32 const tint_symbol = atomicCompareExchangeWeak_1(tint_symbol_2, 1, 1);
int const old_value_1 = tint_symbol.old_value; int const old_value_1 = tint_symbol.old_value;
int const x_18 = old_value_1; int const x_18 = old_value_1;

View File

@ -18,7 +18,7 @@ struct x__atomic_compare_exchange_resultu32 {
}; };
void atomicCompareExchangeWeak_83580d(threadgroup atomic_uint* const tint_symbol_2) { void atomicCompareExchangeWeak_83580d(threadgroup atomic_uint* const tint_symbol_2) {
x__atomic_compare_exchange_resultu32 res = {}; x__atomic_compare_exchange_resultu32 res = x__atomic_compare_exchange_resultu32{};
atomic_compare_exchange_resultu32 const tint_symbol = atomicCompareExchangeWeak_1(tint_symbol_2, 1u, 1u); atomic_compare_exchange_resultu32 const tint_symbol = atomicCompareExchangeWeak_1(tint_symbol_2, 1u, 1u);
uint const old_value_1 = tint_symbol.old_value; uint const old_value_1 = tint_symbol.old_value;
uint const x_17 = old_value_1; uint const x_17 = old_value_1;

View File

@ -28,7 +28,7 @@ struct x__atomic_compare_exchange_resulti32 {
void atomicCompareExchangeWeak_1bd40a(device SB_RW_atomic* const tint_symbol_2) { void atomicCompareExchangeWeak_1bd40a(device SB_RW_atomic* const tint_symbol_2) {
int arg_1 = 0; int arg_1 = 0;
int arg_2 = 0; int arg_2 = 0;
x__atomic_compare_exchange_resulti32 res = {}; x__atomic_compare_exchange_resulti32 res = x__atomic_compare_exchange_resulti32{};
arg_1 = 1; arg_1 = 1;
arg_2 = 1; arg_2 = 1;
int const x_23 = arg_2; int const x_23 = arg_2;

View File

@ -28,7 +28,7 @@ struct x__atomic_compare_exchange_resultu32 {
void atomicCompareExchangeWeak_63d8e6(device SB_RW_atomic* const tint_symbol_2) { void atomicCompareExchangeWeak_63d8e6(device SB_RW_atomic* const tint_symbol_2) {
uint arg_1 = 0u; uint arg_1 = 0u;
uint arg_2 = 0u; uint arg_2 = 0u;
x__atomic_compare_exchange_resultu32 res = {}; x__atomic_compare_exchange_resultu32 res = x__atomic_compare_exchange_resultu32{};
arg_1 = 1u; arg_1 = 1u;
arg_2 = 1u; arg_2 = 1u;
uint const x_21 = arg_2; uint const x_21 = arg_2;

View File

@ -20,7 +20,7 @@ struct x__atomic_compare_exchange_resulti32 {
void atomicCompareExchangeWeak_e88938(threadgroup atomic_int* const tint_symbol_2) { void atomicCompareExchangeWeak_e88938(threadgroup atomic_int* const tint_symbol_2) {
int arg_1 = 0; int arg_1 = 0;
int arg_2 = 0; int arg_2 = 0;
x__atomic_compare_exchange_resulti32 res = {}; x__atomic_compare_exchange_resulti32 res = x__atomic_compare_exchange_resulti32{};
arg_1 = 1; arg_1 = 1;
arg_2 = 1; arg_2 = 1;
int const x_22 = arg_2; int const x_22 = arg_2;

View File

@ -20,7 +20,7 @@ struct x__atomic_compare_exchange_resultu32 {
void atomicCompareExchangeWeak_83580d(threadgroup atomic_uint* const tint_symbol_2) { void atomicCompareExchangeWeak_83580d(threadgroup atomic_uint* const tint_symbol_2) {
uint arg_1 = 0u; uint arg_1 = 0u;
uint arg_2 = 0u; uint arg_2 = 0u;
x__atomic_compare_exchange_resultu32 res = {}; x__atomic_compare_exchange_resultu32 res = x__atomic_compare_exchange_resultu32{};
arg_1 = 1u; arg_1 = 1u;
arg_2 = 1u; arg_2 = 1u;
uint const x_21 = arg_2; uint const x_21 = arg_2;

View File

@ -19,6 +19,6 @@ struct S {
}; };
void f() { void f() {
S v = {}; S v = S{};
} }

View File

@ -9,6 +9,6 @@ struct S {
}; };
void f() { void f() {
S v = {}; S v = S{};
} }

View File

@ -10,7 +10,7 @@ struct a__ {
}; };
void f() { void f() {
a__ const c = {}; a__ const c = a__{};
int const d = c.b__; int const d = c.b__;
} }

View File

@ -10,7 +10,7 @@ struct _a {
}; };
void f() { void f() {
_a const c = {}; _a const c = _a{};
int const d = c._b; int const d = c._b;
} }

View File

@ -10,7 +10,7 @@ struct _A {
}; };
void f() { void f() {
_A const c = {}; _A const c = _A{};
int const d = c._B; int const d = c._B;
} }

View File

@ -31,7 +31,7 @@ float ret_f32() {
} }
MyStruct ret_MyStruct() { MyStruct ret_MyStruct() {
MyStruct const tint_symbol_2 = {}; MyStruct const tint_symbol_2 = MyStruct{};
return tint_symbol_2; return tint_symbol_2;
} }
@ -48,7 +48,7 @@ void let_decls() {
uint3 const v5 = uint3(1u); uint3 const v5 = uint3(1u);
float3 const v6 = float3(1.0f); float3 const v6 = float3(1.0f);
float3x3 const v7 = float3x3(v6, v6, v6); float3x3 const v7 = float3x3(v6, v6, v6);
MyStruct const v8 = {.f1=1.0f}; MyStruct const v8 = MyStruct{.f1=1.0f};
tint_array<float, 10> const v9 = tint_array<float, 10>{}; tint_array<float, 10> const v9 = tint_array<float, 10>{};
int const v10 = ret_i32(); int const v10 = ret_i32();
uint const v11 = ret_u32(); uint const v11 = ret_u32();

View File

@ -20,7 +20,7 @@ struct S {
fragment void f() { fragment void f() {
thread tint_array<S, 4> tint_symbol_1 = {}; thread tint_array<S, 4> tint_symbol_1 = {};
S const tint_symbol = {.m=1}; S const tint_symbol = S{.m=1};
tint_symbol_1[0] = tint_symbol; tint_symbol_1[0] = tint_symbol;
return; return;
} }

View File

@ -12,7 +12,7 @@ struct tint_symbol_1 {
}; };
FragmentOutputs tint_symbol_inner() { FragmentOutputs tint_symbol_inner() {
FragmentOutputs const tint_symbol_2 = {.frag_depth=1.0f, .sample_mask=1u}; FragmentOutputs const tint_symbol_2 = FragmentOutputs{.frag_depth=1.0f, .sample_mask=1u};
return tint_symbol_2; return tint_symbol_2;
} }

View File

@ -16,7 +16,7 @@ struct tint_symbol_1 {
}; };
FragmentOutputs tint_symbol_inner() { FragmentOutputs tint_symbol_inner() {
FragmentOutputs const tint_symbol_2 = {.loc0=1, .loc1=1u, .loc2=1.0f, .loc3=float4(1.0f, 2.0f, 3.0f, 4.0f)}; FragmentOutputs const tint_symbol_2 = FragmentOutputs{.loc0=1, .loc1=1u, .loc2=1.0f, .loc3=float4(1.0f, 2.0f, 3.0f, 4.0f)};
return tint_symbol_2; return tint_symbol_2;
} }

View File

@ -20,7 +20,7 @@ struct tint_symbol_1 {
}; };
FragmentOutputs tint_symbol_inner() { FragmentOutputs tint_symbol_inner() {
FragmentOutputs const tint_symbol_2 = {.loc0=1, .frag_depth=2.0f, .loc1=1u, .loc2=1.0f, .sample_mask=2u, .loc3=float4(1.0f, 2.0f, 3.0f, 4.0f)}; FragmentOutputs const tint_symbol_2 = FragmentOutputs{.loc0=1, .frag_depth=2.0f, .loc1=1u, .loc2=1.0f, .sample_mask=2u, .loc3=float4(1.0f, 2.0f, 3.0f, 4.0f)};
return tint_symbol_2; return tint_symbol_2;
} }

View File

@ -18,7 +18,7 @@ struct tint_symbol {
}; };
Interface vert_main_inner() { Interface vert_main_inner() {
Interface const tint_symbol_4 = {}; Interface const tint_symbol_4 = Interface{};
return tint_symbol_4; return tint_symbol_4;
} }

View File

@ -26,7 +26,7 @@ struct tint_symbol_1 {
}; };
Out tint_symbol_inner() { Out tint_symbol_inner() {
Out const tint_symbol_2 = {}; Out const tint_symbol_2 = Out{};
return tint_symbol_2; return tint_symbol_2;
} }

View File

@ -17,7 +17,7 @@ struct tint_symbol_1 {
}; };
Out tint_symbol_inner() { Out tint_symbol_inner() {
Out const tint_symbol_2 = {}; Out const tint_symbol_2 = Out{};
return tint_symbol_2; return tint_symbol_2;
} }

View File

@ -14,7 +14,7 @@ struct tint_symbol {
}; };
Interface vert_main_inner() { Interface vert_main_inner() {
Interface const tint_symbol_3 = {.col1=0.400000006f, .col2=0.600000024f, .pos=float4(0.0f)}; Interface const tint_symbol_3 = Interface{.col1=0.400000006f, .col2=0.600000024f, .pos=float4(0.0f)};
return tint_symbol_3; return tint_symbol_3;
} }

View File

@ -10,7 +10,7 @@ struct tint_symbol_1 {
}; };
VertexOutputs tint_symbol_inner() { VertexOutputs tint_symbol_inner() {
VertexOutputs const tint_symbol_2 = {.position=float4(1.0f, 2.0f, 3.0f, 4.0f)}; VertexOutputs const tint_symbol_2 = VertexOutputs{.position=float4(1.0f, 2.0f, 3.0f, 4.0f)};
return tint_symbol_2; return tint_symbol_2;
} }

View File

@ -18,7 +18,7 @@ struct tint_symbol_1 {
}; };
VertexOutputs tint_symbol_inner() { VertexOutputs tint_symbol_inner() {
VertexOutputs const tint_symbol_2 = {.loc0=1, .loc1=1u, .loc2=1.0f, .loc3=float4(1.0f, 2.0f, 3.0f, 4.0f), .position=float4(0.0f)}; VertexOutputs const tint_symbol_2 = VertexOutputs{.loc0=1, .loc1=1u, .loc2=1.0f, .loc3=float4(1.0f, 2.0f, 3.0f, 4.0f), .position=float4(0.0f)};
return tint_symbol_2; return tint_symbol_2;
} }

View File

@ -7,10 +7,10 @@ struct a {
void f() { void f() {
{ {
a a_1 = {}; a a_1 = a{};
a b = a_1; a b = a_1;
} }
a a_2 = {}; a a_2 = a{};
a b = a_2; a b = a_2;
} }

View File

@ -7,10 +7,10 @@ struct a {
void f() { void f() {
{ {
a const a_1 = {}; a const a_1 = a{};
a const b = a_1; a const b = a_1;
} }
a const a_2 = {}; a const a_2 = a{};
a const b = a_2; a const b = a_2;
} }

View File

@ -7,10 +7,10 @@ struct a {
void f() { void f() {
{ {
a a_1 = {}; a a_1 = a{};
a b = a_1; a b = a_1;
} }
a a_2 = {}; a a_2 = a{};
a b = a_2; a b = a_2;
} }

View File

@ -29,7 +29,7 @@ int bar(thread int* const tint_symbol_5) {
} }
void tint_symbol(thread int* const tint_symbol_6) { void tint_symbol(thread int* const tint_symbol_6) {
S x = {}; S x = S{};
int const tint_symbol_3 = foo(tint_symbol_6); int const tint_symbol_3 = foo(tint_symbol_6);
int const tint_symbol_1_save = tint_symbol_3; int const tint_symbol_1_save = tint_symbol_3;
int const tint_symbol_2 = bar(tint_symbol_6); int const tint_symbol_2 = bar(tint_symbol_6);

View File

@ -8,7 +8,7 @@ struct S {
void f() { void f() {
int i = 0; int i = 0;
while (true) { while (true) {
S const tint_symbol = {.i=1}; S const tint_symbol = S{.i=1};
if (!((i < tint_symbol.i))) { if (!((i < tint_symbol.i))) {
break; break;
} }

View File

@ -15,7 +15,7 @@ void f() {
{ {
} }
{ {
S const tint_symbol = {.i=1}; S const tint_symbol = S{.i=1};
i = as_type<int>((as_type<uint>(i) + as_type<uint>(tint_symbol.i))); i = as_type<int>((as_type<uint>(i) + as_type<uint>(tint_symbol.i)));
} }
} }

View File

@ -6,7 +6,7 @@ struct S {
}; };
void f() { void f() {
S const tint_symbol = {.i=1}; S const tint_symbol = S{.i=1};
for(int i = tint_symbol.i; false; ) { for(int i = tint_symbol.i; false; ) {
} }
} }

View File

@ -38,26 +38,26 @@ struct T {
kernel void tint_symbol() { kernel void tint_symbol() {
int const x = 42; int const x = 42;
S1 const empty = {}; S1 const empty = S1{};
S1 const nonempty = {.a=1, .b=2, .c=3, .d=4}; S1 const nonempty = S1{.a=1, .b=2, .c=3, .d=4};
S1 const nonempty_with_expr = {.a=1, .b=x, .c=as_type<int>((as_type<uint>(x) + as_type<uint>(1))), .d=nonempty.d}; S1 const nonempty_with_expr = {.a=1, .b=x, .c=as_type<int>((as_type<uint>(x) + as_type<uint>(1))), .d=nonempty.d};
S3 const nested_empty = {}; S3 const nested_empty = S3{};
S1 const tint_symbol_1 = {.a=2, .b=3, .c=4, .d=5}; S1 const tint_symbol_1 = S1{.a=2, .b=3, .c=4, .d=5};
S1 const tint_symbol_2 = {.a=7, .b=8, .c=9, .d=10}; S1 const tint_symbol_2 = S1{.a=7, .b=8, .c=9, .d=10};
S2 const tint_symbol_3 = {.e=6, .f=tint_symbol_2}; S2 const tint_symbol_3 = {.e=6, .f=tint_symbol_2};
S3 const nested_nonempty = {.g=1, .h=tint_symbol_1, .i=tint_symbol_3}; S3 const nested_nonempty = {.g=1, .h=tint_symbol_1, .i=tint_symbol_3};
S1 const tint_symbol_4 = {.a=2, .b=x, .c=as_type<int>((as_type<uint>(x) + as_type<uint>(1))), .d=nested_nonempty.i.f.d}; S1 const tint_symbol_4 = {.a=2, .b=x, .c=as_type<int>((as_type<uint>(x) + as_type<uint>(1))), .d=nested_nonempty.i.f.d};
S2 const tint_symbol_5 = {.e=6, .f=nonempty}; S2 const tint_symbol_5 = {.e=6, .f=nonempty};
S3 const nested_nonempty_with_expr = {.g=1, .h=tint_symbol_4, .i=tint_symbol_5}; S3 const nested_nonempty_with_expr = {.g=1, .h=tint_symbol_4, .i=tint_symbol_5};
S1 const tint_symbol_6 = {}; S1 const tint_symbol_6 = S1{};
int const subexpr_empty = tint_symbol_6.a; int const subexpr_empty = tint_symbol_6.a;
S1 const tint_symbol_7 = {.a=1, .b=2, .c=3, .d=4}; S1 const tint_symbol_7 = S1{.a=1, .b=2, .c=3, .d=4};
int const subexpr_nonempty = tint_symbol_7.b; int const subexpr_nonempty = tint_symbol_7.b;
S1 const tint_symbol_8 = {.a=1, .b=x, .c=as_type<int>((as_type<uint>(x) + as_type<uint>(1))), .d=nonempty.d}; S1 const tint_symbol_8 = {.a=1, .b=x, .c=as_type<int>((as_type<uint>(x) + as_type<uint>(1))), .d=nonempty.d};
int const subexpr_nonempty_with_expr = tint_symbol_8.c; int const subexpr_nonempty_with_expr = tint_symbol_8.c;
S2 const tint_symbol_9 = {}; S2 const tint_symbol_9 = S2{};
S1 const subexpr_nested_empty = tint_symbol_9.f; S1 const subexpr_nested_empty = tint_symbol_9.f;
S1 const tint_symbol_10 = {.a=2, .b=3, .c=4, .d=5}; S1 const tint_symbol_10 = S1{.a=2, .b=3, .c=4, .d=5};
S2 const tint_symbol_11 = {.e=1, .f=tint_symbol_10}; S2 const tint_symbol_11 = {.e=1, .f=tint_symbol_10};
S1 const subexpr_nested_nonempty = tint_symbol_11.f; S1 const subexpr_nested_nonempty = tint_symbol_11.f;
S1 const tint_symbol_12 = {.a=2, .b=x, .c=as_type<int>((as_type<uint>(x) + as_type<uint>(1))), .d=nested_nonempty.i.f.d}; S1 const tint_symbol_12 = {.a=2, .b=x, .c=as_type<int>((as_type<uint>(x) + as_type<uint>(1))), .d=nested_nonempty.i.f.d};

View File

@ -37,8 +37,8 @@ kernel void tint_symbol() {
float3x4 const m3x4_let = float3x4(float4(0.0f), float4(0.0f), float4(0.0f)); float3x4 const m3x4_let = float3x4(float4(0.0f), float4(0.0f), float4(0.0f));
tint_array<float, 4> arr_var = tint_array<float, 4>{}; tint_array<float, 4> arr_var = tint_array<float, 4>{};
tint_array<float, 4> const arr_let = tint_array<float, 4>{}; tint_array<float, 4> const arr_let = tint_array<float, 4>{};
S struct_var = {}; S struct_var = S{};
S const struct_let = {}; S const struct_let = S{};
return; return;
} }

View File

@ -39,7 +39,7 @@ kernel void tint_symbol() {
tint_symbol_10 = float2x3(float3(0.0f), float3(0.0f)); tint_symbol_10 = float2x3(float3(0.0f), float3(0.0f));
tint_array<float, 4> const tint_symbol_1 = tint_array<float, 4>{}; tint_array<float, 4> const tint_symbol_1 = tint_array<float, 4>{};
tint_symbol_11 = tint_symbol_1; tint_symbol_11 = tint_symbol_1;
S const tint_symbol_2 = {}; S const tint_symbol_2 = S{};
tint_symbol_12 = tint_symbol_2; tint_symbol_12 = tint_symbol_2;
return; return;
} }

View File

@ -28,7 +28,7 @@ kernel void tint_symbol() {
thread float4 tint_symbol_9 = float4(0.0f); thread float4 tint_symbol_9 = float4(0.0f);
thread float2x3 tint_symbol_10 = float2x3(float3(0.0f), float3(0.0f)); thread float2x3 tint_symbol_10 = float2x3(float3(0.0f), float3(0.0f));
thread tint_array<float, 4> tint_symbol_11 = tint_array<float, 4>{}; thread tint_array<float, 4> tint_symbol_11 = tint_array<float, 4>{};
thread S tint_symbol_12 = {}; thread S tint_symbol_12 = S{};
tint_symbol_3 = false; tint_symbol_3 = false;
tint_symbol_4 = 0; tint_symbol_4 = 0;
tint_symbol_5 = 0u; tint_symbol_5 = 0u;
@ -39,7 +39,7 @@ kernel void tint_symbol() {
tint_symbol_10 = float2x3(float3(0.0f), float3(0.0f)); tint_symbol_10 = float2x3(float3(0.0f), float3(0.0f));
tint_array<float, 4> const tint_symbol_1 = tint_array<float, 4>{}; tint_array<float, 4> const tint_symbol_1 = tint_array<float, 4>{};
tint_symbol_11 = tint_symbol_1; tint_symbol_11 = tint_symbol_1;
S const tint_symbol_2 = {}; S const tint_symbol_2 = S{};
tint_symbol_12 = tint_symbol_2; tint_symbol_12 = tint_symbol_2;
return; return;
} }

View File

@ -56,7 +56,7 @@ tint_array<float, 4> ret_arr() {
} }
S ret_struct() { S ret_struct() {
S const tint_symbol_2 = {}; S const tint_symbol_2 = S{};
return tint_symbol_2; return tint_symbol_2;
} }

View File

@ -32,7 +32,7 @@ struct S {
}; };
kernel void tint_symbol() { kernel void tint_symbol() {
S const s = {}; S const s = S{};
return; return;
} }

View File

@ -31,7 +31,7 @@ float ret_f32() {
} }
MyStruct ret_MyStruct() { MyStruct ret_MyStruct() {
MyStruct const tint_symbol_2 = {}; MyStruct const tint_symbol_2 = MyStruct{};
return tint_symbol_2; return tint_symbol_2;
} }
@ -48,7 +48,7 @@ void var_decls() {
uint3 v5 = uint3(1u); uint3 v5 = uint3(1u);
float3 v6 = float3(1.0f); float3 v6 = float3(1.0f);
float3x3 v7 = float3x3(v6, v6, v6); float3x3 v7 = float3x3(v6, v6, v6);
MyStruct v8 = {.f1=1.0f}; MyStruct v8 = MyStruct{.f1=1.0f};
tint_array<float, 10> v9 = tint_array<float, 10>{}; tint_array<float, 10> v9 = tint_array<float, 10>{};
int v10 = ret_i32(); int v10 = ret_i32();
uint v11 = ret_u32(); uint v11 = ret_u32();

View File

@ -25,13 +25,13 @@ kernel void f() {
thread int3 tint_symbol_3 = int3(1); thread int3 tint_symbol_3 = int3(1);
thread uint3 tint_symbol_4 = uint3(1u, 2u, 3u); thread uint3 tint_symbol_4 = uint3(1u, 2u, 3u);
thread float3 tint_symbol_5 = float3(1.0f, 2.0f, 3.0f); thread float3 tint_symbol_5 = float3(1.0f, 2.0f, 3.0f);
thread MyStruct tint_symbol_6 = {.f1=1.0f}; thread MyStruct tint_symbol_6 = MyStruct{.f1=1.0f};
thread tint_array<float, 10> tint_symbol_7 = tint_array<float, 10>{}; thread tint_array<float, 10> tint_symbol_7 = tint_array<float, 10>{};
thread int tint_symbol_8 = 0; thread int tint_symbol_8 = 0;
thread uint tint_symbol_9 = 0u; thread uint tint_symbol_9 = 0u;
thread float tint_symbol_10 = 0.0f; thread float tint_symbol_10 = 0.0f;
thread MyStruct tint_symbol_11 = {}; thread MyStruct tint_symbol_11 = MyStruct{};
thread MyStruct tint_symbol_12 = {}; thread MyStruct tint_symbol_12 = MyStruct{};
thread tint_array<float, 10> tint_symbol_13 = tint_array<float, 10>{}; thread tint_array<float, 10> tint_symbol_13 = tint_array<float, 10>{};
thread int3 tint_symbol_14 = int3(1, 2, 3); thread int3 tint_symbol_14 = int3(1, 2, 3);
thread float3 tint_symbol_15 = float3(1.0f, 2.0f, 3.0f); thread float3 tint_symbol_15 = float3(1.0f, 2.0f, 3.0f);

View File

@ -8,7 +8,7 @@ struct S {
void tint_symbol_inner(uint local_invocation_index, threadgroup S* const tint_symbol_2) { void tint_symbol_inner(uint local_invocation_index, threadgroup S* const tint_symbol_2) {
{ {
S const tint_symbol_1 = {}; S const tint_symbol_1 = S{};
*(tint_symbol_2) = tint_symbol_1; *(tint_symbol_2) = tint_symbol_1;
} }
threadgroup_barrier(mem_flags::mem_threadgroup); threadgroup_barrier(mem_flags::mem_threadgroup);