[tools]: Generate intrinisic test cases
Add test/intrinsics/intrinsics.wgsl.tmpl that generates a vast set of intrinsic overload permutations into test/intrinsics/gen/...
Add expected output for all of these, including 'SKIP' headers for those that currently fail.
Fixed: tint:832
Change-Id: Id6888df52c07f35e7a55199f2ad4d842c6e2595c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53051
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
diff --git a/test/intrinsics/gen/dpdxFine/8c5069.wgsl b/test/intrinsics/gen/dpdxFine/8c5069.wgsl
new file mode 100644
index 0000000..3230463
--- /dev/null
+++ b/test/intrinsics/gen/dpdxFine/8c5069.wgsl
@@ -0,0 +1,32 @@
+// Copyright 2021 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/intrinsic-gen
+// using the template:
+// test/intrinsics/intrinsics.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+fn dpdxFine_8c5069() {
+ var res: vec4<f32> = dpdxFine(vec4<f32>());
+}
+
+[[stage(fragment)]]
+fn fragment_main() {
+ dpdxFine_8c5069();
+}
diff --git a/test/intrinsics/gen/dpdxFine/8c5069.wgsl.expected.hlsl b/test/intrinsics/gen/dpdxFine/8c5069.wgsl.expected.hlsl
new file mode 100644
index 0000000..28414bb
--- /dev/null
+++ b/test/intrinsics/gen/dpdxFine/8c5069.wgsl.expected.hlsl
@@ -0,0 +1,9 @@
+void dpdxFine_8c5069() {
+ float4 res = ddx_fine(float4(0.0f, 0.0f, 0.0f, 0.0f));
+}
+
+void fragment_main() {
+ dpdxFine_8c5069();
+ return;
+}
+
diff --git a/test/intrinsics/gen/dpdxFine/8c5069.wgsl.expected.msl b/test/intrinsics/gen/dpdxFine/8c5069.wgsl.expected.msl
new file mode 100644
index 0000000..c4a18ed
--- /dev/null
+++ b/test/intrinsics/gen/dpdxFine/8c5069.wgsl.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void dpdxFine_8c5069() {
+ float4 res = dfdx(float4());
+}
+
+fragment void fragment_main() {
+ dpdxFine_8c5069();
+ return;
+}
+
diff --git a/test/intrinsics/gen/dpdxFine/8c5069.wgsl.expected.spvasm b/test/intrinsics/gen/dpdxFine/8c5069.wgsl.expected.spvasm
new file mode 100644
index 0000000..318a5ce
--- /dev/null
+++ b/test/intrinsics/gen/dpdxFine/8c5069.wgsl.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %dpdxFine_8c5069 "dpdxFine_8c5069"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+ %8 = OpConstantNull %v4float
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+%dpdxFine_8c5069 = OpFunction %void None %1
+ %4 = OpLabel
+ %res = OpVariable %_ptr_Function_v4float Function %8
+ %5 = OpDPdxFine %v4float %8
+ OpStore %res %5
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %dpdxFine_8c5069
+ OpReturn
+ OpFunctionEnd
diff --git a/test/intrinsics/gen/dpdxFine/8c5069.wgsl.expected.wgsl b/test/intrinsics/gen/dpdxFine/8c5069.wgsl.expected.wgsl
new file mode 100644
index 0000000..a83e763
--- /dev/null
+++ b/test/intrinsics/gen/dpdxFine/8c5069.wgsl.expected.wgsl
@@ -0,0 +1,8 @@
+fn dpdxFine_8c5069() {
+ var res : vec4<f32> = dpdxFine(vec4<f32>());
+}
+
+[[stage(fragment)]]
+fn fragment_main() {
+ dpdxFine_8c5069();
+}
diff --git a/test/intrinsics/gen/dpdxFine/9631de.wgsl b/test/intrinsics/gen/dpdxFine/9631de.wgsl
new file mode 100644
index 0000000..3173662
--- /dev/null
+++ b/test/intrinsics/gen/dpdxFine/9631de.wgsl
@@ -0,0 +1,32 @@
+// Copyright 2021 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/intrinsic-gen
+// using the template:
+// test/intrinsics/intrinsics.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+fn dpdxFine_9631de() {
+ var res: vec2<f32> = dpdxFine(vec2<f32>());
+}
+
+[[stage(fragment)]]
+fn fragment_main() {
+ dpdxFine_9631de();
+}
diff --git a/test/intrinsics/gen/dpdxFine/9631de.wgsl.expected.hlsl b/test/intrinsics/gen/dpdxFine/9631de.wgsl.expected.hlsl
new file mode 100644
index 0000000..2aee38d
--- /dev/null
+++ b/test/intrinsics/gen/dpdxFine/9631de.wgsl.expected.hlsl
@@ -0,0 +1,9 @@
+void dpdxFine_9631de() {
+ float2 res = ddx_fine(float2(0.0f, 0.0f));
+}
+
+void fragment_main() {
+ dpdxFine_9631de();
+ return;
+}
+
diff --git a/test/intrinsics/gen/dpdxFine/9631de.wgsl.expected.msl b/test/intrinsics/gen/dpdxFine/9631de.wgsl.expected.msl
new file mode 100644
index 0000000..be6ed51
--- /dev/null
+++ b/test/intrinsics/gen/dpdxFine/9631de.wgsl.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void dpdxFine_9631de() {
+ float2 res = dfdx(float2());
+}
+
+fragment void fragment_main() {
+ dpdxFine_9631de();
+ return;
+}
+
diff --git a/test/intrinsics/gen/dpdxFine/9631de.wgsl.expected.spvasm b/test/intrinsics/gen/dpdxFine/9631de.wgsl.expected.spvasm
new file mode 100644
index 0000000..f015eb4
--- /dev/null
+++ b/test/intrinsics/gen/dpdxFine/9631de.wgsl.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %dpdxFine_9631de "dpdxFine_9631de"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %8 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+%dpdxFine_9631de = OpFunction %void None %1
+ %4 = OpLabel
+ %res = OpVariable %_ptr_Function_v2float Function %8
+ %5 = OpDPdxFine %v2float %8
+ OpStore %res %5
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %dpdxFine_9631de
+ OpReturn
+ OpFunctionEnd
diff --git a/test/intrinsics/gen/dpdxFine/9631de.wgsl.expected.wgsl b/test/intrinsics/gen/dpdxFine/9631de.wgsl.expected.wgsl
new file mode 100644
index 0000000..002e44e
--- /dev/null
+++ b/test/intrinsics/gen/dpdxFine/9631de.wgsl.expected.wgsl
@@ -0,0 +1,8 @@
+fn dpdxFine_9631de() {
+ var res : vec2<f32> = dpdxFine(vec2<f32>());
+}
+
+[[stage(fragment)]]
+fn fragment_main() {
+ dpdxFine_9631de();
+}
diff --git a/test/intrinsics/gen/dpdxFine/f401a2.wgsl b/test/intrinsics/gen/dpdxFine/f401a2.wgsl
new file mode 100644
index 0000000..35481d2
--- /dev/null
+++ b/test/intrinsics/gen/dpdxFine/f401a2.wgsl
@@ -0,0 +1,32 @@
+// Copyright 2021 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/intrinsic-gen
+// using the template:
+// test/intrinsics/intrinsics.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+fn dpdxFine_f401a2() {
+ var res: f32 = dpdxFine(1.0);
+}
+
+[[stage(fragment)]]
+fn fragment_main() {
+ dpdxFine_f401a2();
+}
diff --git a/test/intrinsics/gen/dpdxFine/f401a2.wgsl.expected.hlsl b/test/intrinsics/gen/dpdxFine/f401a2.wgsl.expected.hlsl
new file mode 100644
index 0000000..badad66
--- /dev/null
+++ b/test/intrinsics/gen/dpdxFine/f401a2.wgsl.expected.hlsl
@@ -0,0 +1,9 @@
+void dpdxFine_f401a2() {
+ float res = ddx_fine(1.0f);
+}
+
+void fragment_main() {
+ dpdxFine_f401a2();
+ return;
+}
+
diff --git a/test/intrinsics/gen/dpdxFine/f401a2.wgsl.expected.msl b/test/intrinsics/gen/dpdxFine/f401a2.wgsl.expected.msl
new file mode 100644
index 0000000..b618db9
--- /dev/null
+++ b/test/intrinsics/gen/dpdxFine/f401a2.wgsl.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void dpdxFine_f401a2() {
+ float res = dfdx(1.0f);
+}
+
+fragment void fragment_main() {
+ dpdxFine_f401a2();
+ return;
+}
+
diff --git a/test/intrinsics/gen/dpdxFine/f401a2.wgsl.expected.spvasm b/test/intrinsics/gen/dpdxFine/f401a2.wgsl.expected.spvasm
new file mode 100644
index 0000000..24fd696
--- /dev/null
+++ b/test/intrinsics/gen/dpdxFine/f401a2.wgsl.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %dpdxFine_f401a2 "dpdxFine_f401a2"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %10 = OpConstantNull %float
+%dpdxFine_f401a2 = OpFunction %void None %1
+ %4 = OpLabel
+ %res = OpVariable %_ptr_Function_float Function %10
+ %5 = OpDPdxFine %float %float_1
+ OpStore %res %5
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %dpdxFine_f401a2
+ OpReturn
+ OpFunctionEnd
diff --git a/test/intrinsics/gen/dpdxFine/f401a2.wgsl.expected.wgsl b/test/intrinsics/gen/dpdxFine/f401a2.wgsl.expected.wgsl
new file mode 100644
index 0000000..2790d8d
--- /dev/null
+++ b/test/intrinsics/gen/dpdxFine/f401a2.wgsl.expected.wgsl
@@ -0,0 +1,8 @@
+fn dpdxFine_f401a2() {
+ var res : f32 = dpdxFine(1.0);
+}
+
+[[stage(fragment)]]
+fn fragment_main() {
+ dpdxFine_f401a2();
+}
diff --git a/test/intrinsics/gen/dpdxFine/f92fb6.wgsl b/test/intrinsics/gen/dpdxFine/f92fb6.wgsl
new file mode 100644
index 0000000..36663ae
--- /dev/null
+++ b/test/intrinsics/gen/dpdxFine/f92fb6.wgsl
@@ -0,0 +1,32 @@
+// Copyright 2021 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/intrinsic-gen
+// using the template:
+// test/intrinsics/intrinsics.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+fn dpdxFine_f92fb6() {
+ var res: vec3<f32> = dpdxFine(vec3<f32>());
+}
+
+[[stage(fragment)]]
+fn fragment_main() {
+ dpdxFine_f92fb6();
+}
diff --git a/test/intrinsics/gen/dpdxFine/f92fb6.wgsl.expected.hlsl b/test/intrinsics/gen/dpdxFine/f92fb6.wgsl.expected.hlsl
new file mode 100644
index 0000000..d8e8840
--- /dev/null
+++ b/test/intrinsics/gen/dpdxFine/f92fb6.wgsl.expected.hlsl
@@ -0,0 +1,9 @@
+void dpdxFine_f92fb6() {
+ float3 res = ddx_fine(float3(0.0f, 0.0f, 0.0f));
+}
+
+void fragment_main() {
+ dpdxFine_f92fb6();
+ return;
+}
+
diff --git a/test/intrinsics/gen/dpdxFine/f92fb6.wgsl.expected.msl b/test/intrinsics/gen/dpdxFine/f92fb6.wgsl.expected.msl
new file mode 100644
index 0000000..f19db09
--- /dev/null
+++ b/test/intrinsics/gen/dpdxFine/f92fb6.wgsl.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void dpdxFine_f92fb6() {
+ float3 res = dfdx(float3());
+}
+
+fragment void fragment_main() {
+ dpdxFine_f92fb6();
+ return;
+}
+
diff --git a/test/intrinsics/gen/dpdxFine/f92fb6.wgsl.expected.spvasm b/test/intrinsics/gen/dpdxFine/f92fb6.wgsl.expected.spvasm
new file mode 100644
index 0000000..cdc8be2
--- /dev/null
+++ b/test/intrinsics/gen/dpdxFine/f92fb6.wgsl.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %dpdxFine_f92fb6 "dpdxFine_f92fb6"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v3float = OpTypeVector %float 3
+ %8 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+%dpdxFine_f92fb6 = OpFunction %void None %1
+ %4 = OpLabel
+ %res = OpVariable %_ptr_Function_v3float Function %8
+ %5 = OpDPdxFine %v3float %8
+ OpStore %res %5
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %dpdxFine_f92fb6
+ OpReturn
+ OpFunctionEnd
diff --git a/test/intrinsics/gen/dpdxFine/f92fb6.wgsl.expected.wgsl b/test/intrinsics/gen/dpdxFine/f92fb6.wgsl.expected.wgsl
new file mode 100644
index 0000000..a40c3fb
--- /dev/null
+++ b/test/intrinsics/gen/dpdxFine/f92fb6.wgsl.expected.wgsl
@@ -0,0 +1,8 @@
+fn dpdxFine_f92fb6() {
+ var res : vec3<f32> = dpdxFine(vec3<f32>());
+}
+
+[[stage(fragment)]]
+fn fragment_main() {
+ dpdxFine_f92fb6();
+}