Add tests derived from VK-GL-CTS

This adds SPIR-V assembly and WGSL tests derived from VK-GL-CTS commit
571256871c2e2f03995373e1e4a02958d8cd8cf5. The following procedure was
followed:

- Those .amber files in VK-GL-CTS wholly owned by Google were
  identified

- All GLSL and SPIR-V shaders were extracted from the Amber files and
  converted into SPIR-V binaries

- The compact-ids pass of spirv-opt was applied to each binary

- Duplicate binaries were removed

- spirv-opt -O was used to obtain an optimized version of each remaining
  binary, with duplicates discarded

- Binaries that failed validation using spirv-val with target
  environment SPIR-V 1.3 were discarded

- Those binaries that tint could not successfully convert into WGSL were
  put aside for further investigation

- SPIR-V assembly versions of the remaining binaries are included in
  this CL

- test-runner with -generate-expected and -generate-skip was used to
  generate expected .spvasm, .msl, .hlsl and .wgsl outputs for these
  SPIR-V assembly tests

- Each successfully-generated .expected.wgsl is included in this CL
  again, as a WGLSL test

- test-runner with -generate-expected and -generate-skip was used again,
  to generate expected outputs for these WGSL tests

Change-Id: Ibe9baf2729cf97e0b633db9a426f53362a5de540
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58842
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
Alastair Donaldson
2021-07-23 13:10:12 +00:00
committed by Tint LUCI CQ
parent bd3edb564f
commit f7e73d4ee3
5160 changed files with 621458 additions and 0 deletions

View File

@@ -0,0 +1,134 @@
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %_GLF_color
OpExecutionMode %main OriginUpperLeft
OpSource ESSL 310
OpName %main "main"
OpName %i "i"
OpName %buf0 "buf0"
OpMemberName %buf0 0 "injectionSwitch"
OpName %_ ""
OpName %_GLF_color "_GLF_color"
OpDecorate %i RelaxedPrecision
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %buf0 Block
OpDecorate %_ DescriptorSet 0
OpDecorate %_ Binding 0
OpDecorate %7 RelaxedPrecision
OpDecorate %8 RelaxedPrecision
OpDecorate %9 RelaxedPrecision
OpDecorate %10 RelaxedPrecision
OpDecorate %11 RelaxedPrecision
OpDecorate %12 RelaxedPrecision
OpDecorate %13 RelaxedPrecision
OpDecorate %14 RelaxedPrecision
OpDecorate %15 RelaxedPrecision
OpDecorate %16 RelaxedPrecision
OpDecorate %17 RelaxedPrecision
OpDecorate %18 RelaxedPrecision
OpDecorate %19 RelaxedPrecision
OpDecorate %20 RelaxedPrecision
OpDecorate %21 RelaxedPrecision
OpDecorate %22 RelaxedPrecision
OpDecorate %_GLF_color Location 0
%void = OpTypeVoid
%24 = OpTypeFunction %void
%int = OpTypeInt 32 1
%_ptr_Function_int = OpTypePointer Function %int
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%buf0 = OpTypeStruct %v2float
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%_ = OpVariable %_ptr_Uniform_buf0 Uniform
%int_0 = OpConstant %int 0
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_float = OpTypePointer Uniform %float
%int_1 = OpConstant %int 1
%int_5 = OpConstant %int 5
%int_7 = OpConstant %int 7
%int_200 = OpConstant %int 200
%bool = OpTypeBool
%int_100 = OpConstant %int 100
%int_2 = OpConstant %int 2
%int_3 = OpConstant %int 3
%int_n2 = OpConstant %int -2
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%_GLF_color = OpVariable %_ptr_Output_v4float Output
%float_1 = OpConstant %float 1
%float_0 = OpConstant %float 0
%47 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
%48 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
%main = OpFunction %void None %24
%49 = OpLabel
%i = OpVariable %_ptr_Function_int Function
%50 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0
%51 = OpLoad %float %50
%7 = OpConvertFToS %int %51
OpStore %i %7
%8 = OpLoad %int %i
OpSelectionMerge %52 None
OpSwitch %8 %53 0 %54
%53 = OpLabel
%20 = OpLoad %int %i
%21 = OpISub %int %20 %int_3
OpStore %i %21
OpBranch %52
%54 = OpLabel
OpBranch %55
%55 = OpLabel
OpLoopMerge %56 %57 None
OpBranch %58
%58 = OpLabel
%9 = OpLoad %int %i
%10 = OpIAdd %int %9 %int_1
OpStore %i %10
%11 = OpLoad %int %i
OpSelectionMerge %59 None
OpSwitch %11 %60 1 %61 2 %62
%60 = OpLabel
%14 = OpLoad %int %i
%15 = OpIAdd %int %14 %int_7
OpStore %i %15
OpBranch %59
%61 = OpLabel
OpBranch %57
%62 = OpLabel
%12 = OpLoad %int %i
%13 = OpIAdd %int %12 %int_5
OpStore %i %13
OpBranch %59
%59 = OpLabel
OpBranch %57
%57 = OpLabel
%16 = OpLoad %int %i
%63 = OpSGreaterThan %bool %16 %int_200
OpBranchConditional %63 %55 %56
%56 = OpLabel
%17 = OpLoad %int %i
%64 = OpSGreaterThan %bool %17 %int_100
OpSelectionMerge %65 None
OpBranchConditional %64 %66 %65
%66 = OpLabel
%18 = OpLoad %int %i
%19 = OpISub %int %18 %int_2
OpStore %i %19
OpBranch %52
%65 = OpLabel
OpBranch %53
%52 = OpLabel
%22 = OpLoad %int %i
%67 = OpIEqual %bool %22 %int_n2
OpSelectionMerge %68 None
OpBranchConditional %67 %69 %70
%69 = OpLabel
OpStore %_GLF_color %47
OpBranch %68
%70 = OpLabel
OpStore %_GLF_color %48
OpBranch %68
%68 = OpLabel
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,72 @@
cbuffer cbuffer_x_6 : register(b0, space0) {
uint4 x_6[1];
};
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
void main_1() {
int i = 0;
const float x_51 = asfloat(x_6[0].x);
i = int(x_51);
switch(i) {
case 0: {
while (true) {
i = (i + 1);
switch(i) {
case 2: {
i = (i + 5);
break;
}
case 1: {
{
if ((i > 200)) {
} else {
break;
}
}
continue;
break;
}
default: {
i = (i + 7);
break;
}
}
{
if ((i > 200)) {
} else {
break;
}
}
}
if ((i > 100)) {
i = (i - 2);
break;
}
/* fallthrough */
}
default: {
i = (i - 3);
break;
}
}
if ((i == -2)) {
x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
} else {
x_GLF_color = float4(0.0f, 0.0f, 0.0f, 1.0f);
}
return;
}
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol {
float4 x_GLF_color_1 : SV_Target0;
};
tint_symbol main() {
main_1();
const main_out tint_symbol_1 = {x_GLF_color};
const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1};
return tint_symbol_3;
}

View File

@@ -0,0 +1,86 @@
#include <metal_stdlib>
using namespace metal;
struct buf0 {
/* 0x0000 */ packed_float2 injectionSwitch;
};
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_1 {
float4 x_GLF_color_1 [[color(0)]];
};
void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) {
int i = 0;
float const x_51 = x_6.injectionSwitch.x;
i = int(x_51);
int const x_8 = i;
switch(x_8) {
case 0: {
while (true) {
int const x_9 = i;
i = (x_9 + 1);
int const x_11 = i;
switch(x_11) {
case 2: {
int const x_12 = i;
i = (x_12 + 5);
break;
}
case 1: {
{
int const x_16 = i;
if ((x_16 > 200)) {
} else {
break;
}
}
continue;
break;
}
default: {
int const x_14 = i;
i = (x_14 + 7);
break;
}
}
{
int const x_16 = i;
if ((x_16 > 200)) {
} else {
break;
}
}
}
int const x_17 = i;
if ((x_17 > 100)) {
int const x_18 = i;
i = (x_18 - 2);
break;
}
/* fallthrough */
}
default: {
int const x_20 = i;
i = (x_20 - 3);
break;
}
}
int const x_22 = i;
if ((x_22 == -2)) {
*(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f);
} else {
*(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 1.0f);
}
return;
}
fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) {
thread float4 tint_symbol_5 = 0.0f;
main_1(x_6, &(tint_symbol_5));
main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5};
tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1};
return tint_symbol_3;
}

View File

@@ -0,0 +1,160 @@
SKIP: FAILED
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 88
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %tint_symbol_1
OpExecutionMode %main OriginUpperLeft
OpName %buf0 "buf0"
OpMemberName %buf0 0 "injectionSwitch"
OpName %x_6 "x_6"
OpName %x_GLF_color "x_GLF_color"
OpName %tint_symbol_1 "tint_symbol_1"
OpName %main_1 "main_1"
OpName %i "i"
OpName %main_out "main_out"
OpMemberName %main_out 0 "x_GLF_color_1"
OpName %tint_symbol_2 "tint_symbol_2"
OpName %tint_symbol "tint_symbol"
OpName %main "main"
OpDecorate %buf0 Block
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %x_6 NonWritable
OpDecorate %x_6 DescriptorSet 0
OpDecorate %x_6 Binding 0
OpDecorate %tint_symbol_1 Location 0
OpMemberDecorate %main_out 0 Offset 0
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%buf0 = OpTypeStruct %v2float
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%x_6 = OpVariable %_ptr_Uniform_buf0 Uniform
%v4float = OpTypeVector %float 4
%_ptr_Private_v4float = OpTypePointer Private %v4float
%9 = OpConstantNull %v4float
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9
%_ptr_Output_v4float = OpTypePointer Output %v4float
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9
%void = OpTypeVoid
%12 = OpTypeFunction %void
%int = OpTypeInt 32 1
%_ptr_Function_int = OpTypePointer Function %int
%19 = OpConstantNull %int
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_float = OpTypePointer Uniform %float
%int_1 = OpConstant %int 1
%int_5 = OpConstant %int 5
%int_7 = OpConstant %int 7
%int_200 = OpConstant %int 200
%bool = OpTypeBool
%int_100 = OpConstant %int 100
%int_2 = OpConstant %int 2
%int_3 = OpConstant %int 3
%int_n2 = OpConstant %int -2
%float_1 = OpConstant %float 1
%float_0 = OpConstant %float 0
%74 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
%75 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
%main_out = OpTypeStruct %v4float
%76 = OpTypeFunction %void %main_out
%main_1 = OpFunction %void None %12
%15 = OpLabel
%i = OpVariable %_ptr_Function_int Function %19
%23 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0
%24 = OpLoad %float %23
%25 = OpConvertFToS %int %24
OpStore %i %25
%26 = OpLoad %int %i
OpSelectionMerge %27 None
OpSwitch %26 %28 0 %29
%29 = OpLabel
OpBranch %30
%30 = OpLabel
OpLoopMerge %31 %32 None
OpBranch %33
%33 = OpLabel
%34 = OpLoad %int %i
%36 = OpIAdd %int %34 %int_1
OpStore %i %36
%37 = OpLoad %int %i
OpSelectionMerge %38 None
OpSwitch %37 %39 2 %40 1 %41
%40 = OpLabel
%42 = OpLoad %int %i
%44 = OpIAdd %int %42 %int_5
OpStore %i %44
OpBranch %38
%41 = OpLabel
OpBranch %32
%39 = OpLabel
%45 = OpLoad %int %i
%47 = OpIAdd %int %45 %int_7
OpStore %i %47
OpBranch %38
%38 = OpLabel
OpBranch %32
%32 = OpLabel
%48 = OpLoad %int %i
%50 = OpSGreaterThan %bool %48 %int_200
OpSelectionMerge %52 None
OpBranchConditional %50 %53 %54
%53 = OpLabel
OpBranch %52
%54 = OpLabel
OpBranch %31
%52 = OpLabel
OpBranch %30
%31 = OpLabel
%55 = OpLoad %int %i
%57 = OpSGreaterThan %bool %55 %int_100
OpSelectionMerge %58 None
OpBranchConditional %57 %59 %58
%59 = OpLabel
%60 = OpLoad %int %i
%62 = OpISub %int %60 %int_2
OpStore %i %62
OpBranch %27
%58 = OpLabel
OpBranch %28
%28 = OpLabel
%63 = OpLoad %int %i
%65 = OpISub %int %63 %int_3
OpStore %i %65
OpBranch %27
%27 = OpLabel
%66 = OpLoad %int %i
%68 = OpIEqual %bool %66 %int_n2
OpSelectionMerge %69 None
OpBranchConditional %68 %70 %71
%70 = OpLabel
OpStore %x_GLF_color %74
OpBranch %69
%71 = OpLabel
OpStore %x_GLF_color %75
OpBranch %69
%69 = OpLabel
OpReturn
OpFunctionEnd
%tint_symbol_2 = OpFunction %void None %76
%tint_symbol = OpFunctionParameter %main_out
%80 = OpLabel
%81 = OpCompositeExtract %v4float %tint_symbol 0
OpStore %tint_symbol_1 %81
OpReturn
OpFunctionEnd
%main = OpFunction %void None %12
%83 = OpLabel
%84 = OpFunctionCall %void %main_1
%86 = OpLoad %v4float %x_GLF_color
%87 = OpCompositeConstruct %main_out %86
%85 = OpFunctionCall %void %tint_symbol_2 %87
OpReturn
OpFunctionEnd
1:1: The continue construct with the continue target 32[%32] is not post dominated by the back-edge block 52[%52]
%52 = OpLabel

View File

@@ -0,0 +1,74 @@
[[block]]
struct buf0 {
injectionSwitch : vec2<f32>;
};
[[group(0), binding(0)]] var<uniform> x_6 : buf0;
var<private> x_GLF_color : vec4<f32>;
fn main_1() {
var i : i32;
let x_51 : f32 = x_6.injectionSwitch.x;
i = i32(x_51);
let x_8 : i32 = i;
switch(x_8) {
case 0: {
loop {
let x_9 : i32 = i;
i = (x_9 + 1);
let x_11 : i32 = i;
switch(x_11) {
case 2: {
let x_12 : i32 = i;
i = (x_12 + 5);
}
case 1: {
continue;
}
default: {
let x_14 : i32 = i;
i = (x_14 + 7);
}
}
continuing {
let x_16 : i32 = i;
if ((x_16 > 200)) {
} else {
break;
}
}
}
let x_17 : i32 = i;
if ((x_17 > 100)) {
let x_18 : i32 = i;
i = (x_18 - 2);
break;
}
fallthrough;
}
default: {
let x_20 : i32 = i;
i = (x_20 - 3);
}
}
let x_22 : i32 = i;
if ((x_22 == -2)) {
x_GLF_color = vec4<f32>(1.0, 0.0, 0.0, 1.0);
} else {
x_GLF_color = vec4<f32>(0.0, 0.0, 0.0, 1.0);
}
return;
}
struct main_out {
[[location(0)]]
x_GLF_color_1 : vec4<f32>;
};
[[stage(fragment)]]
fn main() -> main_out {
main_1();
return main_out(x_GLF_color);
}

View File

@@ -0,0 +1,74 @@
[[block]]
struct buf0 {
injectionSwitch : vec2<f32>;
};
[[group(0), binding(0)]] var<uniform> x_6 : buf0;
var<private> x_GLF_color : vec4<f32>;
fn main_1() {
var i : i32;
let x_51 : f32 = x_6.injectionSwitch.x;
i = i32(x_51);
let x_8 : i32 = i;
switch(x_8) {
case 0: {
loop {
let x_9 : i32 = i;
i = (x_9 + 1);
let x_11 : i32 = i;
switch(x_11) {
case 2: {
let x_12 : i32 = i;
i = (x_12 + 5);
}
case 1: {
continue;
}
default: {
let x_14 : i32 = i;
i = (x_14 + 7);
}
}
continuing {
let x_16 : i32 = i;
if ((x_16 > 200)) {
} else {
break;
}
}
}
let x_17 : i32 = i;
if ((x_17 > 100)) {
let x_18 : i32 = i;
i = (x_18 - 2);
break;
}
fallthrough;
}
default: {
let x_20 : i32 = i;
i = (x_20 - 3);
}
}
let x_22 : i32 = i;
if ((x_22 == -2)) {
x_GLF_color = vec4<f32>(1.0, 0.0, 0.0, 1.0);
} else {
x_GLF_color = vec4<f32>(0.0, 0.0, 0.0, 1.0);
}
return;
}
struct main_out {
[[location(0)]]
x_GLF_color_1 : vec4<f32>;
};
[[stage(fragment)]]
fn main() -> main_out {
main_1();
return main_out(x_GLF_color);
}

View File

@@ -0,0 +1,72 @@
cbuffer cbuffer_x_6 : register(b0, space0) {
uint4 x_6[1];
};
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
void main_1() {
int i = 0;
const float x_51 = asfloat(x_6[0].x);
i = int(x_51);
switch(i) {
case 0: {
while (true) {
i = (i + 1);
switch(i) {
case 2: {
i = (i + 5);
break;
}
case 1: {
{
if ((i > 200)) {
} else {
break;
}
}
continue;
break;
}
default: {
i = (i + 7);
break;
}
}
{
if ((i > 200)) {
} else {
break;
}
}
}
if ((i > 100)) {
i = (i - 2);
break;
}
/* fallthrough */
}
default: {
i = (i - 3);
break;
}
}
if ((i == -2)) {
x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
} else {
x_GLF_color = float4(0.0f, 0.0f, 0.0f, 1.0f);
}
return;
}
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol {
float4 x_GLF_color_1 : SV_Target0;
};
tint_symbol main() {
main_1();
const main_out tint_symbol_1 = {x_GLF_color};
const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1};
return tint_symbol_3;
}

View File

@@ -0,0 +1,86 @@
#include <metal_stdlib>
using namespace metal;
struct buf0 {
/* 0x0000 */ packed_float2 injectionSwitch;
};
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_1 {
float4 x_GLF_color_1 [[color(0)]];
};
void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) {
int i = 0;
float const x_51 = x_6.injectionSwitch.x;
i = int(x_51);
int const x_8 = i;
switch(x_8) {
case 0: {
while (true) {
int const x_9 = i;
i = (x_9 + 1);
int const x_11 = i;
switch(x_11) {
case 2: {
int const x_12 = i;
i = (x_12 + 5);
break;
}
case 1: {
{
int const x_16 = i;
if ((x_16 > 200)) {
} else {
break;
}
}
continue;
break;
}
default: {
int const x_14 = i;
i = (x_14 + 7);
break;
}
}
{
int const x_16 = i;
if ((x_16 > 200)) {
} else {
break;
}
}
}
int const x_17 = i;
if ((x_17 > 100)) {
int const x_18 = i;
i = (x_18 - 2);
break;
}
/* fallthrough */
}
default: {
int const x_20 = i;
i = (x_20 - 3);
break;
}
}
int const x_22 = i;
if ((x_22 == -2)) {
*(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f);
} else {
*(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 1.0f);
}
return;
}
fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) {
thread float4 tint_symbol_5 = 0.0f;
main_1(x_6, &(tint_symbol_5));
main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5};
tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1};
return tint_symbol_3;
}

View File

@@ -0,0 +1,160 @@
SKIP: FAILED
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 88
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %tint_symbol_1
OpExecutionMode %main OriginUpperLeft
OpName %buf0 "buf0"
OpMemberName %buf0 0 "injectionSwitch"
OpName %x_6 "x_6"
OpName %x_GLF_color "x_GLF_color"
OpName %tint_symbol_1 "tint_symbol_1"
OpName %main_1 "main_1"
OpName %i "i"
OpName %main_out "main_out"
OpMemberName %main_out 0 "x_GLF_color_1"
OpName %tint_symbol_2 "tint_symbol_2"
OpName %tint_symbol "tint_symbol"
OpName %main "main"
OpDecorate %buf0 Block
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %x_6 NonWritable
OpDecorate %x_6 DescriptorSet 0
OpDecorate %x_6 Binding 0
OpDecorate %tint_symbol_1 Location 0
OpMemberDecorate %main_out 0 Offset 0
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%buf0 = OpTypeStruct %v2float
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%x_6 = OpVariable %_ptr_Uniform_buf0 Uniform
%v4float = OpTypeVector %float 4
%_ptr_Private_v4float = OpTypePointer Private %v4float
%9 = OpConstantNull %v4float
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9
%_ptr_Output_v4float = OpTypePointer Output %v4float
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9
%void = OpTypeVoid
%12 = OpTypeFunction %void
%int = OpTypeInt 32 1
%_ptr_Function_int = OpTypePointer Function %int
%19 = OpConstantNull %int
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_float = OpTypePointer Uniform %float
%int_1 = OpConstant %int 1
%int_5 = OpConstant %int 5
%int_7 = OpConstant %int 7
%int_200 = OpConstant %int 200
%bool = OpTypeBool
%int_100 = OpConstant %int 100
%int_2 = OpConstant %int 2
%int_3 = OpConstant %int 3
%int_n2 = OpConstant %int -2
%float_1 = OpConstant %float 1
%float_0 = OpConstant %float 0
%74 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
%75 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
%main_out = OpTypeStruct %v4float
%76 = OpTypeFunction %void %main_out
%main_1 = OpFunction %void None %12
%15 = OpLabel
%i = OpVariable %_ptr_Function_int Function %19
%23 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0
%24 = OpLoad %float %23
%25 = OpConvertFToS %int %24
OpStore %i %25
%26 = OpLoad %int %i
OpSelectionMerge %27 None
OpSwitch %26 %28 0 %29
%29 = OpLabel
OpBranch %30
%30 = OpLabel
OpLoopMerge %31 %32 None
OpBranch %33
%33 = OpLabel
%34 = OpLoad %int %i
%36 = OpIAdd %int %34 %int_1
OpStore %i %36
%37 = OpLoad %int %i
OpSelectionMerge %38 None
OpSwitch %37 %39 2 %40 1 %41
%40 = OpLabel
%42 = OpLoad %int %i
%44 = OpIAdd %int %42 %int_5
OpStore %i %44
OpBranch %38
%41 = OpLabel
OpBranch %32
%39 = OpLabel
%45 = OpLoad %int %i
%47 = OpIAdd %int %45 %int_7
OpStore %i %47
OpBranch %38
%38 = OpLabel
OpBranch %32
%32 = OpLabel
%48 = OpLoad %int %i
%50 = OpSGreaterThan %bool %48 %int_200
OpSelectionMerge %52 None
OpBranchConditional %50 %53 %54
%53 = OpLabel
OpBranch %52
%54 = OpLabel
OpBranch %31
%52 = OpLabel
OpBranch %30
%31 = OpLabel
%55 = OpLoad %int %i
%57 = OpSGreaterThan %bool %55 %int_100
OpSelectionMerge %58 None
OpBranchConditional %57 %59 %58
%59 = OpLabel
%60 = OpLoad %int %i
%62 = OpISub %int %60 %int_2
OpStore %i %62
OpBranch %27
%58 = OpLabel
OpBranch %28
%28 = OpLabel
%63 = OpLoad %int %i
%65 = OpISub %int %63 %int_3
OpStore %i %65
OpBranch %27
%27 = OpLabel
%66 = OpLoad %int %i
%68 = OpIEqual %bool %66 %int_n2
OpSelectionMerge %69 None
OpBranchConditional %68 %70 %71
%70 = OpLabel
OpStore %x_GLF_color %74
OpBranch %69
%71 = OpLabel
OpStore %x_GLF_color %75
OpBranch %69
%69 = OpLabel
OpReturn
OpFunctionEnd
%tint_symbol_2 = OpFunction %void None %76
%tint_symbol = OpFunctionParameter %main_out
%80 = OpLabel
%81 = OpCompositeExtract %v4float %tint_symbol 0
OpStore %tint_symbol_1 %81
OpReturn
OpFunctionEnd
%main = OpFunction %void None %12
%83 = OpLabel
%84 = OpFunctionCall %void %main_1
%86 = OpLoad %v4float %x_GLF_color
%87 = OpCompositeConstruct %main_out %86
%85 = OpFunctionCall %void %tint_symbol_2 %87
OpReturn
OpFunctionEnd
1:1: The continue construct with the continue target 32[%32] is not post dominated by the back-edge block 52[%52]
%52 = OpLabel

View File

@@ -0,0 +1,74 @@
[[block]]
struct buf0 {
injectionSwitch : vec2<f32>;
};
[[group(0), binding(0)]] var<uniform> x_6 : buf0;
var<private> x_GLF_color : vec4<f32>;
fn main_1() {
var i : i32;
let x_51 : f32 = x_6.injectionSwitch.x;
i = i32(x_51);
let x_8 : i32 = i;
switch(x_8) {
case 0: {
loop {
let x_9 : i32 = i;
i = (x_9 + 1);
let x_11 : i32 = i;
switch(x_11) {
case 2: {
let x_12 : i32 = i;
i = (x_12 + 5);
}
case 1: {
continue;
}
default: {
let x_14 : i32 = i;
i = (x_14 + 7);
}
}
continuing {
let x_16 : i32 = i;
if ((x_16 > 200)) {
} else {
break;
}
}
}
let x_17 : i32 = i;
if ((x_17 > 100)) {
let x_18 : i32 = i;
i = (x_18 - 2);
break;
}
fallthrough;
}
default: {
let x_20 : i32 = i;
i = (x_20 - 3);
}
}
let x_22 : i32 = i;
if ((x_22 == -2)) {
x_GLF_color = vec4<f32>(1.0, 0.0, 0.0, 1.0);
} else {
x_GLF_color = vec4<f32>(0.0, 0.0, 0.0, 1.0);
}
return;
}
struct main_out {
[[location(0)]]
x_GLF_color_1 : vec4<f32>;
};
[[stage(fragment)]]
fn main() -> main_out {
main_1();
return main_out(x_GLF_color);
}