writer/spirv: Fix emission of select()
The argument order between WGSL and SPIR-V is different (condition is first in SPIR-V, last in WGSL)
Fixed: tint:560
Change-Id: I56c659c441292e05f71a24d96dbc9f93f25b71f0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53620
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
diff --git a/src/writer/spirv/builder.cc b/src/writer/spirv/builder.cc
index 4362d9c..c42a993 100644
--- a/src/writer/spirv/builder.cc
+++ b/src/writer/spirv/builder.cc
@@ -2349,9 +2349,22 @@
case IntrinsicType::kReverseBits:
op = spv::Op::OpBitReverse;
break;
- case IntrinsicType::kSelect:
- op = spv::Op::OpSelect;
- break;
+ case IntrinsicType::kSelect: {
+ // Note: Argument order is different in WGSL and SPIR-V
+ auto cond_id = get_param_as_value_id(2);
+ auto true_id = get_param_as_value_id(0);
+ auto false_id = get_param_as_value_id(1);
+ if (!cond_id || !true_id || !false_id) {
+ return 0;
+ }
+ if (!push_function_inst(
+ spv::Op::OpSelect,
+ {Operand::Int(result_type_id), result, Operand::Int(cond_id),
+ Operand::Int(true_id), Operand::Int(false_id)})) {
+ return 0;
+ }
+ return result_id;
+ }
default: {
auto set_id = GetGLSLstd450Import();
auto inst_id = intrinsic_to_glsl_method(intrinsic);
diff --git a/src/writer/spirv/builder_intrinsic_test.cc b/src/writer/spirv/builder_intrinsic_test.cc
index ebc1de3..ecb4fd5 100644
--- a/src/writer/spirv/builder_intrinsic_test.cc
+++ b/src/writer/spirv/builder_intrinsic_test.cc
@@ -509,9 +509,9 @@
%6 = OpVariable %7 Private %10
)");
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()),
- R"(%12 = OpLoad %3 %1
+ R"(%12 = OpLoad %8 %6
%13 = OpLoad %3 %1
-%14 = OpLoad %8 %6
+%14 = OpLoad %3 %1
%11 = OpSelect %3 %12 %13 %14
)");
}
diff --git a/test/intrinsics/gen/select/00b848.wgsl.expected.spvasm b/test/intrinsics/gen/select/00b848.wgsl.expected.spvasm
index 032991f..f1f6047 100644
--- a/test/intrinsics/gen/select/00b848.wgsl.expected.spvasm
+++ b/test/intrinsics/gen/select/00b848.wgsl.expected.spvasm
@@ -1,64 +1,72 @@
-SKIP: FAILED
-
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 28
+; Bound: 37
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize
+ OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize %tint_symbol_1
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "compute_main"
OpExecutionMode %fragment_main OriginUpperLeft
OpExecutionMode %compute_main LocalSize 1 1 1
OpName %tint_pointsize "tint_pointsize"
+ OpName %tint_symbol_1 "tint_symbol_1"
OpName %select_00b848 "select_00b848"
OpName %res "res"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol "tint_symbol"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol_1 BuiltIn Position
%float = OpTypeFloat 32
%_ptr_Output_float = OpTypePointer Output %float
%4 = OpConstantNull %float
%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %8 = OpConstantNull %v4float
+%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8
%void = OpTypeVoid
- %5 = OpTypeFunction %void
+ %9 = OpTypeFunction %void
%int = OpTypeInt 32 1
%v2int = OpTypeVector %int 2
- %12 = OpConstantNull %v2int
%bool = OpTypeBool
%v2bool = OpTypeVector %bool 2
- %15 = OpConstantNull %v2bool
+ %18 = OpConstantNull %v2bool
+ %19 = OpConstantNull %v2int
%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %22 = OpTypeFunction %void %v4float
%float_1 = OpConstant %float 1
-%select_00b848 = OpFunction %void None %5
- %8 = OpLabel
- %res = OpVariable %_ptr_Function_v2int Function %12
- %9 = OpSelect %v2int %12 %12 %15
- OpStore %res %9
+%select_00b848 = OpFunction %void None %9
+ %12 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %19
+ %13 = OpSelect %v2int %18 %19 %19
+ OpStore %res %13
OpReturn
OpFunctionEnd
-%vertex_main = OpFunction %void None %5
- %19 = OpLabel
+%tint_symbol_2 = OpFunction %void None %22
+%tint_symbol = OpFunctionParameter %v4float
+ %25 = OpLabel
+ OpStore %tint_symbol_1 %tint_symbol
+ OpReturn
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %27 = OpLabel
OpStore %tint_pointsize %float_1
- %21 = OpFunctionCall %void %select_00b848
+ %29 = OpFunctionCall %void %select_00b848
+ %30 = OpFunctionCall %void %tint_symbol_2 %8
OpReturn
OpFunctionEnd
-%fragment_main = OpFunction %void None %5
- %23 = OpLabel
- %24 = OpFunctionCall %void %select_00b848
+%fragment_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %select_00b848
OpReturn
OpFunctionEnd
-%compute_main = OpFunction %void None %5
- %26 = OpLabel
- %27 = OpFunctionCall %void %select_00b848
+%compute_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %select_00b848
OpReturn
OpFunctionEnd
-
-
-Validation Failure:
-1:1: Expected bool scalar or vector type as condition: Select
- %9 = OpSelect %v2int %12 %12 %15
-
diff --git a/test/intrinsics/gen/select/01e2cd.wgsl.expected.spvasm b/test/intrinsics/gen/select/01e2cd.wgsl.expected.spvasm
index f0402bc..9ebcbef 100644
--- a/test/intrinsics/gen/select/01e2cd.wgsl.expected.spvasm
+++ b/test/intrinsics/gen/select/01e2cd.wgsl.expected.spvasm
@@ -1,64 +1,72 @@
-SKIP: FAILED
-
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 28
+; Bound: 37
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize
+ OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize %tint_symbol_1
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "compute_main"
OpExecutionMode %fragment_main OriginUpperLeft
OpExecutionMode %compute_main LocalSize 1 1 1
OpName %tint_pointsize "tint_pointsize"
+ OpName %tint_symbol_1 "tint_symbol_1"
OpName %select_01e2cd "select_01e2cd"
OpName %res "res"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol "tint_symbol"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol_1 BuiltIn Position
%float = OpTypeFloat 32
%_ptr_Output_float = OpTypePointer Output %float
%4 = OpConstantNull %float
%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %8 = OpConstantNull %v4float
+%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8
%void = OpTypeVoid
- %5 = OpTypeFunction %void
+ %9 = OpTypeFunction %void
%int = OpTypeInt 32 1
%v3int = OpTypeVector %int 3
- %12 = OpConstantNull %v3int
%bool = OpTypeBool
%v3bool = OpTypeVector %bool 3
- %15 = OpConstantNull %v3bool
+ %18 = OpConstantNull %v3bool
+ %19 = OpConstantNull %v3int
%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %22 = OpTypeFunction %void %v4float
%float_1 = OpConstant %float 1
-%select_01e2cd = OpFunction %void None %5
- %8 = OpLabel
- %res = OpVariable %_ptr_Function_v3int Function %12
- %9 = OpSelect %v3int %12 %12 %15
- OpStore %res %9
+%select_01e2cd = OpFunction %void None %9
+ %12 = OpLabel
+ %res = OpVariable %_ptr_Function_v3int Function %19
+ %13 = OpSelect %v3int %18 %19 %19
+ OpStore %res %13
OpReturn
OpFunctionEnd
-%vertex_main = OpFunction %void None %5
- %19 = OpLabel
+%tint_symbol_2 = OpFunction %void None %22
+%tint_symbol = OpFunctionParameter %v4float
+ %25 = OpLabel
+ OpStore %tint_symbol_1 %tint_symbol
+ OpReturn
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %27 = OpLabel
OpStore %tint_pointsize %float_1
- %21 = OpFunctionCall %void %select_01e2cd
+ %29 = OpFunctionCall %void %select_01e2cd
+ %30 = OpFunctionCall %void %tint_symbol_2 %8
OpReturn
OpFunctionEnd
-%fragment_main = OpFunction %void None %5
- %23 = OpLabel
- %24 = OpFunctionCall %void %select_01e2cd
+%fragment_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %select_01e2cd
OpReturn
OpFunctionEnd
-%compute_main = OpFunction %void None %5
- %26 = OpLabel
- %27 = OpFunctionCall %void %select_01e2cd
+%compute_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %select_01e2cd
OpReturn
OpFunctionEnd
-
-
-Validation Failure:
-1:1: Expected bool scalar or vector type as condition: Select
- %9 = OpSelect %v3int %12 %12 %15
-
diff --git a/test/intrinsics/gen/select/1e960b.wgsl.expected.spvasm b/test/intrinsics/gen/select/1e960b.wgsl.expected.spvasm
index 2f41bf0..9a8cc2b 100644
--- a/test/intrinsics/gen/select/1e960b.wgsl.expected.spvasm
+++ b/test/intrinsics/gen/select/1e960b.wgsl.expected.spvasm
@@ -1,64 +1,72 @@
-SKIP: FAILED
-
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 28
+; Bound: 37
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize
+ OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize %tint_symbol_1
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "compute_main"
OpExecutionMode %fragment_main OriginUpperLeft
OpExecutionMode %compute_main LocalSize 1 1 1
OpName %tint_pointsize "tint_pointsize"
+ OpName %tint_symbol_1 "tint_symbol_1"
OpName %select_1e960b "select_1e960b"
OpName %res "res"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol "tint_symbol"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol_1 BuiltIn Position
%float = OpTypeFloat 32
%_ptr_Output_float = OpTypePointer Output %float
%4 = OpConstantNull %float
%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %8 = OpConstantNull %v4float
+%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8
%void = OpTypeVoid
- %5 = OpTypeFunction %void
+ %9 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%v2uint = OpTypeVector %uint 2
- %12 = OpConstantNull %v2uint
%bool = OpTypeBool
%v2bool = OpTypeVector %bool 2
- %15 = OpConstantNull %v2bool
+ %18 = OpConstantNull %v2bool
+ %19 = OpConstantNull %v2uint
%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %22 = OpTypeFunction %void %v4float
%float_1 = OpConstant %float 1
-%select_1e960b = OpFunction %void None %5
- %8 = OpLabel
- %res = OpVariable %_ptr_Function_v2uint Function %12
- %9 = OpSelect %v2uint %12 %12 %15
- OpStore %res %9
+%select_1e960b = OpFunction %void None %9
+ %12 = OpLabel
+ %res = OpVariable %_ptr_Function_v2uint Function %19
+ %13 = OpSelect %v2uint %18 %19 %19
+ OpStore %res %13
OpReturn
OpFunctionEnd
-%vertex_main = OpFunction %void None %5
- %19 = OpLabel
+%tint_symbol_2 = OpFunction %void None %22
+%tint_symbol = OpFunctionParameter %v4float
+ %25 = OpLabel
+ OpStore %tint_symbol_1 %tint_symbol
+ OpReturn
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %27 = OpLabel
OpStore %tint_pointsize %float_1
- %21 = OpFunctionCall %void %select_1e960b
+ %29 = OpFunctionCall %void %select_1e960b
+ %30 = OpFunctionCall %void %tint_symbol_2 %8
OpReturn
OpFunctionEnd
-%fragment_main = OpFunction %void None %5
- %23 = OpLabel
- %24 = OpFunctionCall %void %select_1e960b
+%fragment_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %select_1e960b
OpReturn
OpFunctionEnd
-%compute_main = OpFunction %void None %5
- %26 = OpLabel
- %27 = OpFunctionCall %void %select_1e960b
+%compute_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %select_1e960b
OpReturn
OpFunctionEnd
-
-
-Validation Failure:
-1:1: Expected bool scalar or vector type as condition: Select
- %9 = OpSelect %v2uint %12 %12 %15
-
diff --git a/test/intrinsics/gen/select/266aff.wgsl.expected.spvasm b/test/intrinsics/gen/select/266aff.wgsl.expected.spvasm
index d68b98f..699b1d6 100644
--- a/test/intrinsics/gen/select/266aff.wgsl.expected.spvasm
+++ b/test/intrinsics/gen/select/266aff.wgsl.expected.spvasm
@@ -1,63 +1,71 @@
-SKIP: FAILED
-
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 27
+; Bound: 36
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize
+ OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize %tint_symbol_1
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "compute_main"
OpExecutionMode %fragment_main OriginUpperLeft
OpExecutionMode %compute_main LocalSize 1 1 1
OpName %tint_pointsize "tint_pointsize"
+ OpName %tint_symbol_1 "tint_symbol_1"
OpName %select_266aff "select_266aff"
OpName %res "res"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol "tint_symbol"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol_1 BuiltIn Position
%float = OpTypeFloat 32
%_ptr_Output_float = OpTypePointer Output %float
%4 = OpConstantNull %float
%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %8 = OpConstantNull %v4float
+%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8
%void = OpTypeVoid
- %5 = OpTypeFunction %void
+ %9 = OpTypeFunction %void
%v2float = OpTypeVector %float 2
- %11 = OpConstantNull %v2float
%bool = OpTypeBool
%v2bool = OpTypeVector %bool 2
- %14 = OpConstantNull %v2bool
+ %17 = OpConstantNull %v2bool
+ %18 = OpConstantNull %v2float
%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %21 = OpTypeFunction %void %v4float
%float_1 = OpConstant %float 1
-%select_266aff = OpFunction %void None %5
- %8 = OpLabel
- %res = OpVariable %_ptr_Function_v2float Function %11
- %9 = OpSelect %v2float %11 %11 %14
- OpStore %res %9
+%select_266aff = OpFunction %void None %9
+ %12 = OpLabel
+ %res = OpVariable %_ptr_Function_v2float Function %18
+ %13 = OpSelect %v2float %17 %18 %18
+ OpStore %res %13
OpReturn
OpFunctionEnd
-%vertex_main = OpFunction %void None %5
- %18 = OpLabel
+%tint_symbol_2 = OpFunction %void None %21
+%tint_symbol = OpFunctionParameter %v4float
+ %24 = OpLabel
+ OpStore %tint_symbol_1 %tint_symbol
+ OpReturn
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
OpStore %tint_pointsize %float_1
- %20 = OpFunctionCall %void %select_266aff
+ %28 = OpFunctionCall %void %select_266aff
+ %29 = OpFunctionCall %void %tint_symbol_2 %8
OpReturn
OpFunctionEnd
-%fragment_main = OpFunction %void None %5
- %22 = OpLabel
- %23 = OpFunctionCall %void %select_266aff
+%fragment_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %select_266aff
OpReturn
OpFunctionEnd
-%compute_main = OpFunction %void None %5
- %25 = OpLabel
- %26 = OpFunctionCall %void %select_266aff
+%compute_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %select_266aff
OpReturn
OpFunctionEnd
-
-
-Validation Failure:
-1:1: Expected bool scalar or vector type as condition: Select
- %9 = OpSelect %v2float %11 %11 %14
-
diff --git a/test/intrinsics/gen/select/28a27e.wgsl.expected.spvasm b/test/intrinsics/gen/select/28a27e.wgsl.expected.spvasm
index ccbff5a..5201a47 100644
--- a/test/intrinsics/gen/select/28a27e.wgsl.expected.spvasm
+++ b/test/intrinsics/gen/select/28a27e.wgsl.expected.spvasm
@@ -1,64 +1,72 @@
-SKIP: FAILED
-
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 28
+; Bound: 37
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize
+ OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize %tint_symbol_1
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "compute_main"
OpExecutionMode %fragment_main OriginUpperLeft
OpExecutionMode %compute_main LocalSize 1 1 1
OpName %tint_pointsize "tint_pointsize"
+ OpName %tint_symbol_1 "tint_symbol_1"
OpName %select_28a27e "select_28a27e"
OpName %res "res"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol "tint_symbol"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol_1 BuiltIn Position
%float = OpTypeFloat 32
%_ptr_Output_float = OpTypePointer Output %float
%4 = OpConstantNull %float
%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %8 = OpConstantNull %v4float
+%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8
%void = OpTypeVoid
- %5 = OpTypeFunction %void
+ %9 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3
- %12 = OpConstantNull %v3uint
%bool = OpTypeBool
%v3bool = OpTypeVector %bool 3
- %15 = OpConstantNull %v3bool
+ %18 = OpConstantNull %v3bool
+ %19 = OpConstantNull %v3uint
%_ptr_Function_v3uint = OpTypePointer Function %v3uint
+ %22 = OpTypeFunction %void %v4float
%float_1 = OpConstant %float 1
-%select_28a27e = OpFunction %void None %5
- %8 = OpLabel
- %res = OpVariable %_ptr_Function_v3uint Function %12
- %9 = OpSelect %v3uint %12 %12 %15
- OpStore %res %9
+%select_28a27e = OpFunction %void None %9
+ %12 = OpLabel
+ %res = OpVariable %_ptr_Function_v3uint Function %19
+ %13 = OpSelect %v3uint %18 %19 %19
+ OpStore %res %13
OpReturn
OpFunctionEnd
-%vertex_main = OpFunction %void None %5
- %19 = OpLabel
+%tint_symbol_2 = OpFunction %void None %22
+%tint_symbol = OpFunctionParameter %v4float
+ %25 = OpLabel
+ OpStore %tint_symbol_1 %tint_symbol
+ OpReturn
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %27 = OpLabel
OpStore %tint_pointsize %float_1
- %21 = OpFunctionCall %void %select_28a27e
+ %29 = OpFunctionCall %void %select_28a27e
+ %30 = OpFunctionCall %void %tint_symbol_2 %8
OpReturn
OpFunctionEnd
-%fragment_main = OpFunction %void None %5
- %23 = OpLabel
- %24 = OpFunctionCall %void %select_28a27e
+%fragment_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %select_28a27e
OpReturn
OpFunctionEnd
-%compute_main = OpFunction %void None %5
- %26 = OpLabel
- %27 = OpFunctionCall %void %select_28a27e
+%compute_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %select_28a27e
OpReturn
OpFunctionEnd
-
-
-Validation Failure:
-1:1: Expected bool scalar or vector type as condition: Select
- %9 = OpSelect %v3uint %12 %12 %15
-
diff --git a/test/intrinsics/gen/select/416e14.wgsl.expected.spvasm b/test/intrinsics/gen/select/416e14.wgsl.expected.spvasm
index 44079c1..e4ca7f8 100644
--- a/test/intrinsics/gen/select/416e14.wgsl.expected.spvasm
+++ b/test/intrinsics/gen/select/416e14.wgsl.expected.spvasm
@@ -1,60 +1,68 @@
-SKIP: FAILED
-
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 24
+; Bound: 33
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize
+ OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize %tint_symbol_1
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "compute_main"
OpExecutionMode %fragment_main OriginUpperLeft
OpExecutionMode %compute_main LocalSize 1 1 1
OpName %tint_pointsize "tint_pointsize"
+ OpName %tint_symbol_1 "tint_symbol_1"
OpName %select_416e14 "select_416e14"
OpName %res "res"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol "tint_symbol"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol_1 BuiltIn Position
%float = OpTypeFloat 32
%_ptr_Output_float = OpTypePointer Output %float
%4 = OpConstantNull %float
%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %8 = OpConstantNull %v4float
+%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8
%void = OpTypeVoid
- %5 = OpTypeFunction %void
- %float_1 = OpConstant %float 1
+ %9 = OpTypeFunction %void
%bool = OpTypeBool
- %12 = OpConstantNull %bool
+ %15 = OpConstantNull %bool
+ %float_1 = OpConstant %float 1
%_ptr_Function_float = OpTypePointer Function %float
-%select_416e14 = OpFunction %void None %5
- %8 = OpLabel
+ %19 = OpTypeFunction %void %v4float
+%select_416e14 = OpFunction %void None %9
+ %12 = OpLabel
%res = OpVariable %_ptr_Function_float Function %4
- %9 = OpSelect %float %float_1 %float_1 %12
- OpStore %res %9
+ %13 = OpSelect %float %15 %float_1 %float_1
+ OpStore %res %13
OpReturn
OpFunctionEnd
-%vertex_main = OpFunction %void None %5
- %16 = OpLabel
- OpStore %tint_pointsize %float_1
- %17 = OpFunctionCall %void %select_416e14
- OpReturn
- OpFunctionEnd
-%fragment_main = OpFunction %void None %5
- %19 = OpLabel
- %20 = OpFunctionCall %void %select_416e14
- OpReturn
- OpFunctionEnd
-%compute_main = OpFunction %void None %5
+%tint_symbol_2 = OpFunction %void None %19
+%tint_symbol = OpFunctionParameter %v4float
%22 = OpLabel
- %23 = OpFunctionCall %void %select_416e14
+ OpStore %tint_symbol_1 %tint_symbol
OpReturn
OpFunctionEnd
-
-
-Validation Failure:
-1:1: Expected bool scalar or vector type as condition: Select
- %9 = OpSelect %float %float_1 %float_1 %12
-
+%vertex_main = OpFunction %void None %9
+ %24 = OpLabel
+ OpStore %tint_pointsize %float_1
+ %25 = OpFunctionCall %void %select_416e14
+ %26 = OpFunctionCall %void %tint_symbol_2 %8
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %select_416e14
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %select_416e14
+ OpReturn
+ OpFunctionEnd
diff --git a/test/intrinsics/gen/select/99f883.wgsl.expected.spvasm b/test/intrinsics/gen/select/99f883.wgsl.expected.spvasm
index 9452dff..489f6dd 100644
--- a/test/intrinsics/gen/select/99f883.wgsl.expected.spvasm
+++ b/test/intrinsics/gen/select/99f883.wgsl.expected.spvasm
@@ -1,63 +1,71 @@
-SKIP: FAILED
-
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 27
+; Bound: 36
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize
+ OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize %tint_symbol_1
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "compute_main"
OpExecutionMode %fragment_main OriginUpperLeft
OpExecutionMode %compute_main LocalSize 1 1 1
OpName %tint_pointsize "tint_pointsize"
+ OpName %tint_symbol_1 "tint_symbol_1"
OpName %select_99f883 "select_99f883"
OpName %res "res"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol "tint_symbol"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol_1 BuiltIn Position
%float = OpTypeFloat 32
%_ptr_Output_float = OpTypePointer Output %float
%4 = OpConstantNull %float
%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %8 = OpConstantNull %v4float
+%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8
%void = OpTypeVoid
- %5 = OpTypeFunction %void
+ %9 = OpTypeFunction %void
%uint = OpTypeInt 32 0
- %uint_1 = OpConstant %uint 1
%bool = OpTypeBool
- %13 = OpConstantNull %bool
+ %16 = OpConstantNull %bool
+ %uint_1 = OpConstant %uint 1
%_ptr_Function_uint = OpTypePointer Function %uint
- %16 = OpConstantNull %uint
+ %20 = OpConstantNull %uint
+ %21 = OpTypeFunction %void %v4float
%float_1 = OpConstant %float 1
-%select_99f883 = OpFunction %void None %5
- %8 = OpLabel
- %res = OpVariable %_ptr_Function_uint Function %16
- %9 = OpSelect %uint %uint_1 %uint_1 %13
- OpStore %res %9
+%select_99f883 = OpFunction %void None %9
+ %12 = OpLabel
+ %res = OpVariable %_ptr_Function_uint Function %20
+ %13 = OpSelect %uint %16 %uint_1 %uint_1
+ OpStore %res %13
OpReturn
OpFunctionEnd
-%vertex_main = OpFunction %void None %5
- %18 = OpLabel
+%tint_symbol_2 = OpFunction %void None %21
+%tint_symbol = OpFunctionParameter %v4float
+ %24 = OpLabel
+ OpStore %tint_symbol_1 %tint_symbol
+ OpReturn
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
OpStore %tint_pointsize %float_1
- %20 = OpFunctionCall %void %select_99f883
+ %28 = OpFunctionCall %void %select_99f883
+ %29 = OpFunctionCall %void %tint_symbol_2 %8
OpReturn
OpFunctionEnd
-%fragment_main = OpFunction %void None %5
- %22 = OpLabel
- %23 = OpFunctionCall %void %select_99f883
+%fragment_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %select_99f883
OpReturn
OpFunctionEnd
-%compute_main = OpFunction %void None %5
- %25 = OpLabel
- %26 = OpFunctionCall %void %select_99f883
+%compute_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %select_99f883
OpReturn
OpFunctionEnd
-
-
-Validation Failure:
-1:1: Expected bool scalar or vector type as condition: Select
- %9 = OpSelect %uint %uint_1 %uint_1 %13
-
diff --git a/test/intrinsics/gen/select/a2860e.wgsl.expected.spvasm b/test/intrinsics/gen/select/a2860e.wgsl.expected.spvasm
index cdc8be8..2d5f710 100644
--- a/test/intrinsics/gen/select/a2860e.wgsl.expected.spvasm
+++ b/test/intrinsics/gen/select/a2860e.wgsl.expected.spvasm
@@ -1,64 +1,72 @@
-SKIP: FAILED
-
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 28
+; Bound: 37
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize
+ OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize %tint_symbol_1
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "compute_main"
OpExecutionMode %fragment_main OriginUpperLeft
OpExecutionMode %compute_main LocalSize 1 1 1
OpName %tint_pointsize "tint_pointsize"
+ OpName %tint_symbol_1 "tint_symbol_1"
OpName %select_a2860e "select_a2860e"
OpName %res "res"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol "tint_symbol"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol_1 BuiltIn Position
%float = OpTypeFloat 32
%_ptr_Output_float = OpTypePointer Output %float
%4 = OpConstantNull %float
%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %8 = OpConstantNull %v4float
+%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8
%void = OpTypeVoid
- %5 = OpTypeFunction %void
+ %9 = OpTypeFunction %void
%int = OpTypeInt 32 1
%v4int = OpTypeVector %int 4
- %12 = OpConstantNull %v4int
%bool = OpTypeBool
%v4bool = OpTypeVector %bool 4
- %15 = OpConstantNull %v4bool
+ %18 = OpConstantNull %v4bool
+ %19 = OpConstantNull %v4int
%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %22 = OpTypeFunction %void %v4float
%float_1 = OpConstant %float 1
-%select_a2860e = OpFunction %void None %5
- %8 = OpLabel
- %res = OpVariable %_ptr_Function_v4int Function %12
- %9 = OpSelect %v4int %12 %12 %15
- OpStore %res %9
+%select_a2860e = OpFunction %void None %9
+ %12 = OpLabel
+ %res = OpVariable %_ptr_Function_v4int Function %19
+ %13 = OpSelect %v4int %18 %19 %19
+ OpStore %res %13
OpReturn
OpFunctionEnd
-%vertex_main = OpFunction %void None %5
- %19 = OpLabel
+%tint_symbol_2 = OpFunction %void None %22
+%tint_symbol = OpFunctionParameter %v4float
+ %25 = OpLabel
+ OpStore %tint_symbol_1 %tint_symbol
+ OpReturn
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %27 = OpLabel
OpStore %tint_pointsize %float_1
- %21 = OpFunctionCall %void %select_a2860e
+ %29 = OpFunctionCall %void %select_a2860e
+ %30 = OpFunctionCall %void %tint_symbol_2 %8
OpReturn
OpFunctionEnd
-%fragment_main = OpFunction %void None %5
- %23 = OpLabel
- %24 = OpFunctionCall %void %select_a2860e
+%fragment_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %select_a2860e
OpReturn
OpFunctionEnd
-%compute_main = OpFunction %void None %5
- %26 = OpLabel
- %27 = OpFunctionCall %void %select_a2860e
+%compute_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %select_a2860e
OpReturn
OpFunctionEnd
-
-
-Validation Failure:
-1:1: Expected bool scalar or vector type as condition: Select
- %9 = OpSelect %v4int %12 %12 %15
-
diff --git a/test/intrinsics/gen/select/bb8aae.wgsl.expected.spvasm b/test/intrinsics/gen/select/bb8aae.wgsl.expected.spvasm
index 6e2774d..8f9687d 100644
--- a/test/intrinsics/gen/select/bb8aae.wgsl.expected.spvasm
+++ b/test/intrinsics/gen/select/bb8aae.wgsl.expected.spvasm
@@ -1,63 +1,69 @@
-SKIP: FAILED
-
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 27
+; Bound: 34
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize
+ OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize %tint_symbol_1
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "compute_main"
OpExecutionMode %fragment_main OriginUpperLeft
OpExecutionMode %compute_main LocalSize 1 1 1
OpName %tint_pointsize "tint_pointsize"
+ OpName %tint_symbol_1 "tint_symbol_1"
OpName %select_bb8aae "select_bb8aae"
OpName %res "res"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol "tint_symbol"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol_1 BuiltIn Position
%float = OpTypeFloat 32
%_ptr_Output_float = OpTypePointer Output %float
%4 = OpConstantNull %float
%tint_pointsize = OpVariable %_ptr_Output_float Output %4
- %void = OpTypeVoid
- %5 = OpTypeFunction %void
%v4float = OpTypeVector %float 4
- %11 = OpConstantNull %v4float
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %8 = OpConstantNull %v4float
+%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
%bool = OpTypeBool
%v4bool = OpTypeVector %bool 4
- %14 = OpConstantNull %v4bool
+ %16 = OpConstantNull %v4bool
%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %19 = OpTypeFunction %void %v4float
%float_1 = OpConstant %float 1
-%select_bb8aae = OpFunction %void None %5
- %8 = OpLabel
- %res = OpVariable %_ptr_Function_v4float Function %11
- %9 = OpSelect %v4float %11 %11 %14
- OpStore %res %9
+%select_bb8aae = OpFunction %void None %9
+ %12 = OpLabel
+ %res = OpVariable %_ptr_Function_v4float Function %8
+ %13 = OpSelect %v4float %16 %8 %8
+ OpStore %res %13
OpReturn
OpFunctionEnd
-%vertex_main = OpFunction %void None %5
- %18 = OpLabel
- OpStore %tint_pointsize %float_1
- %20 = OpFunctionCall %void %select_bb8aae
- OpReturn
- OpFunctionEnd
-%fragment_main = OpFunction %void None %5
+%tint_symbol_2 = OpFunction %void None %19
+%tint_symbol = OpFunctionParameter %v4float
%22 = OpLabel
- %23 = OpFunctionCall %void %select_bb8aae
+ OpStore %tint_symbol_1 %tint_symbol
OpReturn
OpFunctionEnd
-%compute_main = OpFunction %void None %5
- %25 = OpLabel
+%vertex_main = OpFunction %void None %9
+ %24 = OpLabel
+ OpStore %tint_pointsize %float_1
%26 = OpFunctionCall %void %select_bb8aae
+ %27 = OpFunctionCall %void %tint_symbol_2 %8
OpReturn
OpFunctionEnd
-
-
-Validation Failure:
-1:1: Expected bool scalar or vector type as condition: Select
- %9 = OpSelect %v4float %11 %11 %14
-
+%fragment_main = OpFunction %void None %9
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %select_bb8aae
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %select_bb8aae
+ OpReturn
+ OpFunctionEnd
diff --git a/test/intrinsics/gen/select/c4a4ef.wgsl.expected.spvasm b/test/intrinsics/gen/select/c4a4ef.wgsl.expected.spvasm
index 6c83621..34a5345 100644
--- a/test/intrinsics/gen/select/c4a4ef.wgsl.expected.spvasm
+++ b/test/intrinsics/gen/select/c4a4ef.wgsl.expected.spvasm
@@ -1,64 +1,72 @@
-SKIP: FAILED
-
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 28
+; Bound: 37
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize
+ OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize %tint_symbol_1
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "compute_main"
OpExecutionMode %fragment_main OriginUpperLeft
OpExecutionMode %compute_main LocalSize 1 1 1
OpName %tint_pointsize "tint_pointsize"
+ OpName %tint_symbol_1 "tint_symbol_1"
OpName %select_c4a4ef "select_c4a4ef"
OpName %res "res"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol "tint_symbol"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol_1 BuiltIn Position
%float = OpTypeFloat 32
%_ptr_Output_float = OpTypePointer Output %float
%4 = OpConstantNull %float
%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %8 = OpConstantNull %v4float
+%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8
%void = OpTypeVoid
- %5 = OpTypeFunction %void
+ %9 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%v4uint = OpTypeVector %uint 4
- %12 = OpConstantNull %v4uint
%bool = OpTypeBool
%v4bool = OpTypeVector %bool 4
- %15 = OpConstantNull %v4bool
+ %18 = OpConstantNull %v4bool
+ %19 = OpConstantNull %v4uint
%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %22 = OpTypeFunction %void %v4float
%float_1 = OpConstant %float 1
-%select_c4a4ef = OpFunction %void None %5
- %8 = OpLabel
- %res = OpVariable %_ptr_Function_v4uint Function %12
- %9 = OpSelect %v4uint %12 %12 %15
- OpStore %res %9
+%select_c4a4ef = OpFunction %void None %9
+ %12 = OpLabel
+ %res = OpVariable %_ptr_Function_v4uint Function %19
+ %13 = OpSelect %v4uint %18 %19 %19
+ OpStore %res %13
OpReturn
OpFunctionEnd
-%vertex_main = OpFunction %void None %5
- %19 = OpLabel
+%tint_symbol_2 = OpFunction %void None %22
+%tint_symbol = OpFunctionParameter %v4float
+ %25 = OpLabel
+ OpStore %tint_symbol_1 %tint_symbol
+ OpReturn
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %27 = OpLabel
OpStore %tint_pointsize %float_1
- %21 = OpFunctionCall %void %select_c4a4ef
+ %29 = OpFunctionCall %void %select_c4a4ef
+ %30 = OpFunctionCall %void %tint_symbol_2 %8
OpReturn
OpFunctionEnd
-%fragment_main = OpFunction %void None %5
- %23 = OpLabel
- %24 = OpFunctionCall %void %select_c4a4ef
+%fragment_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %select_c4a4ef
OpReturn
OpFunctionEnd
-%compute_main = OpFunction %void None %5
- %26 = OpLabel
- %27 = OpFunctionCall %void %select_c4a4ef
+%compute_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %select_c4a4ef
OpReturn
OpFunctionEnd
-
-
-Validation Failure:
-1:1: Expected bool scalar or vector type as condition: Select
- %9 = OpSelect %v4uint %12 %12 %15
-
diff --git a/test/intrinsics/gen/select/ebfea2.wgsl.expected.spvasm b/test/intrinsics/gen/select/ebfea2.wgsl.expected.spvasm
index 2f1df03..d531e0f 100644
--- a/test/intrinsics/gen/select/ebfea2.wgsl.expected.spvasm
+++ b/test/intrinsics/gen/select/ebfea2.wgsl.expected.spvasm
@@ -1,63 +1,71 @@
-SKIP: FAILED
-
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 27
+; Bound: 36
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize
+ OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize %tint_symbol_1
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "compute_main"
OpExecutionMode %fragment_main OriginUpperLeft
OpExecutionMode %compute_main LocalSize 1 1 1
OpName %tint_pointsize "tint_pointsize"
+ OpName %tint_symbol_1 "tint_symbol_1"
OpName %select_ebfea2 "select_ebfea2"
OpName %res "res"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol "tint_symbol"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol_1 BuiltIn Position
%float = OpTypeFloat 32
%_ptr_Output_float = OpTypePointer Output %float
%4 = OpConstantNull %float
%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %8 = OpConstantNull %v4float
+%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8
%void = OpTypeVoid
- %5 = OpTypeFunction %void
+ %9 = OpTypeFunction %void
%v3float = OpTypeVector %float 3
- %11 = OpConstantNull %v3float
%bool = OpTypeBool
%v3bool = OpTypeVector %bool 3
- %14 = OpConstantNull %v3bool
+ %17 = OpConstantNull %v3bool
+ %18 = OpConstantNull %v3float
%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %21 = OpTypeFunction %void %v4float
%float_1 = OpConstant %float 1
-%select_ebfea2 = OpFunction %void None %5
- %8 = OpLabel
- %res = OpVariable %_ptr_Function_v3float Function %11
- %9 = OpSelect %v3float %11 %11 %14
- OpStore %res %9
+%select_ebfea2 = OpFunction %void None %9
+ %12 = OpLabel
+ %res = OpVariable %_ptr_Function_v3float Function %18
+ %13 = OpSelect %v3float %17 %18 %18
+ OpStore %res %13
OpReturn
OpFunctionEnd
-%vertex_main = OpFunction %void None %5
- %18 = OpLabel
+%tint_symbol_2 = OpFunction %void None %21
+%tint_symbol = OpFunctionParameter %v4float
+ %24 = OpLabel
+ OpStore %tint_symbol_1 %tint_symbol
+ OpReturn
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
OpStore %tint_pointsize %float_1
- %20 = OpFunctionCall %void %select_ebfea2
+ %28 = OpFunctionCall %void %select_ebfea2
+ %29 = OpFunctionCall %void %tint_symbol_2 %8
OpReturn
OpFunctionEnd
-%fragment_main = OpFunction %void None %5
- %22 = OpLabel
- %23 = OpFunctionCall %void %select_ebfea2
+%fragment_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %select_ebfea2
OpReturn
OpFunctionEnd
-%compute_main = OpFunction %void None %5
- %25 = OpLabel
- %26 = OpFunctionCall %void %select_ebfea2
+%compute_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %select_ebfea2
OpReturn
OpFunctionEnd
-
-
-Validation Failure:
-1:1: Expected bool scalar or vector type as condition: Select
- %9 = OpSelect %v3float %11 %11 %14
-
diff --git a/test/intrinsics/gen/select/ed8a15.wgsl.expected.spvasm b/test/intrinsics/gen/select/ed8a15.wgsl.expected.spvasm
index 23dfca3..5d27fc3 100644
--- a/test/intrinsics/gen/select/ed8a15.wgsl.expected.spvasm
+++ b/test/intrinsics/gen/select/ed8a15.wgsl.expected.spvasm
@@ -1,63 +1,71 @@
-SKIP: FAILED
-
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 27
+; Bound: 36
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize
+ OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize %tint_symbol_1
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "compute_main"
OpExecutionMode %fragment_main OriginUpperLeft
OpExecutionMode %compute_main LocalSize 1 1 1
OpName %tint_pointsize "tint_pointsize"
+ OpName %tint_symbol_1 "tint_symbol_1"
OpName %select_ed8a15 "select_ed8a15"
OpName %res "res"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol "tint_symbol"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol_1 BuiltIn Position
%float = OpTypeFloat 32
%_ptr_Output_float = OpTypePointer Output %float
%4 = OpConstantNull %float
%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %8 = OpConstantNull %v4float
+%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8
%void = OpTypeVoid
- %5 = OpTypeFunction %void
+ %9 = OpTypeFunction %void
%int = OpTypeInt 32 1
- %int_1 = OpConstant %int 1
%bool = OpTypeBool
- %13 = OpConstantNull %bool
+ %16 = OpConstantNull %bool
+ %int_1 = OpConstant %int 1
%_ptr_Function_int = OpTypePointer Function %int
- %16 = OpConstantNull %int
+ %20 = OpConstantNull %int
+ %21 = OpTypeFunction %void %v4float
%float_1 = OpConstant %float 1
-%select_ed8a15 = OpFunction %void None %5
- %8 = OpLabel
- %res = OpVariable %_ptr_Function_int Function %16
- %9 = OpSelect %int %int_1 %int_1 %13
- OpStore %res %9
+%select_ed8a15 = OpFunction %void None %9
+ %12 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %20
+ %13 = OpSelect %int %16 %int_1 %int_1
+ OpStore %res %13
OpReturn
OpFunctionEnd
-%vertex_main = OpFunction %void None %5
- %18 = OpLabel
+%tint_symbol_2 = OpFunction %void None %21
+%tint_symbol = OpFunctionParameter %v4float
+ %24 = OpLabel
+ OpStore %tint_symbol_1 %tint_symbol
+ OpReturn
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
OpStore %tint_pointsize %float_1
- %20 = OpFunctionCall %void %select_ed8a15
+ %28 = OpFunctionCall %void %select_ed8a15
+ %29 = OpFunctionCall %void %tint_symbol_2 %8
OpReturn
OpFunctionEnd
-%fragment_main = OpFunction %void None %5
- %22 = OpLabel
- %23 = OpFunctionCall %void %select_ed8a15
+%fragment_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %select_ed8a15
OpReturn
OpFunctionEnd
-%compute_main = OpFunction %void None %5
- %25 = OpLabel
- %26 = OpFunctionCall %void %select_ed8a15
+%compute_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %select_ed8a15
OpReturn
OpFunctionEnd
-
-
-Validation Failure:
-1:1: Expected bool scalar or vector type as condition: Select
- %9 = OpSelect %int %int_1 %int_1 %13
-