diff --git a/test/tint/builtins/gen/gen.wgsl.tmpl b/test/tint/builtins/gen/gen.wgsl.tmpl index e0e80073fd..25e174e06d 100644 --- a/test/tint/builtins/gen/gen.wgsl.tmpl +++ b/test/tint/builtins/gen/gen.wgsl.tmpl @@ -13,20 +13,16 @@ See: {{- range Sem.Builtins -}} {{- range .Overloads -}} {{- range Permute . -}} -{{- /* TODO(crbug.com/tint/1502): Remove the bodge below and emit "enable f16;" after - getting ready for F16 end-to-end tests. */ -}} -{{- if not (OverloadUsesF16 .Overload) -}} -{{- /* Generate a ./literal//.wgsl file using - the Permutation macro defined below */ -}} -{{- $file := printf "./literal/%v/%v.wgsl" .Intrinsic.Name .Hash -}} -{{- $content := Eval "Permutation" "Overload" . "Mode" "literal" -}} -{{- WriteFile $file $content -}} -{{- /* Generate a ./var//.wgsl file using - the Permutation macro defined below */ -}} -{{- $file := printf "./var/%v/%v.wgsl" .Intrinsic.Name .Hash -}} -{{- $content := Eval "Permutation" "Overload" . "Mode" "var" -}} -{{- WriteFile $file $content -}} -{{- end }} +{{- /* Generate a ./literal//.wgsl file using + the Permutation macro defined below */ -}} +{{- $file := printf "./literal/%v/%v.wgsl" .Intrinsic.Name .Hash -}} +{{- $content := Eval "Permutation" "Overload" . "Mode" "literal" -}} +{{- WriteFile $file $content -}} +{{- /* Generate a ./var//.wgsl file using + the Permutation macro defined below */ -}} +{{- $file := printf "./var/%v/%v.wgsl" .Intrinsic.Name .Hash -}} +{{- $content := Eval "Permutation" "Overload" . "Mode" "var" -}} +{{- WriteFile $file $content -}} {{- end }} {{- end }} {{- end }} @@ -178,14 +174,20 @@ fn compute_main() { {{- define "EnableDirectives" -}} {{- /* Emits the required enable directives for a given overload */ -}} {{- /* ------------------------------------------------------------------ */ -}} -{{- $overload := . -}} -{{- $builtin_name := $overload.Intrinsic.Name -}} +{{- $permutation := . -}} +{{- $overload := $permutation.Overload -}} +{{- $builtin_name := $permutation.Intrinsic.Name -}} {{- /* Check and emit chromium_experimental_dp4a */ -}} {{- if or (eq "dot4I8Packed" $builtin_name) (eq "dot4U8Packed" $builtin_name)}} enable chromium_experimental_dp4a; {{ end -}} +{{- /* Check and emit f16 */ -}} +{{- if OverloadUsesF16 $overload}} +enable f16; +{{ end -}} + {{- end -}} diff --git a/test/tint/builtins/gen/literal/abs/421ca3.wgsl b/test/tint/builtins/gen/literal/abs/421ca3.wgsl new file mode 100644 index 0000000000..9319b46317 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/421ca3.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn abs(vec<3, f16>) -> vec<3, f16> +fn abs_421ca3() { + var res: vec3 = abs(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_421ca3(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_421ca3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_421ca3(); +} diff --git a/test/tint/builtins/gen/literal/abs/421ca3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/abs/421ca3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..21a367b1b6 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/421ca3.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void abs_421ca3() { + vector res = abs((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_421ca3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_421ca3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_421ca3(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/421ca3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/abs/421ca3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6ca0d4665c --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/421ca3.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void abs_421ca3() { + vector res = abs((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_421ca3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_421ca3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_421ca3(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D461B57CF0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/abs/421ca3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/abs/421ca3.wgsl.expected.glsl new file mode 100644 index 0000000000..7a0603d8ac --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/421ca3.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void abs_421ca3() { + f16vec3 res = abs(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + abs_421ca3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void abs_421ca3() { + f16vec3 res = abs(f16vec3(0.0hf)); +} + +void fragment_main() { + abs_421ca3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void abs_421ca3() { + f16vec3 res = abs(f16vec3(0.0hf)); +} + +void compute_main() { + abs_421ca3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/421ca3.wgsl.expected.msl b/test/tint/builtins/gen/literal/abs/421ca3.wgsl.expected.msl new file mode 100644 index 0000000000..24f22ad609 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/421ca3.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void abs_421ca3() { + half3 res = fabs(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_421ca3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_421ca3(); + return; +} + +kernel void compute_main() { + abs_421ca3(); + return; +} + diff --git a/test/tint/builtins/gen/literal/abs/421ca3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/abs/421ca3.wgsl.expected.spvasm new file mode 100644 index 0000000000..4dc29a21f3 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/421ca3.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_421ca3 "abs_421ca3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %abs_421ca3 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 FAbs %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %abs_421ca3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %abs_421ca3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %abs_421ca3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/abs/421ca3.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/abs/421ca3.wgsl.expected.wgsl new file mode 100644 index 0000000000..e3f2507d78 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/421ca3.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn abs_421ca3() { + var res : vec3 = abs(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_421ca3(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_421ca3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_421ca3(); +} diff --git a/test/tint/builtins/gen/literal/abs/538d29.wgsl b/test/tint/builtins/gen/literal/abs/538d29.wgsl new file mode 100644 index 0000000000..eaefc985b6 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/538d29.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn abs(vec<4, f16>) -> vec<4, f16> +fn abs_538d29() { + var res: vec4 = abs(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_538d29(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_538d29(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_538d29(); +} diff --git a/test/tint/builtins/gen/literal/abs/538d29.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/abs/538d29.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1ce3e01196 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/538d29.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void abs_538d29() { + vector res = abs((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_538d29(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_538d29(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_538d29(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/538d29.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/abs/538d29.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4d6ca9dfd5 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/538d29.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void abs_538d29() { + vector res = abs((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_538d29(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_538d29(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_538d29(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C4B2837D80(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/abs/538d29.wgsl.expected.glsl b/test/tint/builtins/gen/literal/abs/538d29.wgsl.expected.glsl new file mode 100644 index 0000000000..64b283b930 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/538d29.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void abs_538d29() { + f16vec4 res = abs(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + abs_538d29(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void abs_538d29() { + f16vec4 res = abs(f16vec4(0.0hf)); +} + +void fragment_main() { + abs_538d29(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void abs_538d29() { + f16vec4 res = abs(f16vec4(0.0hf)); +} + +void compute_main() { + abs_538d29(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/538d29.wgsl.expected.msl b/test/tint/builtins/gen/literal/abs/538d29.wgsl.expected.msl new file mode 100644 index 0000000000..867e989f68 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/538d29.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void abs_538d29() { + half4 res = fabs(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_538d29(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_538d29(); + return; +} + +kernel void compute_main() { + abs_538d29(); + return; +} + diff --git a/test/tint/builtins/gen/literal/abs/538d29.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/abs/538d29.wgsl.expected.spvasm new file mode 100644 index 0000000000..d34467689f --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/538d29.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_538d29 "abs_538d29" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %abs_538d29 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 FAbs %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %abs_538d29 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %abs_538d29 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %abs_538d29 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/abs/538d29.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/abs/538d29.wgsl.expected.wgsl new file mode 100644 index 0000000000..5501b2326c --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/538d29.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn abs_538d29() { + var res : vec4 = abs(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_538d29(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_538d29(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_538d29(); +} diff --git a/test/tint/builtins/gen/literal/abs/5ae4fe.wgsl b/test/tint/builtins/gen/literal/abs/5ae4fe.wgsl new file mode 100644 index 0000000000..d6c5261e63 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/5ae4fe.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn abs(vec<2, f16>) -> vec<2, f16> +fn abs_5ae4fe() { + var res: vec2 = abs(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_5ae4fe(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_5ae4fe(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_5ae4fe(); +} diff --git a/test/tint/builtins/gen/literal/abs/5ae4fe.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/abs/5ae4fe.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8ecbd1dccd --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/5ae4fe.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void abs_5ae4fe() { + vector res = abs((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_5ae4fe(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_5ae4fe(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_5ae4fe(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/5ae4fe.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/abs/5ae4fe.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..427ca6c3ad --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/5ae4fe.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void abs_5ae4fe() { + vector res = abs((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_5ae4fe(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_5ae4fe(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_5ae4fe(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000026FB61B87E0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/abs/5ae4fe.wgsl.expected.glsl b/test/tint/builtins/gen/literal/abs/5ae4fe.wgsl.expected.glsl new file mode 100644 index 0000000000..e38ffb0fe9 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/5ae4fe.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void abs_5ae4fe() { + f16vec2 res = abs(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + abs_5ae4fe(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void abs_5ae4fe() { + f16vec2 res = abs(f16vec2(0.0hf)); +} + +void fragment_main() { + abs_5ae4fe(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void abs_5ae4fe() { + f16vec2 res = abs(f16vec2(0.0hf)); +} + +void compute_main() { + abs_5ae4fe(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/5ae4fe.wgsl.expected.msl b/test/tint/builtins/gen/literal/abs/5ae4fe.wgsl.expected.msl new file mode 100644 index 0000000000..3048925f87 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/5ae4fe.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void abs_5ae4fe() { + half2 res = fabs(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_5ae4fe(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_5ae4fe(); + return; +} + +kernel void compute_main() { + abs_5ae4fe(); + return; +} + diff --git a/test/tint/builtins/gen/literal/abs/5ae4fe.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/abs/5ae4fe.wgsl.expected.spvasm new file mode 100644 index 0000000000..0827248748 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/5ae4fe.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_5ae4fe "abs_5ae4fe" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %abs_5ae4fe = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 FAbs %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %abs_5ae4fe + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %abs_5ae4fe + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %abs_5ae4fe + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/abs/5ae4fe.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/abs/5ae4fe.wgsl.expected.wgsl new file mode 100644 index 0000000000..c1e8f2453f --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/5ae4fe.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn abs_5ae4fe() { + var res : vec2 = abs(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_5ae4fe(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_5ae4fe(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_5ae4fe(); +} diff --git a/test/tint/builtins/gen/literal/abs/fd247f.wgsl b/test/tint/builtins/gen/literal/abs/fd247f.wgsl new file mode 100644 index 0000000000..63cc56db81 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/fd247f.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn abs(f16) -> f16 +fn abs_fd247f() { + var res: f16 = abs(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_fd247f(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_fd247f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_fd247f(); +} diff --git a/test/tint/builtins/gen/literal/abs/fd247f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/abs/fd247f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6f68c08c4e --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/fd247f.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void abs_fd247f() { + float16_t res = abs(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_fd247f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_fd247f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_fd247f(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/fd247f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/abs/fd247f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a341373578 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/fd247f.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void abs_fd247f() { + float16_t res = abs(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_fd247f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_fd247f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_fd247f(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C7205F8830(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C7205F8830(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/abs/fd247f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/abs/fd247f.wgsl.expected.glsl new file mode 100644 index 0000000000..2c864eb25b --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/fd247f.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void abs_fd247f() { + float16_t res = abs(0.0hf); +} + +vec4 vertex_main() { + abs_fd247f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void abs_fd247f() { + float16_t res = abs(0.0hf); +} + +void fragment_main() { + abs_fd247f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void abs_fd247f() { + float16_t res = abs(0.0hf); +} + +void compute_main() { + abs_fd247f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/fd247f.wgsl.expected.msl b/test/tint/builtins/gen/literal/abs/fd247f.wgsl.expected.msl new file mode 100644 index 0000000000..6c6c738a26 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/fd247f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void abs_fd247f() { + half res = fabs(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_fd247f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_fd247f(); + return; +} + +kernel void compute_main() { + abs_fd247f(); + return; +} + diff --git a/test/tint/builtins/gen/literal/abs/fd247f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/abs/fd247f.wgsl.expected.spvasm new file mode 100644 index 0000000000..3472743c09 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/fd247f.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_fd247f "abs_fd247f" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %abs_fd247f = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 FAbs %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %abs_fd247f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %abs_fd247f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %abs_fd247f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/abs/fd247f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/abs/fd247f.wgsl.expected.wgsl new file mode 100644 index 0000000000..28cbd46ad1 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/fd247f.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn abs_fd247f() { + var res : f16 = abs(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_fd247f(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_fd247f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_fd247f(); +} diff --git a/test/tint/builtins/gen/literal/acos/004aff.wgsl b/test/tint/builtins/gen/literal/acos/004aff.wgsl new file mode 100644 index 0000000000..35e62ea158 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/004aff.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn acos(vec<2, f16>) -> vec<2, f16> +fn acos_004aff() { + var res: vec2 = acos(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_004aff(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_004aff(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_004aff(); +} diff --git a/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..92b5765986 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void acos_004aff() { + vector res = acos((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_004aff(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_004aff(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_004aff(); + return; +} diff --git a/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e66364b4cd --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void acos_004aff() { + vector res = acos((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_004aff(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_004aff(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_004aff(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001B9F5C6E5B0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.glsl b/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.glsl new file mode 100644 index 0000000000..c4dd0577a2 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void acos_004aff() { + f16vec2 res = acos(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + acos_004aff(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void acos_004aff() { + f16vec2 res = acos(f16vec2(0.0hf)); +} + +void fragment_main() { + acos_004aff(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void acos_004aff() { + f16vec2 res = acos(f16vec2(0.0hf)); +} + +void compute_main() { + acos_004aff(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.msl b/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.msl new file mode 100644 index 0000000000..4d9f5a2c58 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void acos_004aff() { + half2 res = acos(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acos_004aff(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acos_004aff(); + return; +} + +kernel void compute_main() { + acos_004aff(); + return; +} + diff --git a/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.spvasm new file mode 100644 index 0000000000..cbde032bd0 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %acos_004aff "acos_004aff" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%acos_004aff = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Acos %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %acos_004aff + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %acos_004aff + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %acos_004aff + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.wgsl new file mode 100644 index 0000000000..57a6cb012a --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn acos_004aff() { + var res : vec2 = acos(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_004aff(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_004aff(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_004aff(); +} diff --git a/test/tint/builtins/gen/literal/acos/203628.wgsl b/test/tint/builtins/gen/literal/acos/203628.wgsl new file mode 100644 index 0000000000..e5f2df8673 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/203628.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn acos(vec<4, f16>) -> vec<4, f16> +fn acos_203628() { + var res: vec4 = acos(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_203628(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_203628(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_203628(); +} diff --git a/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..886ea9556e --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void acos_203628() { + vector res = acos((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_203628(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_203628(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_203628(); + return; +} diff --git a/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3ee115e66b --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void acos_203628() { + vector res = acos((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_203628(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_203628(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_203628(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000019D14DE1160(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.glsl b/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.glsl new file mode 100644 index 0000000000..0dbc198f0f --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void acos_203628() { + f16vec4 res = acos(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + acos_203628(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void acos_203628() { + f16vec4 res = acos(f16vec4(0.0hf)); +} + +void fragment_main() { + acos_203628(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void acos_203628() { + f16vec4 res = acos(f16vec4(0.0hf)); +} + +void compute_main() { + acos_203628(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.msl b/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.msl new file mode 100644 index 0000000000..4aeebba90f --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void acos_203628() { + half4 res = acos(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acos_203628(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acos_203628(); + return; +} + +kernel void compute_main() { + acos_203628(); + return; +} + diff --git a/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.spvasm new file mode 100644 index 0000000000..7807c72d21 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %acos_203628 "acos_203628" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%acos_203628 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Acos %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %acos_203628 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %acos_203628 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %acos_203628 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.wgsl new file mode 100644 index 0000000000..ebbc42e95a --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn acos_203628() { + var res : vec4 = acos(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_203628(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_203628(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_203628(); +} diff --git a/test/tint/builtins/gen/literal/acos/303e3d.wgsl b/test/tint/builtins/gen/literal/acos/303e3d.wgsl new file mode 100644 index 0000000000..959d12936d --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/303e3d.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn acos(f16) -> f16 +fn acos_303e3d() { + var res: f16 = acos(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_303e3d(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_303e3d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_303e3d(); +} diff --git a/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..87a3b3ab7f --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void acos_303e3d() { + float16_t res = acos(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_303e3d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_303e3d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_303e3d(); + return; +} diff --git a/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fa8c37196c --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void acos_303e3d() { + float16_t res = acos(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_303e3d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_303e3d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_303e3d(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021AE9120540(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021AE9120540(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.glsl new file mode 100644 index 0000000000..757f182315 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void acos_303e3d() { + float16_t res = acos(0.0hf); +} + +vec4 vertex_main() { + acos_303e3d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void acos_303e3d() { + float16_t res = acos(0.0hf); +} + +void fragment_main() { + acos_303e3d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void acos_303e3d() { + float16_t res = acos(0.0hf); +} + +void compute_main() { + acos_303e3d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.msl b/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.msl new file mode 100644 index 0000000000..913e3fdaec --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void acos_303e3d() { + half res = acos(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acos_303e3d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acos_303e3d(); + return; +} + +kernel void compute_main() { + acos_303e3d(); + return; +} + diff --git a/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.spvasm new file mode 100644 index 0000000000..9df9a98206 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %acos_303e3d "acos_303e3d" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%acos_303e3d = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Acos %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %acos_303e3d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %acos_303e3d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %acos_303e3d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.wgsl new file mode 100644 index 0000000000..d9f5be3855 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn acos_303e3d() { + var res : f16 = acos(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_303e3d(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_303e3d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_303e3d(); +} diff --git a/test/tint/builtins/gen/literal/acos/f47057.wgsl b/test/tint/builtins/gen/literal/acos/f47057.wgsl new file mode 100644 index 0000000000..9195ffb146 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/f47057.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn acos(vec<3, f16>) -> vec<3, f16> +fn acos_f47057() { + var res: vec3 = acos(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_f47057(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_f47057(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_f47057(); +} diff --git a/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7cf8ba2158 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void acos_f47057() { + vector res = acos((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_f47057(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_f47057(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_f47057(); + return; +} diff --git a/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..38dd9cd254 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void acos_f47057() { + vector res = acos((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_f47057(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_f47057(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_f47057(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020584057560(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.glsl b/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.glsl new file mode 100644 index 0000000000..4e2cbd06e1 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void acos_f47057() { + f16vec3 res = acos(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + acos_f47057(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void acos_f47057() { + f16vec3 res = acos(f16vec3(0.0hf)); +} + +void fragment_main() { + acos_f47057(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void acos_f47057() { + f16vec3 res = acos(f16vec3(0.0hf)); +} + +void compute_main() { + acos_f47057(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.msl b/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.msl new file mode 100644 index 0000000000..e74d29b2cb --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void acos_f47057() { + half3 res = acos(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acos_f47057(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acos_f47057(); + return; +} + +kernel void compute_main() { + acos_f47057(); + return; +} + diff --git a/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.spvasm new file mode 100644 index 0000000000..00895bf2d3 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %acos_f47057 "acos_f47057" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%acos_f47057 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Acos %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %acos_f47057 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %acos_f47057 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %acos_f47057 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.wgsl new file mode 100644 index 0000000000..fe4125dcee --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn acos_f47057() { + var res : vec3 = acos(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_f47057(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_f47057(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_f47057(); +} diff --git a/test/tint/builtins/gen/literal/acosh/5f49d8.wgsl b/test/tint/builtins/gen/literal/acosh/5f49d8.wgsl new file mode 100644 index 0000000000..a4b0dab48b --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/5f49d8.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn acosh(vec<2, f16>) -> vec<2, f16> +fn acosh_5f49d8() { + var res: vec2 = acosh(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_5f49d8(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_5f49d8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_5f49d8(); +} diff --git a/test/tint/builtins/gen/literal/acosh/5f49d8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/acosh/5f49d8.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9ba3054eb2 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/5f49d8.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +vector tint_acosh(vector x) { + return log((x + sqrt(((x * x) - float16_t(1.0h))))); +} + +void acosh_5f49d8() { + vector res = tint_acosh((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_5f49d8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_5f49d8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_5f49d8(); + return; +} diff --git a/test/tint/builtins/gen/literal/acosh/5f49d8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/acosh/5f49d8.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..44e42cc89c --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/5f49d8.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +vector tint_acosh(vector x) { + return log((x + sqrt(((x * x) - float16_t(1.0h))))); +} + +void acosh_5f49d8() { + vector res = tint_acosh((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_5f49d8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_5f49d8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_5f49d8(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001641C7488B0(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/acosh/5f49d8.wgsl.expected.glsl b/test/tint/builtins/gen/literal/acosh/5f49d8.wgsl.expected.glsl new file mode 100644 index 0000000000..1297122b13 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/5f49d8.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec2 tint_acosh(f16vec2 x) { + return mix(acosh(x), f16vec2(0.0hf), lessThan(x, f16vec2(1.0hf))); +} + +void acosh_5f49d8() { + f16vec2 res = tint_acosh(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + acosh_5f49d8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec2 tint_acosh(f16vec2 x) { + return mix(acosh(x), f16vec2(0.0hf), lessThan(x, f16vec2(1.0hf))); +} + +void acosh_5f49d8() { + f16vec2 res = tint_acosh(f16vec2(0.0hf)); +} + +void fragment_main() { + acosh_5f49d8(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec2 tint_acosh(f16vec2 x) { + return mix(acosh(x), f16vec2(0.0hf), lessThan(x, f16vec2(1.0hf))); +} + +void acosh_5f49d8() { + f16vec2 res = tint_acosh(f16vec2(0.0hf)); +} + +void compute_main() { + acosh_5f49d8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/acosh/5f49d8.wgsl.expected.msl b/test/tint/builtins/gen/literal/acosh/5f49d8.wgsl.expected.msl new file mode 100644 index 0000000000..9245c572e9 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/5f49d8.wgsl.expected.msl @@ -0,0 +1,37 @@ +#include + +using namespace metal; +half2 tint_acosh(half2 x) { + return select(acosh(x), half2(0.0h), (x < half2(1.0h))); +} + +void acosh_5f49d8() { + half2 res = tint_acosh(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acosh_5f49d8(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acosh_5f49d8(); + return; +} + +kernel void compute_main() { + acosh_5f49d8(); + return; +} + diff --git a/test/tint/builtins/gen/literal/acosh/5f49d8.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/acosh/5f49d8.wgsl.expected.spvasm new file mode 100644 index 0000000000..79bf1ae20c --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/5f49d8.wgsl.expected.spvasm @@ -0,0 +1,87 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_acosh "tint_acosh" + OpName %x "x" + OpName %acosh_5f49d8 "acosh_5f49d8" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %9 = OpTypeFunction %v2half %v2half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %17 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_0 + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %21 = OpConstantNull %v2half + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_Function_v2half = OpTypePointer Function %v2half + %31 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tint_acosh = OpFunction %v2half None %9 + %x = OpFunctionParameter %v2half + %14 = OpLabel + %18 = OpFOrdLessThan %v2bool %x %17 + %22 = OpExtInst %v2half %23 Acosh %x + %15 = OpSelect %v2half %18 %21 %22 + OpReturnValue %15 + OpFunctionEnd +%acosh_5f49d8 = OpFunction %void None %24 + %27 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %21 + %28 = OpFunctionCall %v2half %tint_acosh %21 + OpStore %res %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %31 + %33 = OpLabel + %34 = OpFunctionCall %void %acosh_5f49d8 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %24 + %36 = OpLabel + %37 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %37 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %24 + %40 = OpLabel + %41 = OpFunctionCall %void %acosh_5f49d8 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %24 + %43 = OpLabel + %44 = OpFunctionCall %void %acosh_5f49d8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/acosh/5f49d8.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/acosh/5f49d8.wgsl.expected.wgsl new file mode 100644 index 0000000000..54e3b93493 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/5f49d8.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn acosh_5f49d8() { + var res : vec2 = acosh(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_5f49d8(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_5f49d8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_5f49d8(); +} diff --git a/test/tint/builtins/gen/literal/acosh/a37dfe.wgsl b/test/tint/builtins/gen/literal/acosh/a37dfe.wgsl new file mode 100644 index 0000000000..9b93d25c77 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/a37dfe.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn acosh(f16) -> f16 +fn acosh_a37dfe() { + var res: f16 = acosh(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_a37dfe(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_a37dfe(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_a37dfe(); +} diff --git a/test/tint/builtins/gen/literal/acosh/a37dfe.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/acosh/a37dfe.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0a48295874 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/a37dfe.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +float16_t tint_acosh(float16_t x) { + return log((x + sqrt(((x * x) - float16_t(1.0h))))); +} + +void acosh_a37dfe() { + float16_t res = tint_acosh(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_a37dfe(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_a37dfe(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_a37dfe(); + return; +} diff --git a/test/tint/builtins/gen/literal/acosh/a37dfe.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/acosh/a37dfe.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..89d2293e31 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/a37dfe.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +float16_t tint_acosh(float16_t x) { + return log((x + sqrt(((x * x) - float16_t(1.0h))))); +} + +void acosh_a37dfe() { + float16_t res = tint_acosh(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_a37dfe(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_a37dfe(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_a37dfe(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000285D7A33130(1,1-9): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/builtins/gen/literal/acosh/a37dfe.wgsl.expected.glsl b/test/tint/builtins/gen/literal/acosh/a37dfe.wgsl.expected.glsl new file mode 100644 index 0000000000..e7752e3799 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/a37dfe.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +float16_t tint_acosh(float16_t x) { + return ((x < 1.0hf) ? 0.0hf : acosh(x)); +} + +void acosh_a37dfe() { + float16_t res = tint_acosh(0.0hf); +} + +vec4 vertex_main() { + acosh_a37dfe(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +float16_t tint_acosh(float16_t x) { + return ((x < 1.0hf) ? 0.0hf : acosh(x)); +} + +void acosh_a37dfe() { + float16_t res = tint_acosh(0.0hf); +} + +void fragment_main() { + acosh_a37dfe(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +float16_t tint_acosh(float16_t x) { + return ((x < 1.0hf) ? 0.0hf : acosh(x)); +} + +void acosh_a37dfe() { + float16_t res = tint_acosh(0.0hf); +} + +void compute_main() { + acosh_a37dfe(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/acosh/a37dfe.wgsl.expected.msl b/test/tint/builtins/gen/literal/acosh/a37dfe.wgsl.expected.msl new file mode 100644 index 0000000000..09a8e2d967 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/a37dfe.wgsl.expected.msl @@ -0,0 +1,37 @@ +#include + +using namespace metal; +half tint_acosh(half x) { + return select(acosh(x), 0.0h, (x < 1.0h)); +} + +void acosh_a37dfe() { + half res = tint_acosh(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acosh_a37dfe(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acosh_a37dfe(); + return; +} + +kernel void compute_main() { + acosh_a37dfe(); + return; +} + diff --git a/test/tint/builtins/gen/literal/acosh/a37dfe.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/acosh/a37dfe.wgsl.expected.spvasm new file mode 100644 index 0000000000..e5071ef92a --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/a37dfe.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_acosh "tint_acosh" + OpName %x "x" + OpName %acosh_a37dfe "acosh_a37dfe" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %half = OpTypeFloat 16 + %9 = OpTypeFunction %half %half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %bool = OpTypeBool + %18 = OpConstantNull %half + %void = OpTypeVoid + %21 = OpTypeFunction %void +%_ptr_Function_half = OpTypePointer Function %half + %28 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tint_acosh = OpFunction %half None %9 + %x = OpFunctionParameter %half + %13 = OpLabel + %16 = OpFOrdLessThan %bool %x %half_0x1p_0 + %19 = OpExtInst %half %20 Acosh %x + %14 = OpSelect %half %16 %18 %19 + OpReturnValue %14 + OpFunctionEnd +%acosh_a37dfe = OpFunction %void None %21 + %24 = OpLabel + %res = OpVariable %_ptr_Function_half Function %18 + %25 = OpFunctionCall %half %tint_acosh %18 + OpStore %res %25 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %acosh_a37dfe + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %21 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %21 + %37 = OpLabel + %38 = OpFunctionCall %void %acosh_a37dfe + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %21 + %40 = OpLabel + %41 = OpFunctionCall %void %acosh_a37dfe + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/acosh/a37dfe.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/acosh/a37dfe.wgsl.expected.wgsl new file mode 100644 index 0000000000..983b91cdb3 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/a37dfe.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn acosh_a37dfe() { + var res : f16 = acosh(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_a37dfe(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_a37dfe(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_a37dfe(); +} diff --git a/test/tint/builtins/gen/literal/acosh/de60d8.wgsl b/test/tint/builtins/gen/literal/acosh/de60d8.wgsl new file mode 100644 index 0000000000..4f64c073c9 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/de60d8.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn acosh(vec<4, f16>) -> vec<4, f16> +fn acosh_de60d8() { + var res: vec4 = acosh(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_de60d8(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_de60d8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_de60d8(); +} diff --git a/test/tint/builtins/gen/literal/acosh/de60d8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/acosh/de60d8.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5de3f3b567 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/de60d8.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +vector tint_acosh(vector x) { + return log((x + sqrt(((x * x) - float16_t(1.0h))))); +} + +void acosh_de60d8() { + vector res = tint_acosh((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_de60d8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_de60d8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_de60d8(); + return; +} diff --git a/test/tint/builtins/gen/literal/acosh/de60d8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/acosh/de60d8.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3c8ea4182c --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/de60d8.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +vector tint_acosh(vector x) { + return log((x + sqrt(((x * x) - float16_t(1.0h))))); +} + +void acosh_de60d8() { + vector res = tint_acosh((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_de60d8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_de60d8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_de60d8(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000027AF4D645C0(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/acosh/de60d8.wgsl.expected.glsl b/test/tint/builtins/gen/literal/acosh/de60d8.wgsl.expected.glsl new file mode 100644 index 0000000000..439999ffd8 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/de60d8.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec4 tint_acosh(f16vec4 x) { + return mix(acosh(x), f16vec4(0.0hf), lessThan(x, f16vec4(1.0hf))); +} + +void acosh_de60d8() { + f16vec4 res = tint_acosh(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + acosh_de60d8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec4 tint_acosh(f16vec4 x) { + return mix(acosh(x), f16vec4(0.0hf), lessThan(x, f16vec4(1.0hf))); +} + +void acosh_de60d8() { + f16vec4 res = tint_acosh(f16vec4(0.0hf)); +} + +void fragment_main() { + acosh_de60d8(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec4 tint_acosh(f16vec4 x) { + return mix(acosh(x), f16vec4(0.0hf), lessThan(x, f16vec4(1.0hf))); +} + +void acosh_de60d8() { + f16vec4 res = tint_acosh(f16vec4(0.0hf)); +} + +void compute_main() { + acosh_de60d8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/acosh/de60d8.wgsl.expected.msl b/test/tint/builtins/gen/literal/acosh/de60d8.wgsl.expected.msl new file mode 100644 index 0000000000..39b26d79dc --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/de60d8.wgsl.expected.msl @@ -0,0 +1,37 @@ +#include + +using namespace metal; +half4 tint_acosh(half4 x) { + return select(acosh(x), half4(0.0h), (x < half4(1.0h))); +} + +void acosh_de60d8() { + half4 res = tint_acosh(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acosh_de60d8(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acosh_de60d8(); + return; +} + +kernel void compute_main() { + acosh_de60d8(); + return; +} + diff --git a/test/tint/builtins/gen/literal/acosh/de60d8.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/acosh/de60d8.wgsl.expected.spvasm new file mode 100644 index 0000000000..220c72ab1b --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/de60d8.wgsl.expected.spvasm @@ -0,0 +1,87 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_acosh "tint_acosh" + OpName %x "x" + OpName %acosh_de60d8 "acosh_de60d8" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %9 = OpTypeFunction %v4half %v4half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %17 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %21 = OpConstantNull %v4half + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_Function_v4half = OpTypePointer Function %v4half + %31 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tint_acosh = OpFunction %v4half None %9 + %x = OpFunctionParameter %v4half + %14 = OpLabel + %18 = OpFOrdLessThan %v4bool %x %17 + %22 = OpExtInst %v4half %23 Acosh %x + %15 = OpSelect %v4half %18 %21 %22 + OpReturnValue %15 + OpFunctionEnd +%acosh_de60d8 = OpFunction %void None %24 + %27 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %21 + %28 = OpFunctionCall %v4half %tint_acosh %21 + OpStore %res %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %31 + %33 = OpLabel + %34 = OpFunctionCall %void %acosh_de60d8 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %24 + %36 = OpLabel + %37 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %37 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %24 + %40 = OpLabel + %41 = OpFunctionCall %void %acosh_de60d8 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %24 + %43 = OpLabel + %44 = OpFunctionCall %void %acosh_de60d8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/acosh/de60d8.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/acosh/de60d8.wgsl.expected.wgsl new file mode 100644 index 0000000000..1fdbcb0902 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/de60d8.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn acosh_de60d8() { + var res : vec4 = acosh(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_de60d8(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_de60d8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_de60d8(); +} diff --git a/test/tint/builtins/gen/literal/acosh/f56574.wgsl b/test/tint/builtins/gen/literal/acosh/f56574.wgsl new file mode 100644 index 0000000000..40db5d303f --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/f56574.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn acosh(vec<3, f16>) -> vec<3, f16> +fn acosh_f56574() { + var res: vec3 = acosh(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_f56574(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_f56574(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_f56574(); +} diff --git a/test/tint/builtins/gen/literal/acosh/f56574.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/acosh/f56574.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..72b7eb7fa0 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/f56574.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +vector tint_acosh(vector x) { + return log((x + sqrt(((x * x) - float16_t(1.0h))))); +} + +void acosh_f56574() { + vector res = tint_acosh((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_f56574(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_f56574(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_f56574(); + return; +} diff --git a/test/tint/builtins/gen/literal/acosh/f56574.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/acosh/f56574.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a35e840bc9 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/f56574.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +vector tint_acosh(vector x) { + return log((x + sqrt(((x * x) - float16_t(1.0h))))); +} + +void acosh_f56574() { + vector res = tint_acosh((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_f56574(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_f56574(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_f56574(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000221246484D0(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/acosh/f56574.wgsl.expected.glsl b/test/tint/builtins/gen/literal/acosh/f56574.wgsl.expected.glsl new file mode 100644 index 0000000000..20527af655 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/f56574.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec3 tint_acosh(f16vec3 x) { + return mix(acosh(x), f16vec3(0.0hf), lessThan(x, f16vec3(1.0hf))); +} + +void acosh_f56574() { + f16vec3 res = tint_acosh(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + acosh_f56574(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec3 tint_acosh(f16vec3 x) { + return mix(acosh(x), f16vec3(0.0hf), lessThan(x, f16vec3(1.0hf))); +} + +void acosh_f56574() { + f16vec3 res = tint_acosh(f16vec3(0.0hf)); +} + +void fragment_main() { + acosh_f56574(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec3 tint_acosh(f16vec3 x) { + return mix(acosh(x), f16vec3(0.0hf), lessThan(x, f16vec3(1.0hf))); +} + +void acosh_f56574() { + f16vec3 res = tint_acosh(f16vec3(0.0hf)); +} + +void compute_main() { + acosh_f56574(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/acosh/f56574.wgsl.expected.msl b/test/tint/builtins/gen/literal/acosh/f56574.wgsl.expected.msl new file mode 100644 index 0000000000..df354ba738 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/f56574.wgsl.expected.msl @@ -0,0 +1,37 @@ +#include + +using namespace metal; +half3 tint_acosh(half3 x) { + return select(acosh(x), half3(0.0h), (x < half3(1.0h))); +} + +void acosh_f56574() { + half3 res = tint_acosh(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acosh_f56574(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acosh_f56574(); + return; +} + +kernel void compute_main() { + acosh_f56574(); + return; +} + diff --git a/test/tint/builtins/gen/literal/acosh/f56574.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/acosh/f56574.wgsl.expected.spvasm new file mode 100644 index 0000000000..c1bec972c0 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/f56574.wgsl.expected.spvasm @@ -0,0 +1,87 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_acosh "tint_acosh" + OpName %x "x" + OpName %acosh_f56574 "acosh_f56574" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %9 = OpTypeFunction %v3half %v3half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %17 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %21 = OpConstantNull %v3half + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_Function_v3half = OpTypePointer Function %v3half + %31 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tint_acosh = OpFunction %v3half None %9 + %x = OpFunctionParameter %v3half + %14 = OpLabel + %18 = OpFOrdLessThan %v3bool %x %17 + %22 = OpExtInst %v3half %23 Acosh %x + %15 = OpSelect %v3half %18 %21 %22 + OpReturnValue %15 + OpFunctionEnd +%acosh_f56574 = OpFunction %void None %24 + %27 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %21 + %28 = OpFunctionCall %v3half %tint_acosh %21 + OpStore %res %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %31 + %33 = OpLabel + %34 = OpFunctionCall %void %acosh_f56574 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %24 + %36 = OpLabel + %37 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %37 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %24 + %40 = OpLabel + %41 = OpFunctionCall %void %acosh_f56574 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %24 + %43 = OpLabel + %44 = OpFunctionCall %void %acosh_f56574 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/acosh/f56574.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/acosh/f56574.wgsl.expected.wgsl new file mode 100644 index 0000000000..2eff0f0d56 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/f56574.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn acosh_f56574() { + var res : vec3 = acosh(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_f56574(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_f56574(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_f56574(); +} diff --git a/test/tint/builtins/gen/literal/arrayLength/8421b9.wgsl b/test/tint/builtins/gen/literal/arrayLength/8421b9.wgsl new file mode 100644 index 0000000000..0a049481b3 --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/8421b9.wgsl @@ -0,0 +1,49 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; +struct SB_RO { + arg_0: array, +}; +@group(0) @binding(1) var sb_ro : SB_RO; + +// fn arrayLength(ptr, read>) -> u32 +fn arrayLength_8421b9() { + var res: u32 = arrayLength(&sb_ro.arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + arrayLength_8421b9(); + return vec4(); +} + +@fragment +fn fragment_main() { + arrayLength_8421b9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + arrayLength_8421b9(); +} diff --git a/test/tint/builtins/gen/literal/arrayLength/8421b9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/arrayLength/8421b9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..233c92b7db --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/8421b9.wgsl.expected.dxc.hlsl @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/literal/arrayLength/8421b9.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/literal/arrayLength/8421b9.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RO { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RO { +^^^^^^ + +gen/literal/arrayLength/8421b9.wgsl:28:42 note: see declaration of variable +@group(0) @binding(1) var sb_ro : SB_RO; + ^^^^^ + diff --git a/test/tint/builtins/gen/literal/arrayLength/8421b9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/arrayLength/8421b9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..233c92b7db --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/8421b9.wgsl.expected.fxc.hlsl @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/literal/arrayLength/8421b9.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/literal/arrayLength/8421b9.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RO { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RO { +^^^^^^ + +gen/literal/arrayLength/8421b9.wgsl:28:42 note: see declaration of variable +@group(0) @binding(1) var sb_ro : SB_RO; + ^^^^^ + diff --git a/test/tint/builtins/gen/literal/arrayLength/8421b9.wgsl.expected.glsl b/test/tint/builtins/gen/literal/arrayLength/8421b9.wgsl.expected.glsl new file mode 100644 index 0000000000..233c92b7db --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/8421b9.wgsl.expected.glsl @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/literal/arrayLength/8421b9.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/literal/arrayLength/8421b9.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RO { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RO { +^^^^^^ + +gen/literal/arrayLength/8421b9.wgsl:28:42 note: see declaration of variable +@group(0) @binding(1) var sb_ro : SB_RO; + ^^^^^ + diff --git a/test/tint/builtins/gen/literal/arrayLength/8421b9.wgsl.expected.msl b/test/tint/builtins/gen/literal/arrayLength/8421b9.wgsl.expected.msl new file mode 100644 index 0000000000..233c92b7db --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/8421b9.wgsl.expected.msl @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/literal/arrayLength/8421b9.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/literal/arrayLength/8421b9.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RO { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RO { +^^^^^^ + +gen/literal/arrayLength/8421b9.wgsl:28:42 note: see declaration of variable +@group(0) @binding(1) var sb_ro : SB_RO; + ^^^^^ + diff --git a/test/tint/builtins/gen/literal/arrayLength/8421b9.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/arrayLength/8421b9.wgsl.expected.spvasm new file mode 100644 index 0000000000..233c92b7db --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/8421b9.wgsl.expected.spvasm @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/literal/arrayLength/8421b9.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/literal/arrayLength/8421b9.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RO { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RO { +^^^^^^ + +gen/literal/arrayLength/8421b9.wgsl:28:42 note: see declaration of variable +@group(0) @binding(1) var sb_ro : SB_RO; + ^^^^^ + diff --git a/test/tint/builtins/gen/literal/arrayLength/8421b9.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/arrayLength/8421b9.wgsl.expected.wgsl new file mode 100644 index 0000000000..233c92b7db --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/8421b9.wgsl.expected.wgsl @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/literal/arrayLength/8421b9.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/literal/arrayLength/8421b9.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RO { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RO { +^^^^^^ + +gen/literal/arrayLength/8421b9.wgsl:28:42 note: see declaration of variable +@group(0) @binding(1) var sb_ro : SB_RO; + ^^^^^ + diff --git a/test/tint/builtins/gen/literal/arrayLength/cbd6b5.wgsl b/test/tint/builtins/gen/literal/arrayLength/cbd6b5.wgsl new file mode 100644 index 0000000000..e457a8a489 --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/cbd6b5.wgsl @@ -0,0 +1,49 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; +struct SB_RW { + arg_0: array, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn arrayLength(ptr, read_write>) -> u32 +fn arrayLength_cbd6b5() { + var res: u32 = arrayLength(&sb_rw.arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + arrayLength_cbd6b5(); + return vec4(); +} + +@fragment +fn fragment_main() { + arrayLength_cbd6b5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + arrayLength_cbd6b5(); +} diff --git a/test/tint/builtins/gen/literal/arrayLength/cbd6b5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/arrayLength/cbd6b5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e0a52531af --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/cbd6b5.wgsl.expected.dxc.hlsl @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/literal/arrayLength/cbd6b5.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/literal/arrayLength/cbd6b5.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RW { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RW { +^^^^^^ + +gen/literal/arrayLength/cbd6b5.wgsl:28:48 note: see declaration of variable +@group(0) @binding(0) var sb_rw : SB_RW; + ^^^^^ + diff --git a/test/tint/builtins/gen/literal/arrayLength/cbd6b5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/arrayLength/cbd6b5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e0a52531af --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/cbd6b5.wgsl.expected.fxc.hlsl @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/literal/arrayLength/cbd6b5.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/literal/arrayLength/cbd6b5.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RW { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RW { +^^^^^^ + +gen/literal/arrayLength/cbd6b5.wgsl:28:48 note: see declaration of variable +@group(0) @binding(0) var sb_rw : SB_RW; + ^^^^^ + diff --git a/test/tint/builtins/gen/literal/arrayLength/cbd6b5.wgsl.expected.glsl b/test/tint/builtins/gen/literal/arrayLength/cbd6b5.wgsl.expected.glsl new file mode 100644 index 0000000000..e0a52531af --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/cbd6b5.wgsl.expected.glsl @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/literal/arrayLength/cbd6b5.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/literal/arrayLength/cbd6b5.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RW { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RW { +^^^^^^ + +gen/literal/arrayLength/cbd6b5.wgsl:28:48 note: see declaration of variable +@group(0) @binding(0) var sb_rw : SB_RW; + ^^^^^ + diff --git a/test/tint/builtins/gen/literal/arrayLength/cbd6b5.wgsl.expected.msl b/test/tint/builtins/gen/literal/arrayLength/cbd6b5.wgsl.expected.msl new file mode 100644 index 0000000000..e0a52531af --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/cbd6b5.wgsl.expected.msl @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/literal/arrayLength/cbd6b5.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/literal/arrayLength/cbd6b5.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RW { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RW { +^^^^^^ + +gen/literal/arrayLength/cbd6b5.wgsl:28:48 note: see declaration of variable +@group(0) @binding(0) var sb_rw : SB_RW; + ^^^^^ + diff --git a/test/tint/builtins/gen/literal/arrayLength/cbd6b5.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/arrayLength/cbd6b5.wgsl.expected.spvasm new file mode 100644 index 0000000000..e0a52531af --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/cbd6b5.wgsl.expected.spvasm @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/literal/arrayLength/cbd6b5.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/literal/arrayLength/cbd6b5.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RW { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RW { +^^^^^^ + +gen/literal/arrayLength/cbd6b5.wgsl:28:48 note: see declaration of variable +@group(0) @binding(0) var sb_rw : SB_RW; + ^^^^^ + diff --git a/test/tint/builtins/gen/literal/arrayLength/cbd6b5.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/arrayLength/cbd6b5.wgsl.expected.wgsl new file mode 100644 index 0000000000..e0a52531af --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/cbd6b5.wgsl.expected.wgsl @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/literal/arrayLength/cbd6b5.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/literal/arrayLength/cbd6b5.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RW { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RW { +^^^^^^ + +gen/literal/arrayLength/cbd6b5.wgsl:28:48 note: see declaration of variable +@group(0) @binding(0) var sb_rw : SB_RW; + ^^^^^ + diff --git a/test/tint/builtins/gen/literal/asin/11dfda.wgsl b/test/tint/builtins/gen/literal/asin/11dfda.wgsl new file mode 100644 index 0000000000..83b5763b66 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/11dfda.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn asin(f16) -> f16 +fn asin_11dfda() { + var res: f16 = asin(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_11dfda(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_11dfda(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_11dfda(); +} diff --git a/test/tint/builtins/gen/literal/asin/11dfda.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/asin/11dfda.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f9ae29ab07 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/11dfda.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void asin_11dfda() { + float16_t res = asin(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_11dfda(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_11dfda(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_11dfda(); + return; +} diff --git a/test/tint/builtins/gen/literal/asin/11dfda.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/asin/11dfda.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e6aa1fc839 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/11dfda.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void asin_11dfda() { + float16_t res = asin(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_11dfda(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_11dfda(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_11dfda(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001FA9E277D20(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001FA9E277D20(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/asin/11dfda.wgsl.expected.glsl b/test/tint/builtins/gen/literal/asin/11dfda.wgsl.expected.glsl new file mode 100644 index 0000000000..798e3f8695 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/11dfda.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asin_11dfda() { + float16_t res = asin(0.0hf); +} + +vec4 vertex_main() { + asin_11dfda(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void asin_11dfda() { + float16_t res = asin(0.0hf); +} + +void fragment_main() { + asin_11dfda(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asin_11dfda() { + float16_t res = asin(0.0hf); +} + +void compute_main() { + asin_11dfda(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/asin/11dfda.wgsl.expected.msl b/test/tint/builtins/gen/literal/asin/11dfda.wgsl.expected.msl new file mode 100644 index 0000000000..6db79bec8a --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/11dfda.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void asin_11dfda() { + half res = asin(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asin_11dfda(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asin_11dfda(); + return; +} + +kernel void compute_main() { + asin_11dfda(); + return; +} + diff --git a/test/tint/builtins/gen/literal/asin/11dfda.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/asin/11dfda.wgsl.expected.spvasm new file mode 100644 index 0000000000..27644d34c4 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/11dfda.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asin_11dfda "asin_11dfda" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%asin_11dfda = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Asin %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %asin_11dfda + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %asin_11dfda + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %asin_11dfda + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/asin/11dfda.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/asin/11dfda.wgsl.expected.wgsl new file mode 100644 index 0000000000..d1b597675e --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/11dfda.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn asin_11dfda() { + var res : f16 = asin(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_11dfda(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_11dfda(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_11dfda(); +} diff --git a/test/tint/builtins/gen/literal/asin/2d8e29.wgsl b/test/tint/builtins/gen/literal/asin/2d8e29.wgsl new file mode 100644 index 0000000000..d21bfd5e28 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/2d8e29.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn asin(vec<3, f16>) -> vec<3, f16> +fn asin_2d8e29() { + var res: vec3 = asin(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_2d8e29(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_2d8e29(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_2d8e29(); +} diff --git a/test/tint/builtins/gen/literal/asin/2d8e29.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/asin/2d8e29.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..52b2e05043 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/2d8e29.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void asin_2d8e29() { + vector res = asin((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_2d8e29(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_2d8e29(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_2d8e29(); + return; +} diff --git a/test/tint/builtins/gen/literal/asin/2d8e29.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/asin/2d8e29.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..30780229de --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/2d8e29.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void asin_2d8e29() { + vector res = asin((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_2d8e29(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_2d8e29(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_2d8e29(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000140BC7EE140(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/asin/2d8e29.wgsl.expected.glsl b/test/tint/builtins/gen/literal/asin/2d8e29.wgsl.expected.glsl new file mode 100644 index 0000000000..fb569f6e5a --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/2d8e29.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asin_2d8e29() { + f16vec3 res = asin(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + asin_2d8e29(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void asin_2d8e29() { + f16vec3 res = asin(f16vec3(0.0hf)); +} + +void fragment_main() { + asin_2d8e29(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asin_2d8e29() { + f16vec3 res = asin(f16vec3(0.0hf)); +} + +void compute_main() { + asin_2d8e29(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/asin/2d8e29.wgsl.expected.msl b/test/tint/builtins/gen/literal/asin/2d8e29.wgsl.expected.msl new file mode 100644 index 0000000000..708107ed23 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/2d8e29.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void asin_2d8e29() { + half3 res = asin(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asin_2d8e29(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asin_2d8e29(); + return; +} + +kernel void compute_main() { + asin_2d8e29(); + return; +} + diff --git a/test/tint/builtins/gen/literal/asin/2d8e29.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/asin/2d8e29.wgsl.expected.spvasm new file mode 100644 index 0000000000..1f23d53ff6 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/2d8e29.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asin_2d8e29 "asin_2d8e29" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%asin_2d8e29 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Asin %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %asin_2d8e29 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %asin_2d8e29 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %asin_2d8e29 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/asin/2d8e29.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/asin/2d8e29.wgsl.expected.wgsl new file mode 100644 index 0000000000..2f97bd2eba --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/2d8e29.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn asin_2d8e29() { + var res : vec3 = asin(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_2d8e29(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_2d8e29(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_2d8e29(); +} diff --git a/test/tint/builtins/gen/literal/asin/3cfbd4.wgsl b/test/tint/builtins/gen/literal/asin/3cfbd4.wgsl new file mode 100644 index 0000000000..44991ef243 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/3cfbd4.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn asin(vec<4, f16>) -> vec<4, f16> +fn asin_3cfbd4() { + var res: vec4 = asin(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_3cfbd4(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_3cfbd4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_3cfbd4(); +} diff --git a/test/tint/builtins/gen/literal/asin/3cfbd4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/asin/3cfbd4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..361aec897e --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/3cfbd4.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void asin_3cfbd4() { + vector res = asin((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_3cfbd4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_3cfbd4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_3cfbd4(); + return; +} diff --git a/test/tint/builtins/gen/literal/asin/3cfbd4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/asin/3cfbd4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4d868fa128 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/3cfbd4.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void asin_3cfbd4() { + vector res = asin((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_3cfbd4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_3cfbd4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_3cfbd4(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022B4BDC88B0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/asin/3cfbd4.wgsl.expected.glsl b/test/tint/builtins/gen/literal/asin/3cfbd4.wgsl.expected.glsl new file mode 100644 index 0000000000..1ce2ff2932 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/3cfbd4.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asin_3cfbd4() { + f16vec4 res = asin(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + asin_3cfbd4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void asin_3cfbd4() { + f16vec4 res = asin(f16vec4(0.0hf)); +} + +void fragment_main() { + asin_3cfbd4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asin_3cfbd4() { + f16vec4 res = asin(f16vec4(0.0hf)); +} + +void compute_main() { + asin_3cfbd4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/asin/3cfbd4.wgsl.expected.msl b/test/tint/builtins/gen/literal/asin/3cfbd4.wgsl.expected.msl new file mode 100644 index 0000000000..d06d2eeb96 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/3cfbd4.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void asin_3cfbd4() { + half4 res = asin(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asin_3cfbd4(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asin_3cfbd4(); + return; +} + +kernel void compute_main() { + asin_3cfbd4(); + return; +} + diff --git a/test/tint/builtins/gen/literal/asin/3cfbd4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/asin/3cfbd4.wgsl.expected.spvasm new file mode 100644 index 0000000000..bdbb112bff --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/3cfbd4.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asin_3cfbd4 "asin_3cfbd4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%asin_3cfbd4 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Asin %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %asin_3cfbd4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %asin_3cfbd4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %asin_3cfbd4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/asin/3cfbd4.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/asin/3cfbd4.wgsl.expected.wgsl new file mode 100644 index 0000000000..63c66a16f4 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/3cfbd4.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn asin_3cfbd4() { + var res : vec4 = asin(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_3cfbd4(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_3cfbd4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_3cfbd4(); +} diff --git a/test/tint/builtins/gen/literal/asin/b4aced.wgsl b/test/tint/builtins/gen/literal/asin/b4aced.wgsl new file mode 100644 index 0000000000..591bac3948 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/b4aced.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn asin(vec<2, f16>) -> vec<2, f16> +fn asin_b4aced() { + var res: vec2 = asin(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_b4aced(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_b4aced(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_b4aced(); +} diff --git a/test/tint/builtins/gen/literal/asin/b4aced.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/asin/b4aced.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ab5d6089ec --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/b4aced.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void asin_b4aced() { + vector res = asin((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_b4aced(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_b4aced(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_b4aced(); + return; +} diff --git a/test/tint/builtins/gen/literal/asin/b4aced.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/asin/b4aced.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c17039a672 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/b4aced.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void asin_b4aced() { + vector res = asin((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_b4aced(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_b4aced(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_b4aced(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000138E6B7E9E0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/asin/b4aced.wgsl.expected.glsl b/test/tint/builtins/gen/literal/asin/b4aced.wgsl.expected.glsl new file mode 100644 index 0000000000..29e01f946c --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/b4aced.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asin_b4aced() { + f16vec2 res = asin(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + asin_b4aced(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void asin_b4aced() { + f16vec2 res = asin(f16vec2(0.0hf)); +} + +void fragment_main() { + asin_b4aced(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asin_b4aced() { + f16vec2 res = asin(f16vec2(0.0hf)); +} + +void compute_main() { + asin_b4aced(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/asin/b4aced.wgsl.expected.msl b/test/tint/builtins/gen/literal/asin/b4aced.wgsl.expected.msl new file mode 100644 index 0000000000..81e1965701 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/b4aced.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void asin_b4aced() { + half2 res = asin(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asin_b4aced(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asin_b4aced(); + return; +} + +kernel void compute_main() { + asin_b4aced(); + return; +} + diff --git a/test/tint/builtins/gen/literal/asin/b4aced.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/asin/b4aced.wgsl.expected.spvasm new file mode 100644 index 0000000000..2515d21823 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/b4aced.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asin_b4aced "asin_b4aced" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%asin_b4aced = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Asin %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %asin_b4aced + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %asin_b4aced + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %asin_b4aced + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/asin/b4aced.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/asin/b4aced.wgsl.expected.wgsl new file mode 100644 index 0000000000..545e7c403a --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/b4aced.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn asin_b4aced() { + var res : vec2 = asin(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_b4aced(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_b4aced(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_b4aced(); +} diff --git a/test/tint/builtins/gen/literal/asinh/468a48.wgsl b/test/tint/builtins/gen/literal/asinh/468a48.wgsl new file mode 100644 index 0000000000..884a6b2ca0 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/468a48.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn asinh(f16) -> f16 +fn asinh_468a48() { + var res: f16 = asinh(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_468a48(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_468a48(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_468a48(); +} diff --git a/test/tint/builtins/gen/literal/asinh/468a48.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/asinh/468a48.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..70800417b4 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/468a48.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +float16_t tint_sinh(float16_t x) { + return log((x + sqrt(((x * x) + float16_t(1.0h))))); +} + +void asinh_468a48() { + float16_t res = tint_sinh(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_468a48(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_468a48(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_468a48(); + return; +} diff --git a/test/tint/builtins/gen/literal/asinh/468a48.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/asinh/468a48.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c76be3c900 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/468a48.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +float16_t tint_sinh(float16_t x) { + return log((x + sqrt(((x * x) + float16_t(1.0h))))); +} + +void asinh_468a48() { + float16_t res = tint_sinh(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_468a48(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_468a48(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_468a48(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024C0A8E8450(1,1-9): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/builtins/gen/literal/asinh/468a48.wgsl.expected.glsl b/test/tint/builtins/gen/literal/asinh/468a48.wgsl.expected.glsl new file mode 100644 index 0000000000..f688b6efc2 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/468a48.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asinh_468a48() { + float16_t res = asinh(0.0hf); +} + +vec4 vertex_main() { + asinh_468a48(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void asinh_468a48() { + float16_t res = asinh(0.0hf); +} + +void fragment_main() { + asinh_468a48(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asinh_468a48() { + float16_t res = asinh(0.0hf); +} + +void compute_main() { + asinh_468a48(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/asinh/468a48.wgsl.expected.msl b/test/tint/builtins/gen/literal/asinh/468a48.wgsl.expected.msl new file mode 100644 index 0000000000..dab52827ee --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/468a48.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void asinh_468a48() { + half res = asinh(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asinh_468a48(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asinh_468a48(); + return; +} + +kernel void compute_main() { + asinh_468a48(); + return; +} + diff --git a/test/tint/builtins/gen/literal/asinh/468a48.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/asinh/468a48.wgsl.expected.spvasm new file mode 100644 index 0000000000..6b2056f062 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/468a48.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asinh_468a48 "asinh_468a48" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%asinh_468a48 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Asinh %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %asinh_468a48 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %asinh_468a48 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %asinh_468a48 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/asinh/468a48.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/asinh/468a48.wgsl.expected.wgsl new file mode 100644 index 0000000000..a546ede0fb --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/468a48.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn asinh_468a48() { + var res : f16 = asinh(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_468a48(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_468a48(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_468a48(); +} diff --git a/test/tint/builtins/gen/literal/asinh/95ab2b.wgsl b/test/tint/builtins/gen/literal/asinh/95ab2b.wgsl new file mode 100644 index 0000000000..dfa3c2903c --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/95ab2b.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn asinh(vec<4, f16>) -> vec<4, f16> +fn asinh_95ab2b() { + var res: vec4 = asinh(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_95ab2b(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_95ab2b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_95ab2b(); +} diff --git a/test/tint/builtins/gen/literal/asinh/95ab2b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/asinh/95ab2b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..05818ab377 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/95ab2b.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +vector tint_sinh(vector x) { + return log((x + sqrt(((x * x) + float16_t(1.0h))))); +} + +void asinh_95ab2b() { + vector res = tint_sinh((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_95ab2b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_95ab2b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_95ab2b(); + return; +} diff --git a/test/tint/builtins/gen/literal/asinh/95ab2b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/asinh/95ab2b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d5bda99e05 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/95ab2b.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +vector tint_sinh(vector x) { + return log((x + sqrt(((x * x) + float16_t(1.0h))))); +} + +void asinh_95ab2b() { + vector res = tint_sinh((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_95ab2b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_95ab2b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_95ab2b(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000017880279490(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/asinh/95ab2b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/asinh/95ab2b.wgsl.expected.glsl new file mode 100644 index 0000000000..363fcf6dd7 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/95ab2b.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asinh_95ab2b() { + f16vec4 res = asinh(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + asinh_95ab2b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void asinh_95ab2b() { + f16vec4 res = asinh(f16vec4(0.0hf)); +} + +void fragment_main() { + asinh_95ab2b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asinh_95ab2b() { + f16vec4 res = asinh(f16vec4(0.0hf)); +} + +void compute_main() { + asinh_95ab2b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/asinh/95ab2b.wgsl.expected.msl b/test/tint/builtins/gen/literal/asinh/95ab2b.wgsl.expected.msl new file mode 100644 index 0000000000..cd7195cbf0 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/95ab2b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void asinh_95ab2b() { + half4 res = asinh(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asinh_95ab2b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asinh_95ab2b(); + return; +} + +kernel void compute_main() { + asinh_95ab2b(); + return; +} + diff --git a/test/tint/builtins/gen/literal/asinh/95ab2b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/asinh/95ab2b.wgsl.expected.spvasm new file mode 100644 index 0000000000..53d1b94500 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/95ab2b.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asinh_95ab2b "asinh_95ab2b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%asinh_95ab2b = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Asinh %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %asinh_95ab2b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %asinh_95ab2b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %asinh_95ab2b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/asinh/95ab2b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/asinh/95ab2b.wgsl.expected.wgsl new file mode 100644 index 0000000000..ca02f94158 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/95ab2b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn asinh_95ab2b() { + var res : vec4 = asinh(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_95ab2b(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_95ab2b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_95ab2b(); +} diff --git a/test/tint/builtins/gen/literal/asinh/ad8f8b.wgsl b/test/tint/builtins/gen/literal/asinh/ad8f8b.wgsl new file mode 100644 index 0000000000..fa045bb3a1 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/ad8f8b.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn asinh(vec<2, f16>) -> vec<2, f16> +fn asinh_ad8f8b() { + var res: vec2 = asinh(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_ad8f8b(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_ad8f8b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_ad8f8b(); +} diff --git a/test/tint/builtins/gen/literal/asinh/ad8f8b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/asinh/ad8f8b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3a87d2d7e4 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/ad8f8b.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +vector tint_sinh(vector x) { + return log((x + sqrt(((x * x) + float16_t(1.0h))))); +} + +void asinh_ad8f8b() { + vector res = tint_sinh((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_ad8f8b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_ad8f8b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_ad8f8b(); + return; +} diff --git a/test/tint/builtins/gen/literal/asinh/ad8f8b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/asinh/ad8f8b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d46056e98c --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/ad8f8b.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +vector tint_sinh(vector x) { + return log((x + sqrt(((x * x) + float16_t(1.0h))))); +} + +void asinh_ad8f8b() { + vector res = tint_sinh((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_ad8f8b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_ad8f8b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_ad8f8b(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002AC790D84D0(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/asinh/ad8f8b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/asinh/ad8f8b.wgsl.expected.glsl new file mode 100644 index 0000000000..1b02aa753e --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/ad8f8b.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asinh_ad8f8b() { + f16vec2 res = asinh(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + asinh_ad8f8b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void asinh_ad8f8b() { + f16vec2 res = asinh(f16vec2(0.0hf)); +} + +void fragment_main() { + asinh_ad8f8b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asinh_ad8f8b() { + f16vec2 res = asinh(f16vec2(0.0hf)); +} + +void compute_main() { + asinh_ad8f8b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/asinh/ad8f8b.wgsl.expected.msl b/test/tint/builtins/gen/literal/asinh/ad8f8b.wgsl.expected.msl new file mode 100644 index 0000000000..257acf5209 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/ad8f8b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void asinh_ad8f8b() { + half2 res = asinh(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asinh_ad8f8b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asinh_ad8f8b(); + return; +} + +kernel void compute_main() { + asinh_ad8f8b(); + return; +} + diff --git a/test/tint/builtins/gen/literal/asinh/ad8f8b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/asinh/ad8f8b.wgsl.expected.spvasm new file mode 100644 index 0000000000..af0d7e18eb --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/ad8f8b.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asinh_ad8f8b "asinh_ad8f8b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%asinh_ad8f8b = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Asinh %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %asinh_ad8f8b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %asinh_ad8f8b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %asinh_ad8f8b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/asinh/ad8f8b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/asinh/ad8f8b.wgsl.expected.wgsl new file mode 100644 index 0000000000..3bd274ef3b --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/ad8f8b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn asinh_ad8f8b() { + var res : vec2 = asinh(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_ad8f8b(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_ad8f8b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_ad8f8b(); +} diff --git a/test/tint/builtins/gen/literal/asinh/fb5e8c.wgsl b/test/tint/builtins/gen/literal/asinh/fb5e8c.wgsl new file mode 100644 index 0000000000..67d2c9d3d5 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/fb5e8c.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn asinh(vec<3, f16>) -> vec<3, f16> +fn asinh_fb5e8c() { + var res: vec3 = asinh(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_fb5e8c(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_fb5e8c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_fb5e8c(); +} diff --git a/test/tint/builtins/gen/literal/asinh/fb5e8c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/asinh/fb5e8c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..920c90e861 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/fb5e8c.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +vector tint_sinh(vector x) { + return log((x + sqrt(((x * x) + float16_t(1.0h))))); +} + +void asinh_fb5e8c() { + vector res = tint_sinh((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_fb5e8c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_fb5e8c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_fb5e8c(); + return; +} diff --git a/test/tint/builtins/gen/literal/asinh/fb5e8c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/asinh/fb5e8c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d67e924e3f --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/fb5e8c.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +vector tint_sinh(vector x) { + return log((x + sqrt(((x * x) + float16_t(1.0h))))); +} + +void asinh_fb5e8c() { + vector res = tint_sinh((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_fb5e8c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_fb5e8c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_fb5e8c(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E444F93560(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/asinh/fb5e8c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/asinh/fb5e8c.wgsl.expected.glsl new file mode 100644 index 0000000000..d489bf4822 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/fb5e8c.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asinh_fb5e8c() { + f16vec3 res = asinh(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + asinh_fb5e8c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void asinh_fb5e8c() { + f16vec3 res = asinh(f16vec3(0.0hf)); +} + +void fragment_main() { + asinh_fb5e8c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asinh_fb5e8c() { + f16vec3 res = asinh(f16vec3(0.0hf)); +} + +void compute_main() { + asinh_fb5e8c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/asinh/fb5e8c.wgsl.expected.msl b/test/tint/builtins/gen/literal/asinh/fb5e8c.wgsl.expected.msl new file mode 100644 index 0000000000..3ff85f763e --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/fb5e8c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void asinh_fb5e8c() { + half3 res = asinh(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asinh_fb5e8c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asinh_fb5e8c(); + return; +} + +kernel void compute_main() { + asinh_fb5e8c(); + return; +} + diff --git a/test/tint/builtins/gen/literal/asinh/fb5e8c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/asinh/fb5e8c.wgsl.expected.spvasm new file mode 100644 index 0000000000..99ab3bac51 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/fb5e8c.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asinh_fb5e8c "asinh_fb5e8c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%asinh_fb5e8c = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Asinh %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %asinh_fb5e8c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %asinh_fb5e8c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %asinh_fb5e8c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/asinh/fb5e8c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/asinh/fb5e8c.wgsl.expected.wgsl new file mode 100644 index 0000000000..953a9d1238 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/fb5e8c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn asinh_fb5e8c() { + var res : vec3 = asinh(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_fb5e8c(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_fb5e8c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_fb5e8c(); +} diff --git a/test/tint/builtins/gen/literal/atan/19faea.wgsl b/test/tint/builtins/gen/literal/atan/19faea.wgsl new file mode 100644 index 0000000000..250ddc50d4 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/19faea.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atan(vec<4, f16>) -> vec<4, f16> +fn atan_19faea() { + var res: vec4 = atan(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_19faea(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_19faea(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_19faea(); +} diff --git a/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..32017a8891 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void atan_19faea() { + vector res = atan((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_19faea(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_19faea(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_19faea(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..32fb21e254 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void atan_19faea() { + vector res = atan((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_19faea(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_19faea(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_19faea(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002329F308C50(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.glsl new file mode 100644 index 0000000000..13299d81e4 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan_19faea() { + f16vec4 res = atan(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + atan_19faea(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void atan_19faea() { + f16vec4 res = atan(f16vec4(0.0hf)); +} + +void fragment_main() { + atan_19faea(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan_19faea() { + f16vec4 res = atan(f16vec4(0.0hf)); +} + +void compute_main() { + atan_19faea(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.msl b/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.msl new file mode 100644 index 0000000000..a52ea2c590 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void atan_19faea() { + half4 res = atan(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan_19faea(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan_19faea(); + return; +} + +kernel void compute_main() { + atan_19faea(); + return; +} + diff --git a/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.spvasm new file mode 100644 index 0000000000..38b784b345 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan_19faea "atan_19faea" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan_19faea = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Atan %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %atan_19faea + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %atan_19faea + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %atan_19faea + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.wgsl new file mode 100644 index 0000000000..ecac9552a7 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn atan_19faea() { + var res : vec4 = atan(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_19faea(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_19faea(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_19faea(); +} diff --git a/test/tint/builtins/gen/literal/atan/1e1764.wgsl b/test/tint/builtins/gen/literal/atan/1e1764.wgsl new file mode 100644 index 0000000000..013ab6e285 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/1e1764.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atan(vec<2, f16>) -> vec<2, f16> +fn atan_1e1764() { + var res: vec2 = atan(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_1e1764(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_1e1764(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_1e1764(); +} diff --git a/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a1e7df0083 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void atan_1e1764() { + vector res = atan((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_1e1764(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_1e1764(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_1e1764(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..98c9ee9499 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void atan_1e1764() { + vector res = atan((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_1e1764(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_1e1764(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_1e1764(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C856E61160(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.glsl new file mode 100644 index 0000000000..5e93d9ab63 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan_1e1764() { + f16vec2 res = atan(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + atan_1e1764(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void atan_1e1764() { + f16vec2 res = atan(f16vec2(0.0hf)); +} + +void fragment_main() { + atan_1e1764(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan_1e1764() { + f16vec2 res = atan(f16vec2(0.0hf)); +} + +void compute_main() { + atan_1e1764(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.msl b/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.msl new file mode 100644 index 0000000000..e16428d9ed --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void atan_1e1764() { + half2 res = atan(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan_1e1764(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan_1e1764(); + return; +} + +kernel void compute_main() { + atan_1e1764(); + return; +} + diff --git a/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.spvasm new file mode 100644 index 0000000000..f7715a72a0 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan_1e1764 "atan_1e1764" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan_1e1764 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Atan %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %atan_1e1764 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %atan_1e1764 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %atan_1e1764 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.wgsl new file mode 100644 index 0000000000..8278671c33 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn atan_1e1764() { + var res : vec2 = atan(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_1e1764(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_1e1764(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_1e1764(); +} diff --git a/test/tint/builtins/gen/literal/atan/a5f421.wgsl b/test/tint/builtins/gen/literal/atan/a5f421.wgsl new file mode 100644 index 0000000000..766fcb3958 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/a5f421.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atan(vec<3, f16>) -> vec<3, f16> +fn atan_a5f421() { + var res: vec3 = atan(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_a5f421(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_a5f421(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_a5f421(); +} diff --git a/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3e5b84f7f1 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void atan_a5f421() { + vector res = atan((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_a5f421(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_a5f421(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_a5f421(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..338d894442 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void atan_a5f421() { + vector res = atan((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_a5f421(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_a5f421(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_a5f421(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000186B9618C70(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.glsl new file mode 100644 index 0000000000..6d93eef6a0 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan_a5f421() { + f16vec3 res = atan(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + atan_a5f421(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void atan_a5f421() { + f16vec3 res = atan(f16vec3(0.0hf)); +} + +void fragment_main() { + atan_a5f421(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan_a5f421() { + f16vec3 res = atan(f16vec3(0.0hf)); +} + +void compute_main() { + atan_a5f421(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.msl b/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.msl new file mode 100644 index 0000000000..66c582a3fb --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void atan_a5f421() { + half3 res = atan(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan_a5f421(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan_a5f421(); + return; +} + +kernel void compute_main() { + atan_a5f421(); + return; +} + diff --git a/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.spvasm new file mode 100644 index 0000000000..fa62fa23f6 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan_a5f421 "atan_a5f421" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan_a5f421 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Atan %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %atan_a5f421 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %atan_a5f421 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %atan_a5f421 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.wgsl new file mode 100644 index 0000000000..356793ca07 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn atan_a5f421() { + var res : vec3 = atan(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_a5f421(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_a5f421(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_a5f421(); +} diff --git a/test/tint/builtins/gen/literal/atan/a7ba61.wgsl b/test/tint/builtins/gen/literal/atan/a7ba61.wgsl new file mode 100644 index 0000000000..9467660bb8 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/a7ba61.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atan(f16) -> f16 +fn atan_a7ba61() { + var res: f16 = atan(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_a7ba61(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_a7ba61(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_a7ba61(); +} diff --git a/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b97a99c8ef --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void atan_a7ba61() { + float16_t res = atan(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_a7ba61(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_a7ba61(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_a7ba61(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e5a9a51494 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void atan_a7ba61() { + float16_t res = atan(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_a7ba61(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_a7ba61(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_a7ba61(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000211ADB21160(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000211ADB21160(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.glsl new file mode 100644 index 0000000000..d2732b2208 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan_a7ba61() { + float16_t res = atan(0.0hf); +} + +vec4 vertex_main() { + atan_a7ba61(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void atan_a7ba61() { + float16_t res = atan(0.0hf); +} + +void fragment_main() { + atan_a7ba61(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan_a7ba61() { + float16_t res = atan(0.0hf); +} + +void compute_main() { + atan_a7ba61(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.msl b/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.msl new file mode 100644 index 0000000000..b225ca002e --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void atan_a7ba61() { + half res = atan(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan_a7ba61(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan_a7ba61(); + return; +} + +kernel void compute_main() { + atan_a7ba61(); + return; +} + diff --git a/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.spvasm new file mode 100644 index 0000000000..45a9b3dd68 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan_a7ba61 "atan_a7ba61" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan_a7ba61 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Atan %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %atan_a7ba61 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %atan_a7ba61 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %atan_a7ba61 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.wgsl new file mode 100644 index 0000000000..891c5e3e7a --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn atan_a7ba61() { + var res : f16 = atan(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_a7ba61(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_a7ba61(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_a7ba61(); +} diff --git a/test/tint/builtins/gen/literal/atan2/21dfea.wgsl b/test/tint/builtins/gen/literal/atan2/21dfea.wgsl new file mode 100644 index 0000000000..5a1889f2b4 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/21dfea.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atan2(vec<3, f16>, vec<3, f16>) -> vec<3, f16> +fn atan2_21dfea() { + var res: vec3 = atan2(vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_21dfea(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_21dfea(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_21dfea(); +} diff --git a/test/tint/builtins/gen/literal/atan2/21dfea.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atan2/21dfea.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f40c95d00a --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/21dfea.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void atan2_21dfea() { + vector res = (float16_t(0.0h)).xxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_21dfea(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_21dfea(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_21dfea(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan2/21dfea.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atan2/21dfea.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3c389fb49a --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/21dfea.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void atan2_21dfea() { + vector res = (float16_t(0.0h)).xxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_21dfea(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_21dfea(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_21dfea(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020C31CCD060(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/atan2/21dfea.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atan2/21dfea.wgsl.expected.glsl new file mode 100644 index 0000000000..489c3b5683 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/21dfea.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan2_21dfea() { + f16vec3 res = f16vec3(0.0hf); +} + +vec4 vertex_main() { + atan2_21dfea(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void atan2_21dfea() { + f16vec3 res = f16vec3(0.0hf); +} + +void fragment_main() { + atan2_21dfea(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan2_21dfea() { + f16vec3 res = f16vec3(0.0hf); +} + +void compute_main() { + atan2_21dfea(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan2/21dfea.wgsl.expected.msl b/test/tint/builtins/gen/literal/atan2/21dfea.wgsl.expected.msl new file mode 100644 index 0000000000..871202c34e --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/21dfea.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void atan2_21dfea() { + half3 res = half3(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan2_21dfea(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan2_21dfea(); + return; +} + +kernel void compute_main() { + atan2_21dfea(); + return; +} + diff --git a/test/tint/builtins/gen/literal/atan2/21dfea.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atan2/21dfea.wgsl.expected.spvasm new file mode 100644 index 0000000000..25707d7867 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/21dfea.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan2_21dfea "atan2_21dfea" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %18 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan2_21dfea = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %18 + %20 = OpLabel + %21 = OpFunctionCall %void %atan2_21dfea + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %23 = OpLabel + %24 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %24 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %atan2_21dfea + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %atan2_21dfea + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atan2/21dfea.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atan2/21dfea.wgsl.expected.wgsl new file mode 100644 index 0000000000..a5251d4e57 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/21dfea.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn atan2_21dfea() { + var res : vec3 = atan2(vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_21dfea(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_21dfea(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_21dfea(); +} diff --git a/test/tint/builtins/gen/literal/atan2/93febc.wgsl b/test/tint/builtins/gen/literal/atan2/93febc.wgsl new file mode 100644 index 0000000000..6a5abcb1c1 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/93febc.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atan2(vec<2, f16>, vec<2, f16>) -> vec<2, f16> +fn atan2_93febc() { + var res: vec2 = atan2(vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_93febc(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_93febc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_93febc(); +} diff --git a/test/tint/builtins/gen/literal/atan2/93febc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atan2/93febc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..29acbb210f --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/93febc.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void atan2_93febc() { + vector res = (float16_t(0.0h)).xx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_93febc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_93febc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_93febc(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan2/93febc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atan2/93febc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..251cb38b59 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/93febc.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void atan2_93febc() { + vector res = (float16_t(0.0h)).xx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_93febc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_93febc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_93febc(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000029435E06D30(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/atan2/93febc.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atan2/93febc.wgsl.expected.glsl new file mode 100644 index 0000000000..1de833b62c --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/93febc.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan2_93febc() { + f16vec2 res = f16vec2(0.0hf); +} + +vec4 vertex_main() { + atan2_93febc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void atan2_93febc() { + f16vec2 res = f16vec2(0.0hf); +} + +void fragment_main() { + atan2_93febc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan2_93febc() { + f16vec2 res = f16vec2(0.0hf); +} + +void compute_main() { + atan2_93febc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan2/93febc.wgsl.expected.msl b/test/tint/builtins/gen/literal/atan2/93febc.wgsl.expected.msl new file mode 100644 index 0000000000..7f6e188aef --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/93febc.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void atan2_93febc() { + half2 res = half2(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan2_93febc(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan2_93febc(); + return; +} + +kernel void compute_main() { + atan2_93febc(); + return; +} + diff --git a/test/tint/builtins/gen/literal/atan2/93febc.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atan2/93febc.wgsl.expected.spvasm new file mode 100644 index 0000000000..4404d85411 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/93febc.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan2_93febc "atan2_93febc" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %18 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan2_93febc = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %18 + %20 = OpLabel + %21 = OpFunctionCall %void %atan2_93febc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %23 = OpLabel + %24 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %24 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %atan2_93febc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %atan2_93febc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atan2/93febc.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atan2/93febc.wgsl.expected.wgsl new file mode 100644 index 0000000000..23d923aec6 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/93febc.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn atan2_93febc() { + var res : vec2 = atan2(vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_93febc(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_93febc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_93febc(); +} diff --git a/test/tint/builtins/gen/literal/atan2/ca698e.wgsl b/test/tint/builtins/gen/literal/atan2/ca698e.wgsl new file mode 100644 index 0000000000..c22ba397cb --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/ca698e.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atan2(f16, f16) -> f16 +fn atan2_ca698e() { + var res: f16 = atan2(f16(), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_ca698e(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_ca698e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_ca698e(); +} diff --git a/test/tint/builtins/gen/literal/atan2/ca698e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atan2/ca698e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..68471d9206 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/ca698e.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void atan2_ca698e() { + float16_t res = float16_t(0.0h); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_ca698e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_ca698e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_ca698e(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan2/ca698e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atan2/ca698e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c13f773433 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/ca698e.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void atan2_ca698e() { + float16_t res = float16_t(0.0h); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_ca698e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_ca698e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_ca698e(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000221D39B1200(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000221D39B1200(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/atan2/ca698e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atan2/ca698e.wgsl.expected.glsl new file mode 100644 index 0000000000..d310b708f9 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/ca698e.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan2_ca698e() { + float16_t res = 0.0hf; +} + +vec4 vertex_main() { + atan2_ca698e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void atan2_ca698e() { + float16_t res = 0.0hf; +} + +void fragment_main() { + atan2_ca698e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan2_ca698e() { + float16_t res = 0.0hf; +} + +void compute_main() { + atan2_ca698e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan2/ca698e.wgsl.expected.msl b/test/tint/builtins/gen/literal/atan2/ca698e.wgsl.expected.msl new file mode 100644 index 0000000000..f4e7539422 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/ca698e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void atan2_ca698e() { + half res = 0.0h; +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan2_ca698e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan2_ca698e(); + return; +} + +kernel void compute_main() { + atan2_ca698e(); + return; +} + diff --git a/test/tint/builtins/gen/literal/atan2/ca698e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atan2/ca698e.wgsl.expected.spvasm new file mode 100644 index 0000000000..63ae0e46a5 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/ca698e.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan2_ca698e "atan2_ca698e" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %17 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan2_ca698e = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %res %14 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %17 + %19 = OpLabel + %20 = OpFunctionCall %void %atan2_ca698e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %22 = OpLabel + %23 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %23 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %void %atan2_ca698e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %atan2_ca698e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atan2/ca698e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atan2/ca698e.wgsl.expected.wgsl new file mode 100644 index 0000000000..fe62d18d96 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/ca698e.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn atan2_ca698e() { + var res : f16 = atan2(f16(), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_ca698e(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_ca698e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_ca698e(); +} diff --git a/test/tint/builtins/gen/literal/atan2/d983ab.wgsl b/test/tint/builtins/gen/literal/atan2/d983ab.wgsl new file mode 100644 index 0000000000..bc8410c862 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/d983ab.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atan2(vec<4, f16>, vec<4, f16>) -> vec<4, f16> +fn atan2_d983ab() { + var res: vec4 = atan2(vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_d983ab(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_d983ab(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_d983ab(); +} diff --git a/test/tint/builtins/gen/literal/atan2/d983ab.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atan2/d983ab.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b7ee7943bb --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/d983ab.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void atan2_d983ab() { + vector res = (float16_t(0.0h)).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_d983ab(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_d983ab(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_d983ab(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan2/d983ab.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atan2/d983ab.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c24da1d10d --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/d983ab.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void atan2_d983ab() { + vector res = (float16_t(0.0h)).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_d983ab(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_d983ab(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_d983ab(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000259F9C66DF0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/atan2/d983ab.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atan2/d983ab.wgsl.expected.glsl new file mode 100644 index 0000000000..6f6529db5b --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/d983ab.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan2_d983ab() { + f16vec4 res = f16vec4(0.0hf); +} + +vec4 vertex_main() { + atan2_d983ab(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void atan2_d983ab() { + f16vec4 res = f16vec4(0.0hf); +} + +void fragment_main() { + atan2_d983ab(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan2_d983ab() { + f16vec4 res = f16vec4(0.0hf); +} + +void compute_main() { + atan2_d983ab(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan2/d983ab.wgsl.expected.msl b/test/tint/builtins/gen/literal/atan2/d983ab.wgsl.expected.msl new file mode 100644 index 0000000000..227ba1f722 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/d983ab.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void atan2_d983ab() { + half4 res = half4(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan2_d983ab(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan2_d983ab(); + return; +} + +kernel void compute_main() { + atan2_d983ab(); + return; +} + diff --git a/test/tint/builtins/gen/literal/atan2/d983ab.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atan2/d983ab.wgsl.expected.spvasm new file mode 100644 index 0000000000..d6c52b97a3 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/d983ab.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan2_d983ab "atan2_d983ab" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %18 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan2_d983ab = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %18 + %20 = OpLabel + %21 = OpFunctionCall %void %atan2_d983ab + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %23 = OpLabel + %24 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %24 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %atan2_d983ab + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %atan2_d983ab + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atan2/d983ab.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atan2/d983ab.wgsl.expected.wgsl new file mode 100644 index 0000000000..50719cb68f --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/d983ab.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn atan2_d983ab() { + var res : vec4 = atan2(vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_d983ab(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_d983ab(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_d983ab(); +} diff --git a/test/tint/builtins/gen/literal/atanh/5bf88d.wgsl b/test/tint/builtins/gen/literal/atanh/5bf88d.wgsl new file mode 100644 index 0000000000..f82815681b --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/5bf88d.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atanh(vec<2, f16>) -> vec<2, f16> +fn atanh_5bf88d() { + var res: vec2 = atanh(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_5bf88d(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_5bf88d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_5bf88d(); +} diff --git a/test/tint/builtins/gen/literal/atanh/5bf88d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atanh/5bf88d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..38fb4b66c2 --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/5bf88d.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +vector tint_atanh(vector x) { + return (log(((float16_t(1.0h) + x) / (float16_t(1.0h) - x))) * float16_t(0.5h)); +} + +void atanh_5bf88d() { + vector res = tint_atanh((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_5bf88d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_5bf88d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_5bf88d(); + return; +} diff --git a/test/tint/builtins/gen/literal/atanh/5bf88d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atanh/5bf88d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..73c6586a2d --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/5bf88d.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +vector tint_atanh(vector x) { + return (log(((float16_t(1.0h) + x) / (float16_t(1.0h) - x))) * float16_t(0.5h)); +} + +void atanh_5bf88d() { + vector res = tint_atanh((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_5bf88d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_5bf88d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_5bf88d(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F6B2FD2F70(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/atanh/5bf88d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atanh/5bf88d.wgsl.expected.glsl new file mode 100644 index 0000000000..76ddf5731d --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/5bf88d.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec2 tint_atanh(f16vec2 x) { + return mix(atanh(x), f16vec2(0.0hf), greaterThanEqual(x, f16vec2(1.0hf))); +} + +void atanh_5bf88d() { + f16vec2 res = tint_atanh(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + atanh_5bf88d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec2 tint_atanh(f16vec2 x) { + return mix(atanh(x), f16vec2(0.0hf), greaterThanEqual(x, f16vec2(1.0hf))); +} + +void atanh_5bf88d() { + f16vec2 res = tint_atanh(f16vec2(0.0hf)); +} + +void fragment_main() { + atanh_5bf88d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec2 tint_atanh(f16vec2 x) { + return mix(atanh(x), f16vec2(0.0hf), greaterThanEqual(x, f16vec2(1.0hf))); +} + +void atanh_5bf88d() { + f16vec2 res = tint_atanh(f16vec2(0.0hf)); +} + +void compute_main() { + atanh_5bf88d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/atanh/5bf88d.wgsl.expected.msl b/test/tint/builtins/gen/literal/atanh/5bf88d.wgsl.expected.msl new file mode 100644 index 0000000000..3b4f0b34bd --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/5bf88d.wgsl.expected.msl @@ -0,0 +1,37 @@ +#include + +using namespace metal; +half2 tint_atanh(half2 x) { + return select(atanh(x), half2(0.0h), (x >= half2(1.0h))); +} + +void atanh_5bf88d() { + half2 res = tint_atanh(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atanh_5bf88d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atanh_5bf88d(); + return; +} + +kernel void compute_main() { + atanh_5bf88d(); + return; +} + diff --git a/test/tint/builtins/gen/literal/atanh/5bf88d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atanh/5bf88d.wgsl.expected.spvasm new file mode 100644 index 0000000000..d87c6402fa --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/5bf88d.wgsl.expected.spvasm @@ -0,0 +1,87 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_atanh "tint_atanh" + OpName %x "x" + OpName %atanh_5bf88d "atanh_5bf88d" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %9 = OpTypeFunction %v2half %v2half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %17 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_0 + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %21 = OpConstantNull %v2half + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_Function_v2half = OpTypePointer Function %v2half + %31 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tint_atanh = OpFunction %v2half None %9 + %x = OpFunctionParameter %v2half + %14 = OpLabel + %18 = OpFOrdGreaterThanEqual %v2bool %x %17 + %22 = OpExtInst %v2half %23 Atanh %x + %15 = OpSelect %v2half %18 %21 %22 + OpReturnValue %15 + OpFunctionEnd +%atanh_5bf88d = OpFunction %void None %24 + %27 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %21 + %28 = OpFunctionCall %v2half %tint_atanh %21 + OpStore %res %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %31 + %33 = OpLabel + %34 = OpFunctionCall %void %atanh_5bf88d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %24 + %36 = OpLabel + %37 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %37 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %24 + %40 = OpLabel + %41 = OpFunctionCall %void %atanh_5bf88d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %24 + %43 = OpLabel + %44 = OpFunctionCall %void %atanh_5bf88d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atanh/5bf88d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atanh/5bf88d.wgsl.expected.wgsl new file mode 100644 index 0000000000..b399e07dc4 --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/5bf88d.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn atanh_5bf88d() { + var res : vec2 = atanh(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_5bf88d(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_5bf88d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_5bf88d(); +} diff --git a/test/tint/builtins/gen/literal/atanh/d2d8cd.wgsl b/test/tint/builtins/gen/literal/atanh/d2d8cd.wgsl new file mode 100644 index 0000000000..2fa4e3c9fd --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/d2d8cd.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atanh(f16) -> f16 +fn atanh_d2d8cd() { + var res: f16 = atanh(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_d2d8cd(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_d2d8cd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_d2d8cd(); +} diff --git a/test/tint/builtins/gen/literal/atanh/d2d8cd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atanh/d2d8cd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1b3c054c9b --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/d2d8cd.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +float16_t tint_atanh(float16_t x) { + return (log(((float16_t(1.0h) + x) / (float16_t(1.0h) - x))) * float16_t(0.5h)); +} + +void atanh_d2d8cd() { + float16_t res = tint_atanh(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_d2d8cd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_d2d8cd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_d2d8cd(); + return; +} diff --git a/test/tint/builtins/gen/literal/atanh/d2d8cd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atanh/d2d8cd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f0a2f1e426 --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/d2d8cd.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +float16_t tint_atanh(float16_t x) { + return (log(((float16_t(1.0h) + x) / (float16_t(1.0h) - x))) * float16_t(0.5h)); +} + +void atanh_d2d8cd() { + float16_t res = tint_atanh(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_d2d8cd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_d2d8cd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_d2d8cd(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001760B391820(1,1-9): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/builtins/gen/literal/atanh/d2d8cd.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atanh/d2d8cd.wgsl.expected.glsl new file mode 100644 index 0000000000..3077ea81d3 --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/d2d8cd.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +float16_t tint_atanh(float16_t x) { + return ((x >= 1.0hf) ? 0.0hf : atanh(x)); +} + +void atanh_d2d8cd() { + float16_t res = tint_atanh(0.0hf); +} + +vec4 vertex_main() { + atanh_d2d8cd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +float16_t tint_atanh(float16_t x) { + return ((x >= 1.0hf) ? 0.0hf : atanh(x)); +} + +void atanh_d2d8cd() { + float16_t res = tint_atanh(0.0hf); +} + +void fragment_main() { + atanh_d2d8cd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +float16_t tint_atanh(float16_t x) { + return ((x >= 1.0hf) ? 0.0hf : atanh(x)); +} + +void atanh_d2d8cd() { + float16_t res = tint_atanh(0.0hf); +} + +void compute_main() { + atanh_d2d8cd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/atanh/d2d8cd.wgsl.expected.msl b/test/tint/builtins/gen/literal/atanh/d2d8cd.wgsl.expected.msl new file mode 100644 index 0000000000..80f097f257 --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/d2d8cd.wgsl.expected.msl @@ -0,0 +1,37 @@ +#include + +using namespace metal; +half tint_atanh(half x) { + return select(atanh(x), 0.0h, (x >= 1.0h)); +} + +void atanh_d2d8cd() { + half res = tint_atanh(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atanh_d2d8cd(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atanh_d2d8cd(); + return; +} + +kernel void compute_main() { + atanh_d2d8cd(); + return; +} + diff --git a/test/tint/builtins/gen/literal/atanh/d2d8cd.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atanh/d2d8cd.wgsl.expected.spvasm new file mode 100644 index 0000000000..82b8e8bc4b --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/d2d8cd.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_atanh "tint_atanh" + OpName %x "x" + OpName %atanh_d2d8cd "atanh_d2d8cd" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %half = OpTypeFloat 16 + %9 = OpTypeFunction %half %half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %bool = OpTypeBool + %18 = OpConstantNull %half + %void = OpTypeVoid + %21 = OpTypeFunction %void +%_ptr_Function_half = OpTypePointer Function %half + %28 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tint_atanh = OpFunction %half None %9 + %x = OpFunctionParameter %half + %13 = OpLabel + %16 = OpFOrdGreaterThanEqual %bool %x %half_0x1p_0 + %19 = OpExtInst %half %20 Atanh %x + %14 = OpSelect %half %16 %18 %19 + OpReturnValue %14 + OpFunctionEnd +%atanh_d2d8cd = OpFunction %void None %21 + %24 = OpLabel + %res = OpVariable %_ptr_Function_half Function %18 + %25 = OpFunctionCall %half %tint_atanh %18 + OpStore %res %25 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %atanh_d2d8cd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %21 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %21 + %37 = OpLabel + %38 = OpFunctionCall %void %atanh_d2d8cd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %21 + %40 = OpLabel + %41 = OpFunctionCall %void %atanh_d2d8cd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atanh/d2d8cd.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atanh/d2d8cd.wgsl.expected.wgsl new file mode 100644 index 0000000000..7f127435af --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/d2d8cd.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn atanh_d2d8cd() { + var res : f16 = atanh(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_d2d8cd(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_d2d8cd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_d2d8cd(); +} diff --git a/test/tint/builtins/gen/literal/atanh/e3b450.wgsl b/test/tint/builtins/gen/literal/atanh/e3b450.wgsl new file mode 100644 index 0000000000..23c6e104ea --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/e3b450.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atanh(vec<4, f16>) -> vec<4, f16> +fn atanh_e3b450() { + var res: vec4 = atanh(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_e3b450(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_e3b450(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_e3b450(); +} diff --git a/test/tint/builtins/gen/literal/atanh/e3b450.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atanh/e3b450.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ecec215946 --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/e3b450.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +vector tint_atanh(vector x) { + return (log(((float16_t(1.0h) + x) / (float16_t(1.0h) - x))) * float16_t(0.5h)); +} + +void atanh_e3b450() { + vector res = tint_atanh((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_e3b450(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_e3b450(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_e3b450(); + return; +} diff --git a/test/tint/builtins/gen/literal/atanh/e3b450.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atanh/e3b450.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..96b829b9ff --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/e3b450.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +vector tint_atanh(vector x) { + return (log(((float16_t(1.0h) + x) / (float16_t(1.0h) - x))) * float16_t(0.5h)); +} + +void atanh_e3b450() { + vector res = tint_atanh((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_e3b450(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_e3b450(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_e3b450(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000176443384D0(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/atanh/e3b450.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atanh/e3b450.wgsl.expected.glsl new file mode 100644 index 0000000000..32a26fcce4 --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/e3b450.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec4 tint_atanh(f16vec4 x) { + return mix(atanh(x), f16vec4(0.0hf), greaterThanEqual(x, f16vec4(1.0hf))); +} + +void atanh_e3b450() { + f16vec4 res = tint_atanh(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + atanh_e3b450(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec4 tint_atanh(f16vec4 x) { + return mix(atanh(x), f16vec4(0.0hf), greaterThanEqual(x, f16vec4(1.0hf))); +} + +void atanh_e3b450() { + f16vec4 res = tint_atanh(f16vec4(0.0hf)); +} + +void fragment_main() { + atanh_e3b450(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec4 tint_atanh(f16vec4 x) { + return mix(atanh(x), f16vec4(0.0hf), greaterThanEqual(x, f16vec4(1.0hf))); +} + +void atanh_e3b450() { + f16vec4 res = tint_atanh(f16vec4(0.0hf)); +} + +void compute_main() { + atanh_e3b450(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/atanh/e3b450.wgsl.expected.msl b/test/tint/builtins/gen/literal/atanh/e3b450.wgsl.expected.msl new file mode 100644 index 0000000000..8528cf7e4b --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/e3b450.wgsl.expected.msl @@ -0,0 +1,37 @@ +#include + +using namespace metal; +half4 tint_atanh(half4 x) { + return select(atanh(x), half4(0.0h), (x >= half4(1.0h))); +} + +void atanh_e3b450() { + half4 res = tint_atanh(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atanh_e3b450(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atanh_e3b450(); + return; +} + +kernel void compute_main() { + atanh_e3b450(); + return; +} + diff --git a/test/tint/builtins/gen/literal/atanh/e3b450.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atanh/e3b450.wgsl.expected.spvasm new file mode 100644 index 0000000000..7aba5f8cbf --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/e3b450.wgsl.expected.spvasm @@ -0,0 +1,87 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_atanh "tint_atanh" + OpName %x "x" + OpName %atanh_e3b450 "atanh_e3b450" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %9 = OpTypeFunction %v4half %v4half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %17 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %21 = OpConstantNull %v4half + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_Function_v4half = OpTypePointer Function %v4half + %31 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tint_atanh = OpFunction %v4half None %9 + %x = OpFunctionParameter %v4half + %14 = OpLabel + %18 = OpFOrdGreaterThanEqual %v4bool %x %17 + %22 = OpExtInst %v4half %23 Atanh %x + %15 = OpSelect %v4half %18 %21 %22 + OpReturnValue %15 + OpFunctionEnd +%atanh_e3b450 = OpFunction %void None %24 + %27 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %21 + %28 = OpFunctionCall %v4half %tint_atanh %21 + OpStore %res %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %31 + %33 = OpLabel + %34 = OpFunctionCall %void %atanh_e3b450 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %24 + %36 = OpLabel + %37 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %37 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %24 + %40 = OpLabel + %41 = OpFunctionCall %void %atanh_e3b450 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %24 + %43 = OpLabel + %44 = OpFunctionCall %void %atanh_e3b450 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atanh/e3b450.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atanh/e3b450.wgsl.expected.wgsl new file mode 100644 index 0000000000..d0a85777af --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/e3b450.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn atanh_e3b450() { + var res : vec4 = atanh(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_e3b450(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_e3b450(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_e3b450(); +} diff --git a/test/tint/builtins/gen/literal/atanh/ec4b06.wgsl b/test/tint/builtins/gen/literal/atanh/ec4b06.wgsl new file mode 100644 index 0000000000..708c3b3732 --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/ec4b06.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atanh(vec<3, f16>) -> vec<3, f16> +fn atanh_ec4b06() { + var res: vec3 = atanh(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_ec4b06(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_ec4b06(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_ec4b06(); +} diff --git a/test/tint/builtins/gen/literal/atanh/ec4b06.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atanh/ec4b06.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0b739c0f20 --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/ec4b06.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +vector tint_atanh(vector x) { + return (log(((float16_t(1.0h) + x) / (float16_t(1.0h) - x))) * float16_t(0.5h)); +} + +void atanh_ec4b06() { + vector res = tint_atanh((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_ec4b06(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_ec4b06(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_ec4b06(); + return; +} diff --git a/test/tint/builtins/gen/literal/atanh/ec4b06.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atanh/ec4b06.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..46881a0ccb --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/ec4b06.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +vector tint_atanh(vector x) { + return (log(((float16_t(1.0h) + x) / (float16_t(1.0h) - x))) * float16_t(0.5h)); +} + +void atanh_ec4b06() { + vector res = tint_atanh((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_ec4b06(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_ec4b06(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_ec4b06(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001899EE63220(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/atanh/ec4b06.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atanh/ec4b06.wgsl.expected.glsl new file mode 100644 index 0000000000..6c8e11bd52 --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/ec4b06.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec3 tint_atanh(f16vec3 x) { + return mix(atanh(x), f16vec3(0.0hf), greaterThanEqual(x, f16vec3(1.0hf))); +} + +void atanh_ec4b06() { + f16vec3 res = tint_atanh(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + atanh_ec4b06(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec3 tint_atanh(f16vec3 x) { + return mix(atanh(x), f16vec3(0.0hf), greaterThanEqual(x, f16vec3(1.0hf))); +} + +void atanh_ec4b06() { + f16vec3 res = tint_atanh(f16vec3(0.0hf)); +} + +void fragment_main() { + atanh_ec4b06(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec3 tint_atanh(f16vec3 x) { + return mix(atanh(x), f16vec3(0.0hf), greaterThanEqual(x, f16vec3(1.0hf))); +} + +void atanh_ec4b06() { + f16vec3 res = tint_atanh(f16vec3(0.0hf)); +} + +void compute_main() { + atanh_ec4b06(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/atanh/ec4b06.wgsl.expected.msl b/test/tint/builtins/gen/literal/atanh/ec4b06.wgsl.expected.msl new file mode 100644 index 0000000000..e42af54c7e --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/ec4b06.wgsl.expected.msl @@ -0,0 +1,37 @@ +#include + +using namespace metal; +half3 tint_atanh(half3 x) { + return select(atanh(x), half3(0.0h), (x >= half3(1.0h))); +} + +void atanh_ec4b06() { + half3 res = tint_atanh(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atanh_ec4b06(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atanh_ec4b06(); + return; +} + +kernel void compute_main() { + atanh_ec4b06(); + return; +} + diff --git a/test/tint/builtins/gen/literal/atanh/ec4b06.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atanh/ec4b06.wgsl.expected.spvasm new file mode 100644 index 0000000000..f8bdc5c7bf --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/ec4b06.wgsl.expected.spvasm @@ -0,0 +1,87 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_atanh "tint_atanh" + OpName %x "x" + OpName %atanh_ec4b06 "atanh_ec4b06" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %9 = OpTypeFunction %v3half %v3half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %17 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %21 = OpConstantNull %v3half + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_Function_v3half = OpTypePointer Function %v3half + %31 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tint_atanh = OpFunction %v3half None %9 + %x = OpFunctionParameter %v3half + %14 = OpLabel + %18 = OpFOrdGreaterThanEqual %v3bool %x %17 + %22 = OpExtInst %v3half %23 Atanh %x + %15 = OpSelect %v3half %18 %21 %22 + OpReturnValue %15 + OpFunctionEnd +%atanh_ec4b06 = OpFunction %void None %24 + %27 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %21 + %28 = OpFunctionCall %v3half %tint_atanh %21 + OpStore %res %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %31 + %33 = OpLabel + %34 = OpFunctionCall %void %atanh_ec4b06 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %24 + %36 = OpLabel + %37 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %37 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %24 + %40 = OpLabel + %41 = OpFunctionCall %void %atanh_ec4b06 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %24 + %43 = OpLabel + %44 = OpFunctionCall %void %atanh_ec4b06 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atanh/ec4b06.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atanh/ec4b06.wgsl.expected.wgsl new file mode 100644 index 0000000000..4570d2ba66 --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/ec4b06.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn atanh_ec4b06() { + var res : vec3 = atanh(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_ec4b06(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_ec4b06(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_ec4b06(); +} diff --git a/test/tint/builtins/gen/literal/ceil/09bf52.wgsl b/test/tint/builtins/gen/literal/ceil/09bf52.wgsl new file mode 100644 index 0000000000..6705f27d4b --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/09bf52.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn ceil(vec<3, f16>) -> vec<3, f16> +fn ceil_09bf52() { + var res: vec3 = ceil(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_09bf52(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_09bf52(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_09bf52(); +} diff --git a/test/tint/builtins/gen/literal/ceil/09bf52.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/ceil/09bf52.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a2d17ace87 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/09bf52.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void ceil_09bf52() { + vector res = ceil((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_09bf52(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_09bf52(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_09bf52(); + return; +} diff --git a/test/tint/builtins/gen/literal/ceil/09bf52.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/ceil/09bf52.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..21a195eba5 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/09bf52.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void ceil_09bf52() { + vector res = ceil((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_09bf52(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_09bf52(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_09bf52(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000013DAD2D1160(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/ceil/09bf52.wgsl.expected.glsl b/test/tint/builtins/gen/literal/ceil/09bf52.wgsl.expected.glsl new file mode 100644 index 0000000000..5a83910aa3 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/09bf52.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ceil_09bf52() { + f16vec3 res = ceil(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + ceil_09bf52(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void ceil_09bf52() { + f16vec3 res = ceil(f16vec3(0.0hf)); +} + +void fragment_main() { + ceil_09bf52(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ceil_09bf52() { + f16vec3 res = ceil(f16vec3(0.0hf)); +} + +void compute_main() { + ceil_09bf52(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/ceil/09bf52.wgsl.expected.msl b/test/tint/builtins/gen/literal/ceil/09bf52.wgsl.expected.msl new file mode 100644 index 0000000000..7d0d6886a8 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/09bf52.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void ceil_09bf52() { + half3 res = ceil(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ceil_09bf52(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ceil_09bf52(); + return; +} + +kernel void compute_main() { + ceil_09bf52(); + return; +} + diff --git a/test/tint/builtins/gen/literal/ceil/09bf52.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/ceil/09bf52.wgsl.expected.spvasm new file mode 100644 index 0000000000..2b871057ac --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/09bf52.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ceil_09bf52 "ceil_09bf52" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%ceil_09bf52 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Ceil %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %ceil_09bf52 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %ceil_09bf52 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %ceil_09bf52 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/ceil/09bf52.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/ceil/09bf52.wgsl.expected.wgsl new file mode 100644 index 0000000000..1d5fc84e33 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/09bf52.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn ceil_09bf52() { + var res : vec3 = ceil(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_09bf52(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_09bf52(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_09bf52(); +} diff --git a/test/tint/builtins/gen/literal/ceil/18c240.wgsl b/test/tint/builtins/gen/literal/ceil/18c240.wgsl new file mode 100644 index 0000000000..002bcdc5fc --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/18c240.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn ceil(vec<2, f16>) -> vec<2, f16> +fn ceil_18c240() { + var res: vec2 = ceil(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_18c240(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_18c240(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_18c240(); +} diff --git a/test/tint/builtins/gen/literal/ceil/18c240.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/ceil/18c240.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0397f161d3 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/18c240.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void ceil_18c240() { + vector res = ceil((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_18c240(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_18c240(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_18c240(); + return; +} diff --git a/test/tint/builtins/gen/literal/ceil/18c240.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/ceil/18c240.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..59bf2e8e13 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/18c240.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void ceil_18c240() { + vector res = ceil((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_18c240(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_18c240(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_18c240(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024369541160(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/ceil/18c240.wgsl.expected.glsl b/test/tint/builtins/gen/literal/ceil/18c240.wgsl.expected.glsl new file mode 100644 index 0000000000..b4375a2a31 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/18c240.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ceil_18c240() { + f16vec2 res = ceil(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + ceil_18c240(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void ceil_18c240() { + f16vec2 res = ceil(f16vec2(0.0hf)); +} + +void fragment_main() { + ceil_18c240(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ceil_18c240() { + f16vec2 res = ceil(f16vec2(0.0hf)); +} + +void compute_main() { + ceil_18c240(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/ceil/18c240.wgsl.expected.msl b/test/tint/builtins/gen/literal/ceil/18c240.wgsl.expected.msl new file mode 100644 index 0000000000..b656d4c41e --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/18c240.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void ceil_18c240() { + half2 res = ceil(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ceil_18c240(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ceil_18c240(); + return; +} + +kernel void compute_main() { + ceil_18c240(); + return; +} + diff --git a/test/tint/builtins/gen/literal/ceil/18c240.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/ceil/18c240.wgsl.expected.spvasm new file mode 100644 index 0000000000..757b0b4fc5 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/18c240.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ceil_18c240 "ceil_18c240" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%ceil_18c240 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Ceil %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %ceil_18c240 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %ceil_18c240 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %ceil_18c240 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/ceil/18c240.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/ceil/18c240.wgsl.expected.wgsl new file mode 100644 index 0000000000..dad05fe866 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/18c240.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn ceil_18c240() { + var res : vec2 = ceil(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_18c240(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_18c240(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_18c240(); +} diff --git a/test/tint/builtins/gen/literal/ceil/4bca2a.wgsl b/test/tint/builtins/gen/literal/ceil/4bca2a.wgsl new file mode 100644 index 0000000000..0e7ce3cbf9 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/4bca2a.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn ceil(vec<4, f16>) -> vec<4, f16> +fn ceil_4bca2a() { + var res: vec4 = ceil(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_4bca2a(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_4bca2a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_4bca2a(); +} diff --git a/test/tint/builtins/gen/literal/ceil/4bca2a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/ceil/4bca2a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..10c1d29622 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/4bca2a.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void ceil_4bca2a() { + vector res = ceil((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_4bca2a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_4bca2a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_4bca2a(); + return; +} diff --git a/test/tint/builtins/gen/literal/ceil/4bca2a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/ceil/4bca2a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9b9adc420c --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/4bca2a.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void ceil_4bca2a() { + vector res = ceil((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_4bca2a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_4bca2a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_4bca2a(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000016D987AB790(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/ceil/4bca2a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/ceil/4bca2a.wgsl.expected.glsl new file mode 100644 index 0000000000..4792e790cf --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/4bca2a.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ceil_4bca2a() { + f16vec4 res = ceil(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + ceil_4bca2a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void ceil_4bca2a() { + f16vec4 res = ceil(f16vec4(0.0hf)); +} + +void fragment_main() { + ceil_4bca2a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ceil_4bca2a() { + f16vec4 res = ceil(f16vec4(0.0hf)); +} + +void compute_main() { + ceil_4bca2a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/ceil/4bca2a.wgsl.expected.msl b/test/tint/builtins/gen/literal/ceil/4bca2a.wgsl.expected.msl new file mode 100644 index 0000000000..63fa1e16cf --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/4bca2a.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void ceil_4bca2a() { + half4 res = ceil(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ceil_4bca2a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ceil_4bca2a(); + return; +} + +kernel void compute_main() { + ceil_4bca2a(); + return; +} + diff --git a/test/tint/builtins/gen/literal/ceil/4bca2a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/ceil/4bca2a.wgsl.expected.spvasm new file mode 100644 index 0000000000..65f288bc2d --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/4bca2a.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ceil_4bca2a "ceil_4bca2a" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%ceil_4bca2a = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Ceil %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %ceil_4bca2a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %ceil_4bca2a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %ceil_4bca2a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/ceil/4bca2a.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/ceil/4bca2a.wgsl.expected.wgsl new file mode 100644 index 0000000000..881715fa57 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/4bca2a.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn ceil_4bca2a() { + var res : vec4 = ceil(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_4bca2a(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_4bca2a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_4bca2a(); +} diff --git a/test/tint/builtins/gen/literal/ceil/f3f889.wgsl b/test/tint/builtins/gen/literal/ceil/f3f889.wgsl new file mode 100644 index 0000000000..439e88e183 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/f3f889.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn ceil(f16) -> f16 +fn ceil_f3f889() { + var res: f16 = ceil(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_f3f889(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_f3f889(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_f3f889(); +} diff --git a/test/tint/builtins/gen/literal/ceil/f3f889.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/ceil/f3f889.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b9cee87649 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/f3f889.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void ceil_f3f889() { + float16_t res = ceil(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_f3f889(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_f3f889(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_f3f889(); + return; +} diff --git a/test/tint/builtins/gen/literal/ceil/f3f889.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/ceil/f3f889.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b743e2f75e --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/f3f889.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void ceil_f3f889() { + float16_t res = ceil(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_f3f889(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_f3f889(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_f3f889(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000190A1B47CF0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000190A1B47CF0(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/ceil/f3f889.wgsl.expected.glsl b/test/tint/builtins/gen/literal/ceil/f3f889.wgsl.expected.glsl new file mode 100644 index 0000000000..c34111a354 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/f3f889.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ceil_f3f889() { + float16_t res = ceil(0.0hf); +} + +vec4 vertex_main() { + ceil_f3f889(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void ceil_f3f889() { + float16_t res = ceil(0.0hf); +} + +void fragment_main() { + ceil_f3f889(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ceil_f3f889() { + float16_t res = ceil(0.0hf); +} + +void compute_main() { + ceil_f3f889(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/ceil/f3f889.wgsl.expected.msl b/test/tint/builtins/gen/literal/ceil/f3f889.wgsl.expected.msl new file mode 100644 index 0000000000..2bfecc6ad6 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/f3f889.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void ceil_f3f889() { + half res = ceil(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ceil_f3f889(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ceil_f3f889(); + return; +} + +kernel void compute_main() { + ceil_f3f889(); + return; +} + diff --git a/test/tint/builtins/gen/literal/ceil/f3f889.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/ceil/f3f889.wgsl.expected.spvasm new file mode 100644 index 0000000000..b50e1adcb8 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/f3f889.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ceil_f3f889 "ceil_f3f889" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%ceil_f3f889 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Ceil %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %ceil_f3f889 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %ceil_f3f889 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %ceil_f3f889 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/ceil/f3f889.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/ceil/f3f889.wgsl.expected.wgsl new file mode 100644 index 0000000000..288d3c2882 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/f3f889.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn ceil_f3f889() { + var res : f16 = ceil(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_f3f889(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_f3f889(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_f3f889(); +} diff --git a/test/tint/builtins/gen/literal/clamp/235b29.wgsl b/test/tint/builtins/gen/literal/clamp/235b29.wgsl new file mode 100644 index 0000000000..fcb634e934 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/235b29.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn clamp(vec<2, f16>, vec<2, f16>, vec<2, f16>) -> vec<2, f16> +fn clamp_235b29() { + var res: vec2 = clamp(vec2(f16()), vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_235b29(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_235b29(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_235b29(); +} diff --git a/test/tint/builtins/gen/literal/clamp/235b29.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/clamp/235b29.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..02fc88275c --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/235b29.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void clamp_235b29() { + vector res = (float16_t(0.0h)).xx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_235b29(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_235b29(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_235b29(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/235b29.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/clamp/235b29.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d8e438289d --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/235b29.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void clamp_235b29() { + vector res = (float16_t(0.0h)).xx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_235b29(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_235b29(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_235b29(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000017FE0738160(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/clamp/235b29.wgsl.expected.glsl b/test/tint/builtins/gen/literal/clamp/235b29.wgsl.expected.glsl new file mode 100644 index 0000000000..3a90e739c0 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/235b29.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void clamp_235b29() { + f16vec2 res = f16vec2(0.0hf); +} + +vec4 vertex_main() { + clamp_235b29(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void clamp_235b29() { + f16vec2 res = f16vec2(0.0hf); +} + +void fragment_main() { + clamp_235b29(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void clamp_235b29() { + f16vec2 res = f16vec2(0.0hf); +} + +void compute_main() { + clamp_235b29(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/235b29.wgsl.expected.msl b/test/tint/builtins/gen/literal/clamp/235b29.wgsl.expected.msl new file mode 100644 index 0000000000..cd5723f4c5 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/235b29.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void clamp_235b29() { + half2 res = half2(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_235b29(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_235b29(); + return; +} + +kernel void compute_main() { + clamp_235b29(); + return; +} + diff --git a/test/tint/builtins/gen/literal/clamp/235b29.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/clamp/235b29.wgsl.expected.spvasm new file mode 100644 index 0000000000..70a6d4920f --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/235b29.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_235b29 "clamp_235b29" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %18 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_235b29 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %18 + %20 = OpLabel + %21 = OpFunctionCall %void %clamp_235b29 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %23 = OpLabel + %24 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %24 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %clamp_235b29 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %clamp_235b29 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/clamp/235b29.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/clamp/235b29.wgsl.expected.wgsl new file mode 100644 index 0000000000..ba5303c1c6 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/235b29.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn clamp_235b29() { + var res : vec2 = clamp(vec2(f16()), vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_235b29(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_235b29(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_235b29(); +} diff --git a/test/tint/builtins/gen/literal/clamp/2c251b.wgsl b/test/tint/builtins/gen/literal/clamp/2c251b.wgsl new file mode 100644 index 0000000000..9c5f382a57 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/2c251b.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn clamp(vec<4, f16>, vec<4, f16>, vec<4, f16>) -> vec<4, f16> +fn clamp_2c251b() { + var res: vec4 = clamp(vec4(f16()), vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_2c251b(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_2c251b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_2c251b(); +} diff --git a/test/tint/builtins/gen/literal/clamp/2c251b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/clamp/2c251b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..79e81c9619 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/2c251b.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void clamp_2c251b() { + vector res = (float16_t(0.0h)).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_2c251b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_2c251b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_2c251b(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/2c251b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/clamp/2c251b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..20423bbd1e --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/2c251b.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void clamp_2c251b() { + vector res = (float16_t(0.0h)).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_2c251b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_2c251b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_2c251b(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000225C8376D90(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/clamp/2c251b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/clamp/2c251b.wgsl.expected.glsl new file mode 100644 index 0000000000..e1cfbbe948 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/2c251b.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void clamp_2c251b() { + f16vec4 res = f16vec4(0.0hf); +} + +vec4 vertex_main() { + clamp_2c251b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void clamp_2c251b() { + f16vec4 res = f16vec4(0.0hf); +} + +void fragment_main() { + clamp_2c251b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void clamp_2c251b() { + f16vec4 res = f16vec4(0.0hf); +} + +void compute_main() { + clamp_2c251b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/2c251b.wgsl.expected.msl b/test/tint/builtins/gen/literal/clamp/2c251b.wgsl.expected.msl new file mode 100644 index 0000000000..5168d3d93d --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/2c251b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void clamp_2c251b() { + half4 res = half4(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_2c251b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_2c251b(); + return; +} + +kernel void compute_main() { + clamp_2c251b(); + return; +} + diff --git a/test/tint/builtins/gen/literal/clamp/2c251b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/clamp/2c251b.wgsl.expected.spvasm new file mode 100644 index 0000000000..8c74f7d3cb --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/2c251b.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_2c251b "clamp_2c251b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %18 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_2c251b = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %18 + %20 = OpLabel + %21 = OpFunctionCall %void %clamp_2c251b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %23 = OpLabel + %24 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %24 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %clamp_2c251b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %clamp_2c251b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/clamp/2c251b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/clamp/2c251b.wgsl.expected.wgsl new file mode 100644 index 0000000000..15be6c8080 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/2c251b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn clamp_2c251b() { + var res : vec4 = clamp(vec4(f16()), vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_2c251b(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_2c251b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_2c251b(); +} diff --git a/test/tint/builtins/gen/literal/clamp/553ffb.wgsl b/test/tint/builtins/gen/literal/clamp/553ffb.wgsl new file mode 100644 index 0000000000..b6f3eb9257 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/553ffb.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn clamp(f16, f16, f16) -> f16 +fn clamp_553ffb() { + var res: f16 = clamp(f16(), f16(), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_553ffb(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_553ffb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_553ffb(); +} diff --git a/test/tint/builtins/gen/literal/clamp/553ffb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/clamp/553ffb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0343bfd45b --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/553ffb.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void clamp_553ffb() { + float16_t res = float16_t(0.0h); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_553ffb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_553ffb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_553ffb(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/553ffb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/clamp/553ffb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b397e5f17f --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/553ffb.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void clamp_553ffb() { + float16_t res = float16_t(0.0h); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_553ffb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_553ffb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_553ffb(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002581C620540(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002581C620540(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/clamp/553ffb.wgsl.expected.glsl b/test/tint/builtins/gen/literal/clamp/553ffb.wgsl.expected.glsl new file mode 100644 index 0000000000..060c13f3c4 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/553ffb.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void clamp_553ffb() { + float16_t res = 0.0hf; +} + +vec4 vertex_main() { + clamp_553ffb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void clamp_553ffb() { + float16_t res = 0.0hf; +} + +void fragment_main() { + clamp_553ffb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void clamp_553ffb() { + float16_t res = 0.0hf; +} + +void compute_main() { + clamp_553ffb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/553ffb.wgsl.expected.msl b/test/tint/builtins/gen/literal/clamp/553ffb.wgsl.expected.msl new file mode 100644 index 0000000000..34e8f69f00 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/553ffb.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void clamp_553ffb() { + half res = 0.0h; +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_553ffb(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_553ffb(); + return; +} + +kernel void compute_main() { + clamp_553ffb(); + return; +} + diff --git a/test/tint/builtins/gen/literal/clamp/553ffb.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/clamp/553ffb.wgsl.expected.spvasm new file mode 100644 index 0000000000..c4abe0dd4a --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/553ffb.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_553ffb "clamp_553ffb" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %17 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_553ffb = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %res %14 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %17 + %19 = OpLabel + %20 = OpFunctionCall %void %clamp_553ffb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %22 = OpLabel + %23 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %23 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %void %clamp_553ffb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %clamp_553ffb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/clamp/553ffb.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/clamp/553ffb.wgsl.expected.wgsl new file mode 100644 index 0000000000..48f3ab3692 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/553ffb.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn clamp_553ffb() { + var res : f16 = clamp(f16(), f16(), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_553ffb(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_553ffb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_553ffb(); +} diff --git a/test/tint/builtins/gen/literal/clamp/b195eb.wgsl b/test/tint/builtins/gen/literal/clamp/b195eb.wgsl new file mode 100644 index 0000000000..f03c28a98b --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/b195eb.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn clamp(vec<3, f16>, vec<3, f16>, vec<3, f16>) -> vec<3, f16> +fn clamp_b195eb() { + var res: vec3 = clamp(vec3(f16()), vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_b195eb(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_b195eb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_b195eb(); +} diff --git a/test/tint/builtins/gen/literal/clamp/b195eb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/clamp/b195eb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c94442f095 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/b195eb.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void clamp_b195eb() { + vector res = (float16_t(0.0h)).xxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_b195eb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_b195eb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_b195eb(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/b195eb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/clamp/b195eb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..823e2b2f01 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/b195eb.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void clamp_b195eb() { + vector res = (float16_t(0.0h)).xxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_b195eb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_b195eb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_b195eb(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F44BFDB000(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/clamp/b195eb.wgsl.expected.glsl b/test/tint/builtins/gen/literal/clamp/b195eb.wgsl.expected.glsl new file mode 100644 index 0000000000..500588f1fb --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/b195eb.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void clamp_b195eb() { + f16vec3 res = f16vec3(0.0hf); +} + +vec4 vertex_main() { + clamp_b195eb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void clamp_b195eb() { + f16vec3 res = f16vec3(0.0hf); +} + +void fragment_main() { + clamp_b195eb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void clamp_b195eb() { + f16vec3 res = f16vec3(0.0hf); +} + +void compute_main() { + clamp_b195eb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/b195eb.wgsl.expected.msl b/test/tint/builtins/gen/literal/clamp/b195eb.wgsl.expected.msl new file mode 100644 index 0000000000..58d111aa08 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/b195eb.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void clamp_b195eb() { + half3 res = half3(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_b195eb(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_b195eb(); + return; +} + +kernel void compute_main() { + clamp_b195eb(); + return; +} + diff --git a/test/tint/builtins/gen/literal/clamp/b195eb.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/clamp/b195eb.wgsl.expected.spvasm new file mode 100644 index 0000000000..4beb74d53a --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/b195eb.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_b195eb "clamp_b195eb" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %18 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_b195eb = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %18 + %20 = OpLabel + %21 = OpFunctionCall %void %clamp_b195eb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %23 = OpLabel + %24 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %24 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %clamp_b195eb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %clamp_b195eb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/clamp/b195eb.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/clamp/b195eb.wgsl.expected.wgsl new file mode 100644 index 0000000000..bd88ab4fed --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/b195eb.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn clamp_b195eb() { + var res : vec3 = clamp(vec3(f16()), vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_b195eb(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_b195eb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_b195eb(); +} diff --git a/test/tint/builtins/gen/literal/cos/0835a8.wgsl b/test/tint/builtins/gen/literal/cos/0835a8.wgsl new file mode 100644 index 0000000000..07bd88811a --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/0835a8.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn cos(vec<3, f16>) -> vec<3, f16> +fn cos_0835a8() { + var res: vec3 = cos(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_0835a8(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_0835a8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_0835a8(); +} diff --git a/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ef1328a2f3 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void cos_0835a8() { + vector res = cos((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_0835a8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_0835a8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_0835a8(); + return; +} diff --git a/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..966a5e3f4f --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void cos_0835a8() { + vector res = cos((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_0835a8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_0835a8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_0835a8(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000012E9639AC20(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.glsl new file mode 100644 index 0000000000..f8f69c4a1d --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cos_0835a8() { + f16vec3 res = cos(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + cos_0835a8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void cos_0835a8() { + f16vec3 res = cos(f16vec3(0.0hf)); +} + +void fragment_main() { + cos_0835a8(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cos_0835a8() { + f16vec3 res = cos(f16vec3(0.0hf)); +} + +void compute_main() { + cos_0835a8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.msl b/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.msl new file mode 100644 index 0000000000..790a32d15d --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void cos_0835a8() { + half3 res = cos(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cos_0835a8(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cos_0835a8(); + return; +} + +kernel void compute_main() { + cos_0835a8(); + return; +} + diff --git a/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.spvasm new file mode 100644 index 0000000000..d151e5cefd --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cos_0835a8 "cos_0835a8" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %cos_0835a8 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Cos %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %cos_0835a8 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %cos_0835a8 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %cos_0835a8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.wgsl new file mode 100644 index 0000000000..94f028ab80 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn cos_0835a8() { + var res : vec3 = cos(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_0835a8(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_0835a8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_0835a8(); +} diff --git a/test/tint/builtins/gen/literal/cos/0a89f7.wgsl b/test/tint/builtins/gen/literal/cos/0a89f7.wgsl new file mode 100644 index 0000000000..6bcbb878a1 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/0a89f7.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn cos(vec<4, f16>) -> vec<4, f16> +fn cos_0a89f7() { + var res: vec4 = cos(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_0a89f7(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_0a89f7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_0a89f7(); +} diff --git a/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2a00fd01fa --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void cos_0a89f7() { + vector res = cos((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_0a89f7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_0a89f7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_0a89f7(); + return; +} diff --git a/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..83264945f3 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void cos_0a89f7() { + vector res = cos((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_0a89f7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_0a89f7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_0a89f7(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000016E7F3887E0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.glsl new file mode 100644 index 0000000000..9daaaff23e --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cos_0a89f7() { + f16vec4 res = cos(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + cos_0a89f7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void cos_0a89f7() { + f16vec4 res = cos(f16vec4(0.0hf)); +} + +void fragment_main() { + cos_0a89f7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cos_0a89f7() { + f16vec4 res = cos(f16vec4(0.0hf)); +} + +void compute_main() { + cos_0a89f7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.msl b/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.msl new file mode 100644 index 0000000000..fe465acd64 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void cos_0a89f7() { + half4 res = cos(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cos_0a89f7(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cos_0a89f7(); + return; +} + +kernel void compute_main() { + cos_0a89f7(); + return; +} + diff --git a/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.spvasm new file mode 100644 index 0000000000..5f966233f3 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cos_0a89f7 "cos_0a89f7" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %cos_0a89f7 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Cos %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %cos_0a89f7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %cos_0a89f7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %cos_0a89f7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.wgsl new file mode 100644 index 0000000000..536f85f268 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn cos_0a89f7() { + var res : vec4 = cos(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_0a89f7(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_0a89f7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_0a89f7(); +} diff --git a/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl b/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl new file mode 100644 index 0000000000..c233d3c67d --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn cos(vec<2, f16>) -> vec<2, f16> +fn cos_5bc2c6() { + var res: vec2 = cos(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_5bc2c6(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_5bc2c6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_5bc2c6(); +} diff --git a/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a27a2293f5 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void cos_5bc2c6() { + vector res = cos((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_5bc2c6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_5bc2c6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_5bc2c6(); + return; +} diff --git a/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f3677eee25 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void cos_5bc2c6() { + vector res = cos((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_5bc2c6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_5bc2c6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_5bc2c6(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024E8E5A87E0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.glsl new file mode 100644 index 0000000000..6da1c94dd8 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cos_5bc2c6() { + f16vec2 res = cos(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + cos_5bc2c6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void cos_5bc2c6() { + f16vec2 res = cos(f16vec2(0.0hf)); +} + +void fragment_main() { + cos_5bc2c6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cos_5bc2c6() { + f16vec2 res = cos(f16vec2(0.0hf)); +} + +void compute_main() { + cos_5bc2c6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.msl b/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.msl new file mode 100644 index 0000000000..91434e1496 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void cos_5bc2c6() { + half2 res = cos(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cos_5bc2c6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cos_5bc2c6(); + return; +} + +kernel void compute_main() { + cos_5bc2c6(); + return; +} + diff --git a/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.spvasm new file mode 100644 index 0000000000..278c3e1150 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cos_5bc2c6 "cos_5bc2c6" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %cos_5bc2c6 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Cos %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %cos_5bc2c6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %cos_5bc2c6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %cos_5bc2c6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.wgsl new file mode 100644 index 0000000000..2010e95cbd --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn cos_5bc2c6() { + var res : vec2 = cos(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_5bc2c6(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_5bc2c6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_5bc2c6(); +} diff --git a/test/tint/builtins/gen/literal/cos/fc047d.wgsl b/test/tint/builtins/gen/literal/cos/fc047d.wgsl new file mode 100644 index 0000000000..630e2fd3a3 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/fc047d.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn cos(f16) -> f16 +fn cos_fc047d() { + var res: f16 = cos(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_fc047d(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_fc047d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_fc047d(); +} diff --git a/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f240327915 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void cos_fc047d() { + float16_t res = cos(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_fc047d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_fc047d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_fc047d(); + return; +} diff --git a/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e33a4d6b72 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void cos_fc047d() { + float16_t res = cos(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_fc047d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_fc047d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_fc047d(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000015329BF7D10(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000015329BF7D10(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.glsl new file mode 100644 index 0000000000..01af81ddf0 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cos_fc047d() { + float16_t res = cos(0.0hf); +} + +vec4 vertex_main() { + cos_fc047d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void cos_fc047d() { + float16_t res = cos(0.0hf); +} + +void fragment_main() { + cos_fc047d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cos_fc047d() { + float16_t res = cos(0.0hf); +} + +void compute_main() { + cos_fc047d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.msl b/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.msl new file mode 100644 index 0000000000..e38b8e955a --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void cos_fc047d() { + half res = cos(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cos_fc047d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cos_fc047d(); + return; +} + +kernel void compute_main() { + cos_fc047d(); + return; +} + diff --git a/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.spvasm new file mode 100644 index 0000000000..d4c73fe0c1 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cos_fc047d "cos_fc047d" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %cos_fc047d = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Cos %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %cos_fc047d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %cos_fc047d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %cos_fc047d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.wgsl new file mode 100644 index 0000000000..5671f4cc1e --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn cos_fc047d() { + var res : f16 = cos(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_fc047d(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_fc047d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_fc047d(); +} diff --git a/test/tint/builtins/gen/literal/cosh/2ed778.wgsl b/test/tint/builtins/gen/literal/cosh/2ed778.wgsl new file mode 100644 index 0000000000..a8fcdf8a37 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/2ed778.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn cosh(f16) -> f16 +fn cosh_2ed778() { + var res: f16 = cosh(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_2ed778(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_2ed778(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_2ed778(); +} diff --git a/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f032f20dea --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void cosh_2ed778() { + float16_t res = cosh(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_2ed778(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_2ed778(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_2ed778(); + return; +} diff --git a/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..423dd17d62 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void cosh_2ed778() { + float16_t res = cosh(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_2ed778(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_2ed778(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_2ed778(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021F3BD88850(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021F3BD88850(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.glsl new file mode 100644 index 0000000000..798c9bcb64 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cosh_2ed778() { + float16_t res = cosh(0.0hf); +} + +vec4 vertex_main() { + cosh_2ed778(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void cosh_2ed778() { + float16_t res = cosh(0.0hf); +} + +void fragment_main() { + cosh_2ed778(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cosh_2ed778() { + float16_t res = cosh(0.0hf); +} + +void compute_main() { + cosh_2ed778(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.msl b/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.msl new file mode 100644 index 0000000000..5fa15c3821 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void cosh_2ed778() { + half res = cosh(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cosh_2ed778(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cosh_2ed778(); + return; +} + +kernel void compute_main() { + cosh_2ed778(); + return; +} + diff --git a/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.spvasm new file mode 100644 index 0000000000..bba06a4533 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cosh_2ed778 "cosh_2ed778" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%cosh_2ed778 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Cosh %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %cosh_2ed778 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %cosh_2ed778 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %cosh_2ed778 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.wgsl new file mode 100644 index 0000000000..00b8f277c9 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn cosh_2ed778() { + var res : f16 = cosh(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_2ed778(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_2ed778(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_2ed778(); +} diff --git a/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl b/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl new file mode 100644 index 0000000000..d1e959aef0 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn cosh(vec<4, f16>) -> vec<4, f16> +fn cosh_3b7bbf() { + var res: vec4 = cosh(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_3b7bbf(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_3b7bbf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_3b7bbf(); +} diff --git a/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ede2f1a20e --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void cosh_3b7bbf() { + vector res = cosh((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_3b7bbf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_3b7bbf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_3b7bbf(); + return; +} diff --git a/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2e19b88c81 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void cosh_3b7bbf() { + vector res = cosh((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_3b7bbf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_3b7bbf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_3b7bbf(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020A6F400DB0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.glsl new file mode 100644 index 0000000000..73e0dc9272 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cosh_3b7bbf() { + f16vec4 res = cosh(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + cosh_3b7bbf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void cosh_3b7bbf() { + f16vec4 res = cosh(f16vec4(0.0hf)); +} + +void fragment_main() { + cosh_3b7bbf(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cosh_3b7bbf() { + f16vec4 res = cosh(f16vec4(0.0hf)); +} + +void compute_main() { + cosh_3b7bbf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.msl b/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.msl new file mode 100644 index 0000000000..c0d6580131 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void cosh_3b7bbf() { + half4 res = cosh(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cosh_3b7bbf(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cosh_3b7bbf(); + return; +} + +kernel void compute_main() { + cosh_3b7bbf(); + return; +} + diff --git a/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.spvasm new file mode 100644 index 0000000000..da245fd39a --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cosh_3b7bbf "cosh_3b7bbf" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%cosh_3b7bbf = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Cosh %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %cosh_3b7bbf + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %cosh_3b7bbf + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %cosh_3b7bbf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.wgsl new file mode 100644 index 0000000000..09eaedea4c --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn cosh_3b7bbf() { + var res : vec4 = cosh(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_3b7bbf(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_3b7bbf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_3b7bbf(); +} diff --git a/test/tint/builtins/gen/literal/cosh/43b672.wgsl b/test/tint/builtins/gen/literal/cosh/43b672.wgsl new file mode 100644 index 0000000000..a3d55056a0 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/43b672.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn cosh(vec<2, f16>) -> vec<2, f16> +fn cosh_43b672() { + var res: vec2 = cosh(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_43b672(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_43b672(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_43b672(); +} diff --git a/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8b54430cc6 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void cosh_43b672() { + vector res = cosh((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_43b672(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_43b672(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_43b672(); + return; +} diff --git a/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b1f7f46df6 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void cosh_43b672() { + vector res = cosh((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_43b672(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_43b672(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_43b672(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002ACB9EB1160(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.glsl new file mode 100644 index 0000000000..8b04b98826 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cosh_43b672() { + f16vec2 res = cosh(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + cosh_43b672(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void cosh_43b672() { + f16vec2 res = cosh(f16vec2(0.0hf)); +} + +void fragment_main() { + cosh_43b672(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cosh_43b672() { + f16vec2 res = cosh(f16vec2(0.0hf)); +} + +void compute_main() { + cosh_43b672(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.msl b/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.msl new file mode 100644 index 0000000000..697c07981c --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void cosh_43b672() { + half2 res = cosh(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cosh_43b672(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cosh_43b672(); + return; +} + +kernel void compute_main() { + cosh_43b672(); + return; +} + diff --git a/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.spvasm new file mode 100644 index 0000000000..76983acbc7 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cosh_43b672 "cosh_43b672" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%cosh_43b672 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Cosh %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %cosh_43b672 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %cosh_43b672 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %cosh_43b672 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.wgsl new file mode 100644 index 0000000000..6646f2d1dc --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn cosh_43b672() { + var res : vec2 = cosh(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_43b672(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_43b672(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_43b672(); +} diff --git a/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl b/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl new file mode 100644 index 0000000000..99a4004f2a --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn cosh(vec<3, f16>) -> vec<3, f16> +fn cosh_b1b8a0() { + var res: vec3 = cosh(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_b1b8a0(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_b1b8a0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_b1b8a0(); +} diff --git a/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5be4cfe6e4 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void cosh_b1b8a0() { + vector res = cosh((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_b1b8a0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_b1b8a0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_b1b8a0(); + return; +} diff --git a/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f6e2ac145c --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void cosh_b1b8a0() { + vector res = cosh((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_b1b8a0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_b1b8a0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_b1b8a0(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D169B6EAF0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.glsl new file mode 100644 index 0000000000..995b0d7a09 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cosh_b1b8a0() { + f16vec3 res = cosh(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + cosh_b1b8a0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void cosh_b1b8a0() { + f16vec3 res = cosh(f16vec3(0.0hf)); +} + +void fragment_main() { + cosh_b1b8a0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cosh_b1b8a0() { + f16vec3 res = cosh(f16vec3(0.0hf)); +} + +void compute_main() { + cosh_b1b8a0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.msl b/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.msl new file mode 100644 index 0000000000..b426dbb310 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void cosh_b1b8a0() { + half3 res = cosh(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cosh_b1b8a0(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cosh_b1b8a0(); + return; +} + +kernel void compute_main() { + cosh_b1b8a0(); + return; +} + diff --git a/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.spvasm new file mode 100644 index 0000000000..9a5a56621c --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cosh_b1b8a0 "cosh_b1b8a0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%cosh_b1b8a0 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Cosh %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %cosh_b1b8a0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %cosh_b1b8a0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %cosh_b1b8a0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.wgsl new file mode 100644 index 0000000000..bf06df51a6 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn cosh_b1b8a0() { + var res : vec3 = cosh(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_b1b8a0(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_b1b8a0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_b1b8a0(); +} diff --git a/test/tint/builtins/gen/literal/cross/9857cb.wgsl b/test/tint/builtins/gen/literal/cross/9857cb.wgsl new file mode 100644 index 0000000000..ba13074fbd --- /dev/null +++ b/test/tint/builtins/gen/literal/cross/9857cb.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn cross(vec3, vec3) -> vec3 +fn cross_9857cb() { + var res: vec3 = cross(vec3(), vec3()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cross_9857cb(); + return vec4(); +} + +@fragment +fn fragment_main() { + cross_9857cb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cross_9857cb(); +} diff --git a/test/tint/builtins/gen/literal/cross/9857cb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cross/9857cb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..32fcd70771 --- /dev/null +++ b/test/tint/builtins/gen/literal/cross/9857cb.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void cross_9857cb() { + vector res = cross((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cross_9857cb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cross_9857cb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cross_9857cb(); + return; +} diff --git a/test/tint/builtins/gen/literal/cross/9857cb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/cross/9857cb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f6d21a306f --- /dev/null +++ b/test/tint/builtins/gen/literal/cross/9857cb.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void cross_9857cb() { + vector res = cross((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cross_9857cb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cross_9857cb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cross_9857cb(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001ABE1B9A830(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/cross/9857cb.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cross/9857cb.wgsl.expected.glsl new file mode 100644 index 0000000000..dd0311f0e1 --- /dev/null +++ b/test/tint/builtins/gen/literal/cross/9857cb.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cross_9857cb() { + f16vec3 res = cross(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +vec4 vertex_main() { + cross_9857cb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void cross_9857cb() { + f16vec3 res = cross(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +void fragment_main() { + cross_9857cb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cross_9857cb() { + f16vec3 res = cross(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +void compute_main() { + cross_9857cb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/cross/9857cb.wgsl.expected.msl b/test/tint/builtins/gen/literal/cross/9857cb.wgsl.expected.msl new file mode 100644 index 0000000000..3591ad2801 --- /dev/null +++ b/test/tint/builtins/gen/literal/cross/9857cb.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void cross_9857cb() { + half3 res = cross(half3(0.0h), half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cross_9857cb(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cross_9857cb(); + return; +} + +kernel void compute_main() { + cross_9857cb(); + return; +} + diff --git a/test/tint/builtins/gen/literal/cross/9857cb.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cross/9857cb.wgsl.expected.spvasm new file mode 100644 index 0000000000..4552d8ef2e --- /dev/null +++ b/test/tint/builtins/gen/literal/cross/9857cb.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cross_9857cb "cross_9857cb" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%cross_9857cb = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Cross %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %cross_9857cb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %cross_9857cb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %cross_9857cb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cross/9857cb.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cross/9857cb.wgsl.expected.wgsl new file mode 100644 index 0000000000..2d151e84c9 --- /dev/null +++ b/test/tint/builtins/gen/literal/cross/9857cb.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn cross_9857cb() { + var res : vec3 = cross(vec3(), vec3()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cross_9857cb(); + return vec4(); +} + +@fragment +fn fragment_main() { + cross_9857cb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cross_9857cb(); +} diff --git a/test/tint/builtins/gen/literal/degrees/3055d3.wgsl b/test/tint/builtins/gen/literal/degrees/3055d3.wgsl new file mode 100644 index 0000000000..f749565726 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/3055d3.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn degrees(vec<4, f16>) -> vec<4, f16> +fn degrees_3055d3() { + var res: vec4 = degrees(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_3055d3(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_3055d3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_3055d3(); +} diff --git a/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..196bdf52ed --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +vector tint_degrees(vector param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_3055d3() { + vector res = tint_degrees((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_3055d3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_3055d3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_3055d3(); + return; +} diff --git a/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..825ef73d00 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +vector tint_degrees(vector param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_3055d3() { + vector res = tint_degrees((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_3055d3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_3055d3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_3055d3(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020615990520(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.glsl new file mode 100644 index 0000000000..a9e5f5dfdc --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec4 tint_degrees(f16vec4 param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_3055d3() { + f16vec4 res = tint_degrees(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + degrees_3055d3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec4 tint_degrees(f16vec4 param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_3055d3() { + f16vec4 res = tint_degrees(f16vec4(0.0hf)); +} + +void fragment_main() { + degrees_3055d3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec4 tint_degrees(f16vec4 param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_3055d3() { + f16vec4 res = tint_degrees(f16vec4(0.0hf)); +} + +void compute_main() { + degrees_3055d3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.msl b/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.msl new file mode 100644 index 0000000000..2075cbd3c7 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; + +half4 tint_degrees(half4 param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_3055d3() { + half4 res = tint_degrees(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + degrees_3055d3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + degrees_3055d3(); + return; +} + +kernel void compute_main() { + degrees_3055d3(); + return; +} + diff --git a/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.spvasm new file mode 100644 index 0000000000..2d68e4ea46 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %degrees_3055d3 "degrees_3055d3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%degrees_3055d3 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Degrees %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %degrees_3055d3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %degrees_3055d3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %degrees_3055d3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.wgsl new file mode 100644 index 0000000000..58d6ef5441 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn degrees_3055d3() { + var res : vec4 = degrees(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_3055d3(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_3055d3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_3055d3(); +} diff --git a/test/tint/builtins/gen/literal/degrees/5e9805.wgsl b/test/tint/builtins/gen/literal/degrees/5e9805.wgsl new file mode 100644 index 0000000000..cdd9a50ac1 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/5e9805.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn degrees(f16) -> f16 +fn degrees_5e9805() { + var res: f16 = degrees(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_5e9805(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_5e9805(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_5e9805(); +} diff --git a/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..209c5b44bf --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +float16_t tint_degrees(float16_t param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_5e9805() { + float16_t res = tint_degrees(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_5e9805(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_5e9805(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_5e9805(); + return; +} diff --git a/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7647535ea7 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +float16_t tint_degrees(float16_t param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_5e9805() { + float16_t res = tint_degrees(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_5e9805(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_5e9805(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_5e9805(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021D8DD40440(1,1-9): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.glsl b/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.glsl new file mode 100644 index 0000000000..1a87241032 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +float16_t tint_degrees(float16_t param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_5e9805() { + float16_t res = tint_degrees(0.0hf); +} + +vec4 vertex_main() { + degrees_5e9805(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +float16_t tint_degrees(float16_t param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_5e9805() { + float16_t res = tint_degrees(0.0hf); +} + +void fragment_main() { + degrees_5e9805(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +float16_t tint_degrees(float16_t param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_5e9805() { + float16_t res = tint_degrees(0.0hf); +} + +void compute_main() { + degrees_5e9805(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.msl b/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.msl new file mode 100644 index 0000000000..1aacda2ef3 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; + +half tint_degrees(half param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_5e9805() { + half res = tint_degrees(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + degrees_5e9805(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + degrees_5e9805(); + return; +} + +kernel void compute_main() { + degrees_5e9805(); + return; +} + diff --git a/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.spvasm new file mode 100644 index 0000000000..028d4a8910 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %degrees_5e9805 "degrees_5e9805" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%degrees_5e9805 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Degrees %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %degrees_5e9805 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %degrees_5e9805 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %degrees_5e9805 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.wgsl new file mode 100644 index 0000000000..647c580f09 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn degrees_5e9805() { + var res : f16 = degrees(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_5e9805(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_5e9805(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_5e9805(); +} diff --git a/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl b/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl new file mode 100644 index 0000000000..c30a280190 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn degrees(vec<3, f16>) -> vec<3, f16> +fn degrees_dfe8f4() { + var res: vec3 = degrees(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_dfe8f4(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_dfe8f4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_dfe8f4(); +} diff --git a/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0dd63bf276 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +vector tint_degrees(vector param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_dfe8f4() { + vector res = tint_degrees((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_dfe8f4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_dfe8f4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_dfe8f4(); + return; +} diff --git a/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2e49c90f53 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +vector tint_degrees(vector param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_dfe8f4() { + vector res = tint_degrees((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_dfe8f4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_dfe8f4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_dfe8f4(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001BA47346FD0(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.glsl b/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.glsl new file mode 100644 index 0000000000..59962ab016 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec3 tint_degrees(f16vec3 param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_dfe8f4() { + f16vec3 res = tint_degrees(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + degrees_dfe8f4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec3 tint_degrees(f16vec3 param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_dfe8f4() { + f16vec3 res = tint_degrees(f16vec3(0.0hf)); +} + +void fragment_main() { + degrees_dfe8f4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec3 tint_degrees(f16vec3 param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_dfe8f4() { + f16vec3 res = tint_degrees(f16vec3(0.0hf)); +} + +void compute_main() { + degrees_dfe8f4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.msl b/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.msl new file mode 100644 index 0000000000..f6ef443fa1 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; + +half3 tint_degrees(half3 param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_dfe8f4() { + half3 res = tint_degrees(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + degrees_dfe8f4(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + degrees_dfe8f4(); + return; +} + +kernel void compute_main() { + degrees_dfe8f4(); + return; +} + diff --git a/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.spvasm new file mode 100644 index 0000000000..fb059e81a2 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %degrees_dfe8f4 "degrees_dfe8f4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%degrees_dfe8f4 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Degrees %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %degrees_dfe8f4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %degrees_dfe8f4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %degrees_dfe8f4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.wgsl new file mode 100644 index 0000000000..3d2cd7ab4e --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn degrees_dfe8f4() { + var res : vec3 = degrees(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_dfe8f4(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_dfe8f4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_dfe8f4(); +} diff --git a/test/tint/builtins/gen/literal/degrees/f59715.wgsl b/test/tint/builtins/gen/literal/degrees/f59715.wgsl new file mode 100644 index 0000000000..7cfc4a234f --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/f59715.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn degrees(vec<2, f16>) -> vec<2, f16> +fn degrees_f59715() { + var res: vec2 = degrees(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_f59715(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_f59715(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_f59715(); +} diff --git a/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8aac00fc98 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +vector tint_degrees(vector param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_f59715() { + vector res = tint_degrees((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_f59715(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_f59715(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_f59715(); + return; +} diff --git a/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5ada3122e4 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +vector tint_degrees(vector param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_f59715() { + vector res = tint_degrees((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_f59715(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_f59715(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_f59715(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000025AB33F0650(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.glsl b/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.glsl new file mode 100644 index 0000000000..99ed077df0 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec2 tint_degrees(f16vec2 param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_f59715() { + f16vec2 res = tint_degrees(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + degrees_f59715(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec2 tint_degrees(f16vec2 param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_f59715() { + f16vec2 res = tint_degrees(f16vec2(0.0hf)); +} + +void fragment_main() { + degrees_f59715(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec2 tint_degrees(f16vec2 param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_f59715() { + f16vec2 res = tint_degrees(f16vec2(0.0hf)); +} + +void compute_main() { + degrees_f59715(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.msl b/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.msl new file mode 100644 index 0000000000..2c0932577b --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; + +half2 tint_degrees(half2 param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_f59715() { + half2 res = tint_degrees(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + degrees_f59715(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + degrees_f59715(); + return; +} + +kernel void compute_main() { + degrees_f59715(); + return; +} + diff --git a/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.spvasm new file mode 100644 index 0000000000..d9b7fb5716 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %degrees_f59715 "degrees_f59715" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%degrees_f59715 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Degrees %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %degrees_f59715 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %degrees_f59715 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %degrees_f59715 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.wgsl new file mode 100644 index 0000000000..b3b6057a07 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn degrees_f59715() { + var res : vec2 = degrees(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_f59715(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_f59715(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_f59715(); +} diff --git a/test/tint/builtins/gen/literal/determinant/32bfde.wgsl b/test/tint/builtins/gen/literal/determinant/32bfde.wgsl new file mode 100644 index 0000000000..9ff80ceb9b --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/32bfde.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn determinant(mat<4, 4, f16>) -> f16 +fn determinant_32bfde() { + var res: f16 = determinant(mat4x4(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + determinant_32bfde(); + return vec4(); +} + +@fragment +fn fragment_main() { + determinant_32bfde(); +} + +@compute @workgroup_size(1) +fn compute_main() { + determinant_32bfde(); +} diff --git a/test/tint/builtins/gen/literal/determinant/32bfde.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/determinant/32bfde.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..123af604e0 --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/32bfde.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void determinant_32bfde() { + float16_t res = determinant(matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + determinant_32bfde(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + determinant_32bfde(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + determinant_32bfde(); + return; +} diff --git a/test/tint/builtins/gen/literal/determinant/32bfde.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/determinant/32bfde.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..919bf99ec9 --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/32bfde.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void determinant_32bfde() { + float16_t res = determinant(matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + determinant_32bfde(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + determinant_32bfde(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + determinant_32bfde(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000028760CE9820(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000028760CE9820(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/determinant/32bfde.wgsl.expected.glsl b/test/tint/builtins/gen/literal/determinant/32bfde.wgsl.expected.glsl new file mode 100644 index 0000000000..32fc171cf0 --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/32bfde.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void determinant_32bfde() { + float16_t res = determinant(f16mat4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf))); +} + +vec4 vertex_main() { + determinant_32bfde(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void determinant_32bfde() { + float16_t res = determinant(f16mat4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf))); +} + +void fragment_main() { + determinant_32bfde(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void determinant_32bfde() { + float16_t res = determinant(f16mat4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf))); +} + +void compute_main() { + determinant_32bfde(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/determinant/32bfde.wgsl.expected.msl b/test/tint/builtins/gen/literal/determinant/32bfde.wgsl.expected.msl new file mode 100644 index 0000000000..0f0a75d7db --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/32bfde.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void determinant_32bfde() { + half res = determinant(half4x4(half4(0.0h), half4(0.0h), half4(0.0h), half4(0.0h))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + determinant_32bfde(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + determinant_32bfde(); + return; +} + +kernel void compute_main() { + determinant_32bfde(); + return; +} + diff --git a/test/tint/builtins/gen/literal/determinant/32bfde.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/determinant/32bfde.wgsl.expected.spvasm new file mode 100644 index 0000000000..c3e9627c6b --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/32bfde.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %determinant_32bfde "determinant_32bfde" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat4v4half = OpTypeMatrix %v4half 4 + %18 = OpConstantNull %mat4v4half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpConstantNull %half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%determinant_32bfde = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %21 + %13 = OpExtInst %half %15 Determinant %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %determinant_32bfde + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %determinant_32bfde + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %determinant_32bfde + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/determinant/32bfde.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/determinant/32bfde.wgsl.expected.wgsl new file mode 100644 index 0000000000..5d3cce92f4 --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/32bfde.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn determinant_32bfde() { + var res : f16 = determinant(mat4x4(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + determinant_32bfde(); + return vec4(); +} + +@fragment +fn fragment_main() { + determinant_32bfde(); +} + +@compute @workgroup_size(1) +fn compute_main() { + determinant_32bfde(); +} diff --git a/test/tint/builtins/gen/literal/determinant/d7c86f.wgsl b/test/tint/builtins/gen/literal/determinant/d7c86f.wgsl new file mode 100644 index 0000000000..bb81d5be13 --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/d7c86f.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn determinant(mat<3, 3, f16>) -> f16 +fn determinant_d7c86f() { + var res: f16 = determinant(mat3x3(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + determinant_d7c86f(); + return vec4(); +} + +@fragment +fn fragment_main() { + determinant_d7c86f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + determinant_d7c86f(); +} diff --git a/test/tint/builtins/gen/literal/determinant/d7c86f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/determinant/d7c86f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4971b2eb09 --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/d7c86f.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void determinant_d7c86f() { + float16_t res = determinant(matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + determinant_d7c86f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + determinant_d7c86f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + determinant_d7c86f(); + return; +} diff --git a/test/tint/builtins/gen/literal/determinant/d7c86f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/determinant/d7c86f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0b82260ebc --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/d7c86f.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void determinant_d7c86f() { + float16_t res = determinant(matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + determinant_d7c86f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + determinant_d7c86f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + determinant_d7c86f(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000017F01F7E050(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000017F01F7E050(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/determinant/d7c86f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/determinant/d7c86f.wgsl.expected.glsl new file mode 100644 index 0000000000..13f877ca77 --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/d7c86f.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void determinant_d7c86f() { + float16_t res = determinant(f16mat3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf))); +} + +vec4 vertex_main() { + determinant_d7c86f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void determinant_d7c86f() { + float16_t res = determinant(f16mat3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf))); +} + +void fragment_main() { + determinant_d7c86f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void determinant_d7c86f() { + float16_t res = determinant(f16mat3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf))); +} + +void compute_main() { + determinant_d7c86f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/determinant/d7c86f.wgsl.expected.msl b/test/tint/builtins/gen/literal/determinant/d7c86f.wgsl.expected.msl new file mode 100644 index 0000000000..cfb43b5e41 --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/d7c86f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void determinant_d7c86f() { + half res = determinant(half3x3(half3(0.0h), half3(0.0h), half3(0.0h))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + determinant_d7c86f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + determinant_d7c86f(); + return; +} + +kernel void compute_main() { + determinant_d7c86f(); + return; +} + diff --git a/test/tint/builtins/gen/literal/determinant/d7c86f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/determinant/d7c86f.wgsl.expected.spvasm new file mode 100644 index 0000000000..e3ed5ccb94 --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/d7c86f.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %determinant_d7c86f "determinant_d7c86f" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat3v3half = OpTypeMatrix %v3half 3 + %18 = OpConstantNull %mat3v3half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpConstantNull %half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%determinant_d7c86f = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %21 + %13 = OpExtInst %half %15 Determinant %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %determinant_d7c86f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %determinant_d7c86f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %determinant_d7c86f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/determinant/d7c86f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/determinant/d7c86f.wgsl.expected.wgsl new file mode 100644 index 0000000000..2623778210 --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/d7c86f.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn determinant_d7c86f() { + var res : f16 = determinant(mat3x3(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + determinant_d7c86f(); + return vec4(); +} + +@fragment +fn fragment_main() { + determinant_d7c86f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + determinant_d7c86f(); +} diff --git a/test/tint/builtins/gen/literal/determinant/fc12a5.wgsl b/test/tint/builtins/gen/literal/determinant/fc12a5.wgsl new file mode 100644 index 0000000000..2b22f37372 --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/fc12a5.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn determinant(mat<2, 2, f16>) -> f16 +fn determinant_fc12a5() { + var res: f16 = determinant(mat2x2(f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + determinant_fc12a5(); + return vec4(); +} + +@fragment +fn fragment_main() { + determinant_fc12a5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + determinant_fc12a5(); +} diff --git a/test/tint/builtins/gen/literal/determinant/fc12a5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/determinant/fc12a5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f1f2a237ab --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/fc12a5.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void determinant_fc12a5() { + float16_t res = determinant(matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + determinant_fc12a5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + determinant_fc12a5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + determinant_fc12a5(); + return; +} diff --git a/test/tint/builtins/gen/literal/determinant/fc12a5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/determinant/fc12a5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0c7ad5c5a8 --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/fc12a5.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void determinant_fc12a5() { + float16_t res = determinant(matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + determinant_fc12a5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + determinant_fc12a5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + determinant_fc12a5(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002949F67AAF0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002949F67AAF0(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/determinant/fc12a5.wgsl.expected.glsl b/test/tint/builtins/gen/literal/determinant/fc12a5.wgsl.expected.glsl new file mode 100644 index 0000000000..5239eec2ab --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/fc12a5.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void determinant_fc12a5() { + float16_t res = determinant(f16mat2(f16vec2(0.0hf), f16vec2(0.0hf))); +} + +vec4 vertex_main() { + determinant_fc12a5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void determinant_fc12a5() { + float16_t res = determinant(f16mat2(f16vec2(0.0hf), f16vec2(0.0hf))); +} + +void fragment_main() { + determinant_fc12a5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void determinant_fc12a5() { + float16_t res = determinant(f16mat2(f16vec2(0.0hf), f16vec2(0.0hf))); +} + +void compute_main() { + determinant_fc12a5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/determinant/fc12a5.wgsl.expected.msl b/test/tint/builtins/gen/literal/determinant/fc12a5.wgsl.expected.msl new file mode 100644 index 0000000000..ef6ccaf3f6 --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/fc12a5.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void determinant_fc12a5() { + half res = determinant(half2x2(half2(0.0h), half2(0.0h))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + determinant_fc12a5(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + determinant_fc12a5(); + return; +} + +kernel void compute_main() { + determinant_fc12a5(); + return; +} + diff --git a/test/tint/builtins/gen/literal/determinant/fc12a5.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/determinant/fc12a5.wgsl.expected.spvasm new file mode 100644 index 0000000000..77251639e6 --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/fc12a5.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %determinant_fc12a5 "determinant_fc12a5" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat2v2half = OpTypeMatrix %v2half 2 + %18 = OpConstantNull %mat2v2half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpConstantNull %half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%determinant_fc12a5 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %21 + %13 = OpExtInst %half %15 Determinant %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %determinant_fc12a5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %determinant_fc12a5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %determinant_fc12a5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/determinant/fc12a5.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/determinant/fc12a5.wgsl.expected.wgsl new file mode 100644 index 0000000000..0a10d8ebcd --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/fc12a5.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn determinant_fc12a5() { + var res : f16 = determinant(mat2x2(f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + determinant_fc12a5(); + return vec4(); +} + +@fragment +fn fragment_main() { + determinant_fc12a5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + determinant_fc12a5(); +} diff --git a/test/tint/builtins/gen/literal/distance/7272f3.wgsl b/test/tint/builtins/gen/literal/distance/7272f3.wgsl new file mode 100644 index 0000000000..1752332b22 --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/7272f3.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn distance(vec<4, f16>, vec<4, f16>) -> f16 +fn distance_7272f3() { + var res: f16 = distance(vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_7272f3(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_7272f3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_7272f3(); +} diff --git a/test/tint/builtins/gen/literal/distance/7272f3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/distance/7272f3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4e34e085df --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/7272f3.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void distance_7272f3() { + float16_t res = distance((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_7272f3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_7272f3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_7272f3(); + return; +} diff --git a/test/tint/builtins/gen/literal/distance/7272f3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/distance/7272f3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..66ce4f31de --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/7272f3.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void distance_7272f3() { + float16_t res = distance((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_7272f3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_7272f3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_7272f3(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002AF01F7D600(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002AF01F7D600(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/distance/7272f3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/distance/7272f3.wgsl.expected.glsl new file mode 100644 index 0000000000..3ecf59a4f5 --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/7272f3.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void distance_7272f3() { + float16_t res = distance(f16vec4(0.0hf), f16vec4(0.0hf)); +} + +vec4 vertex_main() { + distance_7272f3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void distance_7272f3() { + float16_t res = distance(f16vec4(0.0hf), f16vec4(0.0hf)); +} + +void fragment_main() { + distance_7272f3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void distance_7272f3() { + float16_t res = distance(f16vec4(0.0hf), f16vec4(0.0hf)); +} + +void compute_main() { + distance_7272f3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/distance/7272f3.wgsl.expected.msl b/test/tint/builtins/gen/literal/distance/7272f3.wgsl.expected.msl new file mode 100644 index 0000000000..87c9be80e7 --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/7272f3.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void distance_7272f3() { + half res = distance(half4(0.0h), half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + distance_7272f3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + distance_7272f3(); + return; +} + +kernel void compute_main() { + distance_7272f3(); + return; +} + diff --git a/test/tint/builtins/gen/literal/distance/7272f3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/distance/7272f3.wgsl.expected.spvasm new file mode 100644 index 0000000000..491038ea6d --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/7272f3.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %distance_7272f3 "distance_7272f3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_half = OpTypePointer Function %half + %20 = OpConstantNull %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%distance_7272f3 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %20 + %13 = OpExtInst %half %15 Distance %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %distance_7272f3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %distance_7272f3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %distance_7272f3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/distance/7272f3.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/distance/7272f3.wgsl.expected.wgsl new file mode 100644 index 0000000000..5472c32ceb --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/7272f3.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn distance_7272f3() { + var res : f16 = distance(vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_7272f3(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_7272f3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_7272f3(); +} diff --git a/test/tint/builtins/gen/literal/distance/7d201f.wgsl b/test/tint/builtins/gen/literal/distance/7d201f.wgsl new file mode 100644 index 0000000000..a03bad71aa --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/7d201f.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn distance(f16, f16) -> f16 +fn distance_7d201f() { + var res: f16 = distance(f16(), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_7d201f(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_7d201f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_7d201f(); +} diff --git a/test/tint/builtins/gen/literal/distance/7d201f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/distance/7d201f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..10efc6d0bf --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/7d201f.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void distance_7d201f() { + float16_t res = distance(float16_t(0.0h), float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_7d201f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_7d201f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_7d201f(); + return; +} diff --git a/test/tint/builtins/gen/literal/distance/7d201f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/distance/7d201f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..653ef2c07d --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/7d201f.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void distance_7d201f() { + float16_t res = distance(float16_t(0.0h), float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_7d201f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_7d201f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_7d201f(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D5BC336FD0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D5BC336FD0(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/distance/7d201f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/distance/7d201f.wgsl.expected.glsl new file mode 100644 index 0000000000..30aee9f2c8 --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/7d201f.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void distance_7d201f() { + float16_t res = distance(0.0hf, 0.0hf); +} + +vec4 vertex_main() { + distance_7d201f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void distance_7d201f() { + float16_t res = distance(0.0hf, 0.0hf); +} + +void fragment_main() { + distance_7d201f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void distance_7d201f() { + float16_t res = distance(0.0hf, 0.0hf); +} + +void compute_main() { + distance_7d201f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/distance/7d201f.wgsl.expected.msl b/test/tint/builtins/gen/literal/distance/7d201f.wgsl.expected.msl new file mode 100644 index 0000000000..e7baa97561 --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/7d201f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void distance_7d201f() { + half res = fabs(0.0h - 0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + distance_7d201f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + distance_7d201f(); + return; +} + +kernel void compute_main() { + distance_7d201f(); + return; +} + diff --git a/test/tint/builtins/gen/literal/distance/7d201f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/distance/7d201f.wgsl.expected.spvasm new file mode 100644 index 0000000000..8a0a548a2f --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/7d201f.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %distance_7d201f "distance_7d201f" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%distance_7d201f = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Distance %16 %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %distance_7d201f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %distance_7d201f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %distance_7d201f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/distance/7d201f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/distance/7d201f.wgsl.expected.wgsl new file mode 100644 index 0000000000..8de385102d --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/7d201f.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn distance_7d201f() { + var res : f16 = distance(f16(), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_7d201f(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_7d201f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_7d201f(); +} diff --git a/test/tint/builtins/gen/literal/distance/892a5d.wgsl b/test/tint/builtins/gen/literal/distance/892a5d.wgsl new file mode 100644 index 0000000000..affa3a3990 --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/892a5d.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn distance(vec<2, f16>, vec<2, f16>) -> f16 +fn distance_892a5d() { + var res: f16 = distance(vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_892a5d(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_892a5d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_892a5d(); +} diff --git a/test/tint/builtins/gen/literal/distance/892a5d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/distance/892a5d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d35b1478a8 --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/892a5d.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void distance_892a5d() { + float16_t res = distance((float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_892a5d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_892a5d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_892a5d(); + return; +} diff --git a/test/tint/builtins/gen/literal/distance/892a5d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/distance/892a5d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..198576cf6e --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/892a5d.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void distance_892a5d() { + float16_t res = distance((float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_892a5d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_892a5d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_892a5d(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000026F67541620(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000026F67541620(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/distance/892a5d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/distance/892a5d.wgsl.expected.glsl new file mode 100644 index 0000000000..6c6b7523d7 --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/892a5d.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void distance_892a5d() { + float16_t res = distance(f16vec2(0.0hf), f16vec2(0.0hf)); +} + +vec4 vertex_main() { + distance_892a5d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void distance_892a5d() { + float16_t res = distance(f16vec2(0.0hf), f16vec2(0.0hf)); +} + +void fragment_main() { + distance_892a5d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void distance_892a5d() { + float16_t res = distance(f16vec2(0.0hf), f16vec2(0.0hf)); +} + +void compute_main() { + distance_892a5d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/distance/892a5d.wgsl.expected.msl b/test/tint/builtins/gen/literal/distance/892a5d.wgsl.expected.msl new file mode 100644 index 0000000000..8977f6729d --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/892a5d.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void distance_892a5d() { + half res = distance(half2(0.0h), half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + distance_892a5d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + distance_892a5d(); + return; +} + +kernel void compute_main() { + distance_892a5d(); + return; +} + diff --git a/test/tint/builtins/gen/literal/distance/892a5d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/distance/892a5d.wgsl.expected.spvasm new file mode 100644 index 0000000000..8f00450255 --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/892a5d.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %distance_892a5d "distance_892a5d" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_half = OpTypePointer Function %half + %20 = OpConstantNull %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%distance_892a5d = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %20 + %13 = OpExtInst %half %15 Distance %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %distance_892a5d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %distance_892a5d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %distance_892a5d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/distance/892a5d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/distance/892a5d.wgsl.expected.wgsl new file mode 100644 index 0000000000..71ed2d0177 --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/892a5d.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn distance_892a5d() { + var res : f16 = distance(vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_892a5d(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_892a5d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_892a5d(); +} diff --git a/test/tint/builtins/gen/literal/distance/928fa0.wgsl b/test/tint/builtins/gen/literal/distance/928fa0.wgsl new file mode 100644 index 0000000000..80353c820a --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/928fa0.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn distance(vec<3, f16>, vec<3, f16>) -> f16 +fn distance_928fa0() { + var res: f16 = distance(vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_928fa0(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_928fa0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_928fa0(); +} diff --git a/test/tint/builtins/gen/literal/distance/928fa0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/distance/928fa0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c21d1447db --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/928fa0.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void distance_928fa0() { + float16_t res = distance((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_928fa0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_928fa0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_928fa0(); + return; +} diff --git a/test/tint/builtins/gen/literal/distance/928fa0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/distance/928fa0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cd6b130263 --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/928fa0.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void distance_928fa0() { + float16_t res = distance((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_928fa0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_928fa0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_928fa0(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001ECED3C83A0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001ECED3C83A0(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/distance/928fa0.wgsl.expected.glsl b/test/tint/builtins/gen/literal/distance/928fa0.wgsl.expected.glsl new file mode 100644 index 0000000000..c68cb1079d --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/928fa0.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void distance_928fa0() { + float16_t res = distance(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +vec4 vertex_main() { + distance_928fa0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void distance_928fa0() { + float16_t res = distance(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +void fragment_main() { + distance_928fa0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void distance_928fa0() { + float16_t res = distance(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +void compute_main() { + distance_928fa0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/distance/928fa0.wgsl.expected.msl b/test/tint/builtins/gen/literal/distance/928fa0.wgsl.expected.msl new file mode 100644 index 0000000000..0e034abc4b --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/928fa0.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void distance_928fa0() { + half res = distance(half3(0.0h), half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + distance_928fa0(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + distance_928fa0(); + return; +} + +kernel void compute_main() { + distance_928fa0(); + return; +} + diff --git a/test/tint/builtins/gen/literal/distance/928fa0.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/distance/928fa0.wgsl.expected.spvasm new file mode 100644 index 0000000000..63605caa7a --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/928fa0.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %distance_928fa0 "distance_928fa0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_half = OpTypePointer Function %half + %20 = OpConstantNull %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%distance_928fa0 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %20 + %13 = OpExtInst %half %15 Distance %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %distance_928fa0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %distance_928fa0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %distance_928fa0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/distance/928fa0.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/distance/928fa0.wgsl.expected.wgsl new file mode 100644 index 0000000000..81c645190a --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/928fa0.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn distance_928fa0() { + var res : f16 = distance(vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_928fa0(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_928fa0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_928fa0(); +} diff --git a/test/tint/builtins/gen/literal/dot/8e40f1.wgsl b/test/tint/builtins/gen/literal/dot/8e40f1.wgsl new file mode 100644 index 0000000000..84f71c0aa6 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/8e40f1.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn dot(vec<3, f16>, vec<3, f16>) -> f16 +fn dot_8e40f1() { + var res: f16 = dot(vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_8e40f1(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_8e40f1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_8e40f1(); +} diff --git a/test/tint/builtins/gen/literal/dot/8e40f1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/dot/8e40f1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6e108ce8a2 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/8e40f1.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void dot_8e40f1() { + float16_t res = dot((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_8e40f1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_8e40f1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_8e40f1(); + return; +} diff --git a/test/tint/builtins/gen/literal/dot/8e40f1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/dot/8e40f1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c6a02e9473 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/8e40f1.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void dot_8e40f1() { + float16_t res = dot((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_8e40f1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_8e40f1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_8e40f1(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E9C49996F0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E9C49996F0(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/dot/8e40f1.wgsl.expected.glsl b/test/tint/builtins/gen/literal/dot/8e40f1.wgsl.expected.glsl new file mode 100644 index 0000000000..434219455a --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/8e40f1.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void dot_8e40f1() { + float16_t res = dot(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +vec4 vertex_main() { + dot_8e40f1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void dot_8e40f1() { + float16_t res = dot(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +void fragment_main() { + dot_8e40f1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void dot_8e40f1() { + float16_t res = dot(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +void compute_main() { + dot_8e40f1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/dot/8e40f1.wgsl.expected.msl b/test/tint/builtins/gen/literal/dot/8e40f1.wgsl.expected.msl new file mode 100644 index 0000000000..1c34dc5296 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/8e40f1.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void dot_8e40f1() { + half res = dot(half3(0.0h), half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + dot_8e40f1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + dot_8e40f1(); + return; +} + +kernel void compute_main() { + dot_8e40f1(); + return; +} + diff --git a/test/tint/builtins/gen/literal/dot/8e40f1.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/dot/8e40f1.wgsl.expected.spvasm new file mode 100644 index 0000000000..7fc21ecc72 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/8e40f1.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %dot_8e40f1 "dot_8e40f1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %16 = OpConstantNull %v3half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpConstantNull %half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %dot_8e40f1 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %19 + %13 = OpDot %half %16 %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %dot_8e40f1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %dot_8e40f1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %dot_8e40f1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/dot/8e40f1.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/dot/8e40f1.wgsl.expected.wgsl new file mode 100644 index 0000000000..5b8c1a658d --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/8e40f1.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn dot_8e40f1() { + var res : f16 = dot(vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_8e40f1(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_8e40f1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_8e40f1(); +} diff --git a/test/tint/builtins/gen/literal/dot/cd5a04.wgsl b/test/tint/builtins/gen/literal/dot/cd5a04.wgsl new file mode 100644 index 0000000000..e300f3179e --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/cd5a04.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn dot(vec<2, f16>, vec<2, f16>) -> f16 +fn dot_cd5a04() { + var res: f16 = dot(vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_cd5a04(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_cd5a04(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_cd5a04(); +} diff --git a/test/tint/builtins/gen/literal/dot/cd5a04.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/dot/cd5a04.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..04adad0292 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/cd5a04.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void dot_cd5a04() { + float16_t res = dot((float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_cd5a04(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_cd5a04(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_cd5a04(); + return; +} diff --git a/test/tint/builtins/gen/literal/dot/cd5a04.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/dot/cd5a04.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d48d74ed05 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/cd5a04.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void dot_cd5a04() { + float16_t res = dot((float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_cd5a04(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_cd5a04(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_cd5a04(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001B52BF97850(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001B52BF97850(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/dot/cd5a04.wgsl.expected.glsl b/test/tint/builtins/gen/literal/dot/cd5a04.wgsl.expected.glsl new file mode 100644 index 0000000000..c14d0ae8f4 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/cd5a04.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void dot_cd5a04() { + float16_t res = dot(f16vec2(0.0hf), f16vec2(0.0hf)); +} + +vec4 vertex_main() { + dot_cd5a04(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void dot_cd5a04() { + float16_t res = dot(f16vec2(0.0hf), f16vec2(0.0hf)); +} + +void fragment_main() { + dot_cd5a04(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void dot_cd5a04() { + float16_t res = dot(f16vec2(0.0hf), f16vec2(0.0hf)); +} + +void compute_main() { + dot_cd5a04(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/dot/cd5a04.wgsl.expected.msl b/test/tint/builtins/gen/literal/dot/cd5a04.wgsl.expected.msl new file mode 100644 index 0000000000..243b15aef2 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/cd5a04.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void dot_cd5a04() { + half res = dot(half2(0.0h), half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + dot_cd5a04(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + dot_cd5a04(); + return; +} + +kernel void compute_main() { + dot_cd5a04(); + return; +} + diff --git a/test/tint/builtins/gen/literal/dot/cd5a04.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/dot/cd5a04.wgsl.expected.spvasm new file mode 100644 index 0000000000..7fbae9809a --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/cd5a04.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %dot_cd5a04 "dot_cd5a04" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %16 = OpConstantNull %v2half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpConstantNull %half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %dot_cd5a04 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %19 + %13 = OpDot %half %16 %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %dot_cd5a04 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %dot_cd5a04 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %dot_cd5a04 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/dot/cd5a04.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/dot/cd5a04.wgsl.expected.wgsl new file mode 100644 index 0000000000..25778c7de4 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/cd5a04.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn dot_cd5a04() { + var res : f16 = dot(vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_cd5a04(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_cd5a04(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_cd5a04(); +} diff --git a/test/tint/builtins/gen/literal/dot/d0d179.wgsl b/test/tint/builtins/gen/literal/dot/d0d179.wgsl new file mode 100644 index 0000000000..39d1e51fc6 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/d0d179.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn dot(vec<4, f16>, vec<4, f16>) -> f16 +fn dot_d0d179() { + var res: f16 = dot(vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_d0d179(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_d0d179(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_d0d179(); +} diff --git a/test/tint/builtins/gen/literal/dot/d0d179.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/dot/d0d179.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f05dcec1ce --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/d0d179.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void dot_d0d179() { + float16_t res = dot((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_d0d179(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_d0d179(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_d0d179(); + return; +} diff --git a/test/tint/builtins/gen/literal/dot/d0d179.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/dot/d0d179.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7c95a5e6d5 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/d0d179.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void dot_d0d179() { + float16_t res = dot((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_d0d179(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_d0d179(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_d0d179(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E77FD80D40(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E77FD80D40(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/dot/d0d179.wgsl.expected.glsl b/test/tint/builtins/gen/literal/dot/d0d179.wgsl.expected.glsl new file mode 100644 index 0000000000..90dbe8ae34 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/d0d179.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void dot_d0d179() { + float16_t res = dot(f16vec4(0.0hf), f16vec4(0.0hf)); +} + +vec4 vertex_main() { + dot_d0d179(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void dot_d0d179() { + float16_t res = dot(f16vec4(0.0hf), f16vec4(0.0hf)); +} + +void fragment_main() { + dot_d0d179(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void dot_d0d179() { + float16_t res = dot(f16vec4(0.0hf), f16vec4(0.0hf)); +} + +void compute_main() { + dot_d0d179(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/dot/d0d179.wgsl.expected.msl b/test/tint/builtins/gen/literal/dot/d0d179.wgsl.expected.msl new file mode 100644 index 0000000000..becad5b54d --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/d0d179.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void dot_d0d179() { + half res = dot(half4(0.0h), half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + dot_d0d179(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + dot_d0d179(); + return; +} + +kernel void compute_main() { + dot_d0d179(); + return; +} + diff --git a/test/tint/builtins/gen/literal/dot/d0d179.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/dot/d0d179.wgsl.expected.spvasm new file mode 100644 index 0000000000..379f0238a5 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/d0d179.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %dot_d0d179 "dot_d0d179" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %16 = OpConstantNull %v4half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpConstantNull %half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %dot_d0d179 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %19 + %13 = OpDot %half %16 %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %dot_d0d179 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %dot_d0d179 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %dot_d0d179 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/dot/d0d179.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/dot/d0d179.wgsl.expected.wgsl new file mode 100644 index 0000000000..7e94f8b831 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/d0d179.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn dot_d0d179() { + var res : f16 = dot(vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_d0d179(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_d0d179(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_d0d179(); +} diff --git a/test/tint/builtins/gen/literal/dot4I8Packed/881e62.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/dot4I8Packed/881e62.wgsl.expected.fxc.hlsl index 5692ea0d0a..8ccdb8da56 100644 --- a/test/tint/builtins/gen/literal/dot4I8Packed/881e62.wgsl.expected.fxc.hlsl +++ b/test/tint/builtins/gen/literal/dot4I8Packed/881e62.wgsl.expected.fxc.hlsl @@ -35,3 +35,6 @@ void compute_main() { dot4I8Packed_881e62(); return; } +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000239A33210B0(3,10-56): error X3004: undeclared identifier 'dot4add_i8packed' + diff --git a/test/tint/builtins/gen/literal/dot4U8Packed/fbed7b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/dot4U8Packed/fbed7b.wgsl.expected.fxc.hlsl index c371939ff3..e84c3daa48 100644 --- a/test/tint/builtins/gen/literal/dot4U8Packed/fbed7b.wgsl.expected.fxc.hlsl +++ b/test/tint/builtins/gen/literal/dot4U8Packed/fbed7b.wgsl.expected.fxc.hlsl @@ -35,3 +35,6 @@ void compute_main() { dot4U8Packed_fbed7b(); return; } +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D2469D6CD0(3,10-56): error X3004: undeclared identifier 'dot4add_u8packed' + diff --git a/test/tint/builtins/gen/literal/exp/13806d.wgsl b/test/tint/builtins/gen/literal/exp/13806d.wgsl new file mode 100644 index 0000000000..04d8cc6223 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/13806d.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn exp(vec<3, f16>) -> vec<3, f16> +fn exp_13806d() { + var res: vec3 = exp(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_13806d(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_13806d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_13806d(); +} diff --git a/test/tint/builtins/gen/literal/exp/13806d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/exp/13806d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6d8ae98452 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/13806d.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void exp_13806d() { + vector res = exp((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_13806d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_13806d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_13806d(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp/13806d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/exp/13806d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5442169fe0 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/13806d.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void exp_13806d() { + vector res = exp((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_13806d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_13806d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_13806d(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F8343687E0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/exp/13806d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/exp/13806d.wgsl.expected.glsl new file mode 100644 index 0000000000..e2a7b73d87 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/13806d.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp_13806d() { + f16vec3 res = exp(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + exp_13806d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void exp_13806d() { + f16vec3 res = exp(f16vec3(0.0hf)); +} + +void fragment_main() { + exp_13806d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp_13806d() { + f16vec3 res = exp(f16vec3(0.0hf)); +} + +void compute_main() { + exp_13806d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp/13806d.wgsl.expected.msl b/test/tint/builtins/gen/literal/exp/13806d.wgsl.expected.msl new file mode 100644 index 0000000000..1f4af8c67b --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/13806d.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void exp_13806d() { + half3 res = exp(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp_13806d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp_13806d(); + return; +} + +kernel void compute_main() { + exp_13806d(); + return; +} + diff --git a/test/tint/builtins/gen/literal/exp/13806d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/exp/13806d.wgsl.expected.spvasm new file mode 100644 index 0000000000..a3679ff7f8 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/13806d.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp_13806d "exp_13806d" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %exp_13806d = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Exp %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %exp_13806d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %exp_13806d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %exp_13806d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/exp/13806d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/exp/13806d.wgsl.expected.wgsl new file mode 100644 index 0000000000..7ccb13f5f6 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/13806d.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn exp_13806d() { + var res : vec3 = exp(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_13806d(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_13806d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_13806d(); +} diff --git a/test/tint/builtins/gen/literal/exp/2e08e2.wgsl b/test/tint/builtins/gen/literal/exp/2e08e2.wgsl new file mode 100644 index 0000000000..d2d1bb2579 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/2e08e2.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn exp(vec<2, f16>) -> vec<2, f16> +fn exp_2e08e2() { + var res: vec2 = exp(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_2e08e2(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_2e08e2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_2e08e2(); +} diff --git a/test/tint/builtins/gen/literal/exp/2e08e2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/exp/2e08e2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..52dca1d7a8 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/2e08e2.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void exp_2e08e2() { + vector res = exp((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_2e08e2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_2e08e2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_2e08e2(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp/2e08e2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/exp/2e08e2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..408ebd58d7 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/2e08e2.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void exp_2e08e2() { + vector res = exp((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_2e08e2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_2e08e2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_2e08e2(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E5CBC9ECC0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/exp/2e08e2.wgsl.expected.glsl b/test/tint/builtins/gen/literal/exp/2e08e2.wgsl.expected.glsl new file mode 100644 index 0000000000..04a9c64e66 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/2e08e2.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp_2e08e2() { + f16vec2 res = exp(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + exp_2e08e2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void exp_2e08e2() { + f16vec2 res = exp(f16vec2(0.0hf)); +} + +void fragment_main() { + exp_2e08e2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp_2e08e2() { + f16vec2 res = exp(f16vec2(0.0hf)); +} + +void compute_main() { + exp_2e08e2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp/2e08e2.wgsl.expected.msl b/test/tint/builtins/gen/literal/exp/2e08e2.wgsl.expected.msl new file mode 100644 index 0000000000..fd0c319607 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/2e08e2.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void exp_2e08e2() { + half2 res = exp(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp_2e08e2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp_2e08e2(); + return; +} + +kernel void compute_main() { + exp_2e08e2(); + return; +} + diff --git a/test/tint/builtins/gen/literal/exp/2e08e2.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/exp/2e08e2.wgsl.expected.spvasm new file mode 100644 index 0000000000..9d11ae312d --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/2e08e2.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp_2e08e2 "exp_2e08e2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %exp_2e08e2 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Exp %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %exp_2e08e2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %exp_2e08e2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %exp_2e08e2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/exp/2e08e2.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/exp/2e08e2.wgsl.expected.wgsl new file mode 100644 index 0000000000..9962f0eea7 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/2e08e2.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn exp_2e08e2() { + var res : vec2 = exp(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_2e08e2(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_2e08e2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_2e08e2(); +} diff --git a/test/tint/builtins/gen/literal/exp/611a87.wgsl b/test/tint/builtins/gen/literal/exp/611a87.wgsl new file mode 100644 index 0000000000..53ee480b1c --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/611a87.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn exp(vec<4, f16>) -> vec<4, f16> +fn exp_611a87() { + var res: vec4 = exp(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_611a87(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_611a87(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_611a87(); +} diff --git a/test/tint/builtins/gen/literal/exp/611a87.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/exp/611a87.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..47b6a044b0 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/611a87.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void exp_611a87() { + vector res = exp((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_611a87(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_611a87(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_611a87(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp/611a87.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/exp/611a87.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0c0949d2d5 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/611a87.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void exp_611a87() { + vector res = exp((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_611a87(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_611a87(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_611a87(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001865DDB0AC0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/exp/611a87.wgsl.expected.glsl b/test/tint/builtins/gen/literal/exp/611a87.wgsl.expected.glsl new file mode 100644 index 0000000000..f5b6a25e79 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/611a87.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp_611a87() { + f16vec4 res = exp(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + exp_611a87(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void exp_611a87() { + f16vec4 res = exp(f16vec4(0.0hf)); +} + +void fragment_main() { + exp_611a87(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp_611a87() { + f16vec4 res = exp(f16vec4(0.0hf)); +} + +void compute_main() { + exp_611a87(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp/611a87.wgsl.expected.msl b/test/tint/builtins/gen/literal/exp/611a87.wgsl.expected.msl new file mode 100644 index 0000000000..32163a817c --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/611a87.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void exp_611a87() { + half4 res = exp(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp_611a87(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp_611a87(); + return; +} + +kernel void compute_main() { + exp_611a87(); + return; +} + diff --git a/test/tint/builtins/gen/literal/exp/611a87.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/exp/611a87.wgsl.expected.spvasm new file mode 100644 index 0000000000..749740ee16 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/611a87.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp_611a87 "exp_611a87" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %exp_611a87 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Exp %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %exp_611a87 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %exp_611a87 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %exp_611a87 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/exp/611a87.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/exp/611a87.wgsl.expected.wgsl new file mode 100644 index 0000000000..63f247c126 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/611a87.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn exp_611a87() { + var res : vec4 = exp(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_611a87(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_611a87(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_611a87(); +} diff --git a/test/tint/builtins/gen/literal/exp/c18fe9.wgsl b/test/tint/builtins/gen/literal/exp/c18fe9.wgsl new file mode 100644 index 0000000000..6572643472 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/c18fe9.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn exp(f16) -> f16 +fn exp_c18fe9() { + var res: f16 = exp(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_c18fe9(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_c18fe9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_c18fe9(); +} diff --git a/test/tint/builtins/gen/literal/exp/c18fe9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/exp/c18fe9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..03ed79f373 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/c18fe9.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void exp_c18fe9() { + float16_t res = exp(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_c18fe9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_c18fe9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_c18fe9(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp/c18fe9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/exp/c18fe9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..58c57376b8 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/c18fe9.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void exp_c18fe9() { + float16_t res = exp(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_c18fe9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_c18fe9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_c18fe9(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000189289FB7F0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000189289FB7F0(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/exp/c18fe9.wgsl.expected.glsl b/test/tint/builtins/gen/literal/exp/c18fe9.wgsl.expected.glsl new file mode 100644 index 0000000000..a937a441ba --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/c18fe9.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp_c18fe9() { + float16_t res = exp(0.0hf); +} + +vec4 vertex_main() { + exp_c18fe9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void exp_c18fe9() { + float16_t res = exp(0.0hf); +} + +void fragment_main() { + exp_c18fe9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp_c18fe9() { + float16_t res = exp(0.0hf); +} + +void compute_main() { + exp_c18fe9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp/c18fe9.wgsl.expected.msl b/test/tint/builtins/gen/literal/exp/c18fe9.wgsl.expected.msl new file mode 100644 index 0000000000..d933e7b2c2 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/c18fe9.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void exp_c18fe9() { + half res = exp(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp_c18fe9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp_c18fe9(); + return; +} + +kernel void compute_main() { + exp_c18fe9(); + return; +} + diff --git a/test/tint/builtins/gen/literal/exp/c18fe9.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/exp/c18fe9.wgsl.expected.spvasm new file mode 100644 index 0000000000..050b62d463 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/c18fe9.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp_c18fe9 "exp_c18fe9" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %exp_c18fe9 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Exp %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %exp_c18fe9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %exp_c18fe9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %exp_c18fe9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/exp/c18fe9.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/exp/c18fe9.wgsl.expected.wgsl new file mode 100644 index 0000000000..a2dec578bf --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/c18fe9.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn exp_c18fe9() { + var res : f16 = exp(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_c18fe9(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_c18fe9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_c18fe9(); +} diff --git a/test/tint/builtins/gen/literal/exp2/151a4c.wgsl b/test/tint/builtins/gen/literal/exp2/151a4c.wgsl new file mode 100644 index 0000000000..104c4bbce7 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/151a4c.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn exp2(vec<2, f16>) -> vec<2, f16> +fn exp2_151a4c() { + var res: vec2 = exp2(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_151a4c(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_151a4c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_151a4c(); +} diff --git a/test/tint/builtins/gen/literal/exp2/151a4c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/exp2/151a4c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a205613449 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/151a4c.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void exp2_151a4c() { + vector res = exp2((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_151a4c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_151a4c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_151a4c(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp2/151a4c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/exp2/151a4c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..88d2e16be4 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/151a4c.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void exp2_151a4c() { + vector res = exp2((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_151a4c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_151a4c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_151a4c(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D4AAF5DCB0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/exp2/151a4c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/exp2/151a4c.wgsl.expected.glsl new file mode 100644 index 0000000000..78394dc70e --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/151a4c.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp2_151a4c() { + f16vec2 res = exp2(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + exp2_151a4c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void exp2_151a4c() { + f16vec2 res = exp2(f16vec2(0.0hf)); +} + +void fragment_main() { + exp2_151a4c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp2_151a4c() { + f16vec2 res = exp2(f16vec2(0.0hf)); +} + +void compute_main() { + exp2_151a4c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp2/151a4c.wgsl.expected.msl b/test/tint/builtins/gen/literal/exp2/151a4c.wgsl.expected.msl new file mode 100644 index 0000000000..e8e65eaf8e --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/151a4c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void exp2_151a4c() { + half2 res = exp2(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp2_151a4c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp2_151a4c(); + return; +} + +kernel void compute_main() { + exp2_151a4c(); + return; +} + diff --git a/test/tint/builtins/gen/literal/exp2/151a4c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/exp2/151a4c.wgsl.expected.spvasm new file mode 100644 index 0000000000..3b271fa5ca --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/151a4c.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp2_151a4c "exp2_151a4c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%exp2_151a4c = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Exp2 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %exp2_151a4c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %exp2_151a4c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %exp2_151a4c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/exp2/151a4c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/exp2/151a4c.wgsl.expected.wgsl new file mode 100644 index 0000000000..698ac46724 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/151a4c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn exp2_151a4c() { + var res : vec2 = exp2(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_151a4c(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_151a4c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_151a4c(); +} diff --git a/test/tint/builtins/gen/literal/exp2/751377.wgsl b/test/tint/builtins/gen/literal/exp2/751377.wgsl new file mode 100644 index 0000000000..790a5b1cac --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/751377.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn exp2(vec<3, f16>) -> vec<3, f16> +fn exp2_751377() { + var res: vec3 = exp2(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_751377(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_751377(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_751377(); +} diff --git a/test/tint/builtins/gen/literal/exp2/751377.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/exp2/751377.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..46be6259bb --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/751377.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void exp2_751377() { + vector res = exp2((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_751377(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_751377(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_751377(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp2/751377.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/exp2/751377.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b4aa1cdce8 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/751377.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void exp2_751377() { + vector res = exp2((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_751377(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_751377(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_751377(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000023A7CDE1160(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/exp2/751377.wgsl.expected.glsl b/test/tint/builtins/gen/literal/exp2/751377.wgsl.expected.glsl new file mode 100644 index 0000000000..af02e20882 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/751377.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp2_751377() { + f16vec3 res = exp2(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + exp2_751377(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void exp2_751377() { + f16vec3 res = exp2(f16vec3(0.0hf)); +} + +void fragment_main() { + exp2_751377(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp2_751377() { + f16vec3 res = exp2(f16vec3(0.0hf)); +} + +void compute_main() { + exp2_751377(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp2/751377.wgsl.expected.msl b/test/tint/builtins/gen/literal/exp2/751377.wgsl.expected.msl new file mode 100644 index 0000000000..201f1e2cdb --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/751377.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void exp2_751377() { + half3 res = exp2(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp2_751377(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp2_751377(); + return; +} + +kernel void compute_main() { + exp2_751377(); + return; +} + diff --git a/test/tint/builtins/gen/literal/exp2/751377.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/exp2/751377.wgsl.expected.spvasm new file mode 100644 index 0000000000..b255fb10de --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/751377.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp2_751377 "exp2_751377" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%exp2_751377 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Exp2 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %exp2_751377 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %exp2_751377 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %exp2_751377 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/exp2/751377.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/exp2/751377.wgsl.expected.wgsl new file mode 100644 index 0000000000..5730ea28b4 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/751377.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn exp2_751377() { + var res : vec3 = exp2(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_751377(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_751377(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_751377(); +} diff --git a/test/tint/builtins/gen/literal/exp2/b408e4.wgsl b/test/tint/builtins/gen/literal/exp2/b408e4.wgsl new file mode 100644 index 0000000000..74f45c4469 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/b408e4.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn exp2(f16) -> f16 +fn exp2_b408e4() { + var res: f16 = exp2(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_b408e4(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_b408e4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_b408e4(); +} diff --git a/test/tint/builtins/gen/literal/exp2/b408e4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/exp2/b408e4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1161b51086 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/b408e4.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void exp2_b408e4() { + float16_t res = exp2(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_b408e4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_b408e4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_b408e4(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp2/b408e4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/exp2/b408e4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ed6bb8d815 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/b408e4.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void exp2_b408e4() { + float16_t res = exp2(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_b408e4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_b408e4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_b408e4(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000029A9E5D1160(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000029A9E5D1160(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/exp2/b408e4.wgsl.expected.glsl b/test/tint/builtins/gen/literal/exp2/b408e4.wgsl.expected.glsl new file mode 100644 index 0000000000..5c041fccfc --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/b408e4.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp2_b408e4() { + float16_t res = exp2(0.0hf); +} + +vec4 vertex_main() { + exp2_b408e4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void exp2_b408e4() { + float16_t res = exp2(0.0hf); +} + +void fragment_main() { + exp2_b408e4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp2_b408e4() { + float16_t res = exp2(0.0hf); +} + +void compute_main() { + exp2_b408e4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp2/b408e4.wgsl.expected.msl b/test/tint/builtins/gen/literal/exp2/b408e4.wgsl.expected.msl new file mode 100644 index 0000000000..144f5ad812 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/b408e4.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void exp2_b408e4() { + half res = exp2(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp2_b408e4(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp2_b408e4(); + return; +} + +kernel void compute_main() { + exp2_b408e4(); + return; +} + diff --git a/test/tint/builtins/gen/literal/exp2/b408e4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/exp2/b408e4.wgsl.expected.spvasm new file mode 100644 index 0000000000..00de130b01 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/b408e4.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp2_b408e4 "exp2_b408e4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%exp2_b408e4 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Exp2 %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %exp2_b408e4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %exp2_b408e4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %exp2_b408e4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/exp2/b408e4.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/exp2/b408e4.wgsl.expected.wgsl new file mode 100644 index 0000000000..65c1649034 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/b408e4.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn exp2_b408e4() { + var res : f16 = exp2(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_b408e4(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_b408e4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_b408e4(); +} diff --git a/test/tint/builtins/gen/literal/exp2/ffa827.wgsl b/test/tint/builtins/gen/literal/exp2/ffa827.wgsl new file mode 100644 index 0000000000..4bbdb03d17 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/ffa827.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn exp2(vec<4, f16>) -> vec<4, f16> +fn exp2_ffa827() { + var res: vec4 = exp2(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_ffa827(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_ffa827(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_ffa827(); +} diff --git a/test/tint/builtins/gen/literal/exp2/ffa827.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/exp2/ffa827.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..744ae477b8 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/ffa827.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void exp2_ffa827() { + vector res = exp2((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_ffa827(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_ffa827(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_ffa827(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp2/ffa827.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/exp2/ffa827.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0806afcb1c --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/ffa827.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void exp2_ffa827() { + vector res = exp2((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_ffa827(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_ffa827(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_ffa827(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D88F07E620(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/exp2/ffa827.wgsl.expected.glsl b/test/tint/builtins/gen/literal/exp2/ffa827.wgsl.expected.glsl new file mode 100644 index 0000000000..960c753ecd --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/ffa827.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp2_ffa827() { + f16vec4 res = exp2(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + exp2_ffa827(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void exp2_ffa827() { + f16vec4 res = exp2(f16vec4(0.0hf)); +} + +void fragment_main() { + exp2_ffa827(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp2_ffa827() { + f16vec4 res = exp2(f16vec4(0.0hf)); +} + +void compute_main() { + exp2_ffa827(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp2/ffa827.wgsl.expected.msl b/test/tint/builtins/gen/literal/exp2/ffa827.wgsl.expected.msl new file mode 100644 index 0000000000..add3f5e0d4 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/ffa827.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void exp2_ffa827() { + half4 res = exp2(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp2_ffa827(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp2_ffa827(); + return; +} + +kernel void compute_main() { + exp2_ffa827(); + return; +} + diff --git a/test/tint/builtins/gen/literal/exp2/ffa827.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/exp2/ffa827.wgsl.expected.spvasm new file mode 100644 index 0000000000..9520e91090 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/ffa827.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp2_ffa827 "exp2_ffa827" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%exp2_ffa827 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Exp2 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %exp2_ffa827 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %exp2_ffa827 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %exp2_ffa827 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/exp2/ffa827.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/exp2/ffa827.wgsl.expected.wgsl new file mode 100644 index 0000000000..230ad07811 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/ffa827.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn exp2_ffa827() { + var res : vec4 = exp2(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_ffa827(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_ffa827(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_ffa827(); +} diff --git a/test/tint/builtins/gen/literal/faceForward/524986.wgsl b/test/tint/builtins/gen/literal/faceForward/524986.wgsl new file mode 100644 index 0000000000..b790070087 --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/524986.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn faceForward(vec<3, f16>, vec<3, f16>, vec<3, f16>) -> vec<3, f16> +fn faceForward_524986() { + var res: vec3 = faceForward(vec3(f16()), vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + faceForward_524986(); + return vec4(); +} + +@fragment +fn fragment_main() { + faceForward_524986(); +} + +@compute @workgroup_size(1) +fn compute_main() { + faceForward_524986(); +} diff --git a/test/tint/builtins/gen/literal/faceForward/524986.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/faceForward/524986.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f9ff2727b4 --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/524986.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void faceForward_524986() { + vector res = faceforward((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + faceForward_524986(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + faceForward_524986(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + faceForward_524986(); + return; +} diff --git a/test/tint/builtins/gen/literal/faceForward/524986.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/faceForward/524986.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d7c9b48080 --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/524986.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void faceForward_524986() { + vector res = faceforward((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + faceForward_524986(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + faceForward_524986(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + faceForward_524986(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E4AB906E90(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/faceForward/524986.wgsl.expected.glsl b/test/tint/builtins/gen/literal/faceForward/524986.wgsl.expected.glsl new file mode 100644 index 0000000000..7f2224323f --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/524986.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void faceForward_524986() { + f16vec3 res = faceforward(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf)); +} + +vec4 vertex_main() { + faceForward_524986(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void faceForward_524986() { + f16vec3 res = faceforward(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf)); +} + +void fragment_main() { + faceForward_524986(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void faceForward_524986() { + f16vec3 res = faceforward(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf)); +} + +void compute_main() { + faceForward_524986(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/faceForward/524986.wgsl.expected.msl b/test/tint/builtins/gen/literal/faceForward/524986.wgsl.expected.msl new file mode 100644 index 0000000000..39be077b6e --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/524986.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void faceForward_524986() { + half3 res = faceforward(half3(0.0h), half3(0.0h), half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + faceForward_524986(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + faceForward_524986(); + return; +} + +kernel void compute_main() { + faceForward_524986(); + return; +} + diff --git a/test/tint/builtins/gen/literal/faceForward/524986.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/faceForward/524986.wgsl.expected.spvasm new file mode 100644 index 0000000000..e9ff4a62c2 --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/524986.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %faceForward_524986 "faceForward_524986" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%faceForward_524986 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 FaceForward %17 %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %faceForward_524986 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %faceForward_524986 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %faceForward_524986 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/faceForward/524986.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/faceForward/524986.wgsl.expected.wgsl new file mode 100644 index 0000000000..9c4ec2bcb4 --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/524986.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn faceForward_524986() { + var res : vec3 = faceForward(vec3(f16()), vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + faceForward_524986(); + return vec4(); +} + +@fragment +fn fragment_main() { + faceForward_524986(); +} + +@compute @workgroup_size(1) +fn compute_main() { + faceForward_524986(); +} diff --git a/test/tint/builtins/gen/literal/faceForward/cc63dc.wgsl b/test/tint/builtins/gen/literal/faceForward/cc63dc.wgsl new file mode 100644 index 0000000000..fb1dcfb4a9 --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/cc63dc.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn faceForward(vec<4, f16>, vec<4, f16>, vec<4, f16>) -> vec<4, f16> +fn faceForward_cc63dc() { + var res: vec4 = faceForward(vec4(f16()), vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + faceForward_cc63dc(); + return vec4(); +} + +@fragment +fn fragment_main() { + faceForward_cc63dc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + faceForward_cc63dc(); +} diff --git a/test/tint/builtins/gen/literal/faceForward/cc63dc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/faceForward/cc63dc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b59f3b0d92 --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/cc63dc.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void faceForward_cc63dc() { + vector res = faceforward((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + faceForward_cc63dc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + faceForward_cc63dc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + faceForward_cc63dc(); + return; +} diff --git a/test/tint/builtins/gen/literal/faceForward/cc63dc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/faceForward/cc63dc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b33b557d7a --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/cc63dc.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void faceForward_cc63dc() { + vector res = faceforward((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + faceForward_cc63dc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + faceForward_cc63dc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + faceForward_cc63dc(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000029C52499560(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/faceForward/cc63dc.wgsl.expected.glsl b/test/tint/builtins/gen/literal/faceForward/cc63dc.wgsl.expected.glsl new file mode 100644 index 0000000000..ab00ae17f1 --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/cc63dc.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void faceForward_cc63dc() { + f16vec4 res = faceforward(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf)); +} + +vec4 vertex_main() { + faceForward_cc63dc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void faceForward_cc63dc() { + f16vec4 res = faceforward(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf)); +} + +void fragment_main() { + faceForward_cc63dc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void faceForward_cc63dc() { + f16vec4 res = faceforward(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf)); +} + +void compute_main() { + faceForward_cc63dc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/faceForward/cc63dc.wgsl.expected.msl b/test/tint/builtins/gen/literal/faceForward/cc63dc.wgsl.expected.msl new file mode 100644 index 0000000000..982ab0a85e --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/cc63dc.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void faceForward_cc63dc() { + half4 res = faceforward(half4(0.0h), half4(0.0h), half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + faceForward_cc63dc(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + faceForward_cc63dc(); + return; +} + +kernel void compute_main() { + faceForward_cc63dc(); + return; +} + diff --git a/test/tint/builtins/gen/literal/faceForward/cc63dc.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/faceForward/cc63dc.wgsl.expected.spvasm new file mode 100644 index 0000000000..bfa79fb729 --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/cc63dc.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %faceForward_cc63dc "faceForward_cc63dc" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%faceForward_cc63dc = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 FaceForward %17 %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %faceForward_cc63dc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %faceForward_cc63dc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %faceForward_cc63dc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/faceForward/cc63dc.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/faceForward/cc63dc.wgsl.expected.wgsl new file mode 100644 index 0000000000..1fca87128c --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/cc63dc.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn faceForward_cc63dc() { + var res : vec4 = faceForward(vec4(f16()), vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + faceForward_cc63dc(); + return vec4(); +} + +@fragment +fn fragment_main() { + faceForward_cc63dc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + faceForward_cc63dc(); +} diff --git a/test/tint/builtins/gen/literal/faceForward/fb0f2e.wgsl b/test/tint/builtins/gen/literal/faceForward/fb0f2e.wgsl new file mode 100644 index 0000000000..bf8db4f6d0 --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/fb0f2e.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn faceForward(vec<2, f16>, vec<2, f16>, vec<2, f16>) -> vec<2, f16> +fn faceForward_fb0f2e() { + var res: vec2 = faceForward(vec2(f16()), vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + faceForward_fb0f2e(); + return vec4(); +} + +@fragment +fn fragment_main() { + faceForward_fb0f2e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + faceForward_fb0f2e(); +} diff --git a/test/tint/builtins/gen/literal/faceForward/fb0f2e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/faceForward/fb0f2e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a4205ab370 --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/fb0f2e.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void faceForward_fb0f2e() { + vector res = faceforward((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + faceForward_fb0f2e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + faceForward_fb0f2e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + faceForward_fb0f2e(); + return; +} diff --git a/test/tint/builtins/gen/literal/faceForward/fb0f2e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/faceForward/fb0f2e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9b647bd257 --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/fb0f2e.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void faceForward_fb0f2e() { + vector res = faceforward((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + faceForward_fb0f2e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + faceForward_fb0f2e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + faceForward_fb0f2e(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000153714C6E90(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/faceForward/fb0f2e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/faceForward/fb0f2e.wgsl.expected.glsl new file mode 100644 index 0000000000..6682c02cda --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/fb0f2e.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void faceForward_fb0f2e() { + f16vec2 res = faceforward(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf)); +} + +vec4 vertex_main() { + faceForward_fb0f2e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void faceForward_fb0f2e() { + f16vec2 res = faceforward(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf)); +} + +void fragment_main() { + faceForward_fb0f2e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void faceForward_fb0f2e() { + f16vec2 res = faceforward(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf)); +} + +void compute_main() { + faceForward_fb0f2e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/faceForward/fb0f2e.wgsl.expected.msl b/test/tint/builtins/gen/literal/faceForward/fb0f2e.wgsl.expected.msl new file mode 100644 index 0000000000..9c07359dab --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/fb0f2e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void faceForward_fb0f2e() { + half2 res = faceforward(half2(0.0h), half2(0.0h), half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + faceForward_fb0f2e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + faceForward_fb0f2e(); + return; +} + +kernel void compute_main() { + faceForward_fb0f2e(); + return; +} + diff --git a/test/tint/builtins/gen/literal/faceForward/fb0f2e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/faceForward/fb0f2e.wgsl.expected.spvasm new file mode 100644 index 0000000000..20da05411e --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/fb0f2e.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %faceForward_fb0f2e "faceForward_fb0f2e" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%faceForward_fb0f2e = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 FaceForward %17 %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %faceForward_fb0f2e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %faceForward_fb0f2e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %faceForward_fb0f2e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/faceForward/fb0f2e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/faceForward/fb0f2e.wgsl.expected.wgsl new file mode 100644 index 0000000000..96b39add4a --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/fb0f2e.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn faceForward_fb0f2e() { + var res : vec2 = faceForward(vec2(f16()), vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + faceForward_fb0f2e(); + return vec4(); +} + +@fragment +fn fragment_main() { + faceForward_fb0f2e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + faceForward_fb0f2e(); +} diff --git a/test/tint/builtins/gen/literal/floor/3802c0.wgsl b/test/tint/builtins/gen/literal/floor/3802c0.wgsl new file mode 100644 index 0000000000..bbe70eeaef --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/3802c0.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn floor(vec<3, f16>) -> vec<3, f16> +fn floor_3802c0() { + var res: vec3 = floor(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_3802c0(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_3802c0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_3802c0(); +} diff --git a/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..abaa1f39e2 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void floor_3802c0() { + vector res = floor((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_3802c0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_3802c0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_3802c0(); + return; +} diff --git a/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2257a33697 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void floor_3802c0() { + vector res = floor((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_3802c0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_3802c0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_3802c0(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024B0BC4CD50(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.glsl b/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.glsl new file mode 100644 index 0000000000..0ffee0a5f1 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void floor_3802c0() { + f16vec3 res = floor(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + floor_3802c0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void floor_3802c0() { + f16vec3 res = floor(f16vec3(0.0hf)); +} + +void fragment_main() { + floor_3802c0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void floor_3802c0() { + f16vec3 res = floor(f16vec3(0.0hf)); +} + +void compute_main() { + floor_3802c0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.msl b/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.msl new file mode 100644 index 0000000000..b74bfc8bf0 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void floor_3802c0() { + half3 res = floor(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + floor_3802c0(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + floor_3802c0(); + return; +} + +kernel void compute_main() { + floor_3802c0(); + return; +} + diff --git a/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.spvasm new file mode 100644 index 0000000000..840d0b0efc --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %floor_3802c0 "floor_3802c0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%floor_3802c0 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Floor %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %floor_3802c0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %floor_3802c0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %floor_3802c0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.wgsl new file mode 100644 index 0000000000..454c66907c --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn floor_3802c0() { + var res : vec3 = floor(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_3802c0(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_3802c0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_3802c0(); +} diff --git a/test/tint/builtins/gen/literal/floor/84658c.wgsl b/test/tint/builtins/gen/literal/floor/84658c.wgsl new file mode 100644 index 0000000000..77a94d5e7c --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/84658c.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn floor(vec<2, f16>) -> vec<2, f16> +fn floor_84658c() { + var res: vec2 = floor(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_84658c(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_84658c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_84658c(); +} diff --git a/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9d9b33b406 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void floor_84658c() { + vector res = floor((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_84658c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_84658c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_84658c(); + return; +} diff --git a/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a7f1d0452d --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void floor_84658c() { + vector res = floor((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_84658c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_84658c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_84658c(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F339C96B50(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.glsl new file mode 100644 index 0000000000..5ce59ffcb5 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void floor_84658c() { + f16vec2 res = floor(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + floor_84658c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void floor_84658c() { + f16vec2 res = floor(f16vec2(0.0hf)); +} + +void fragment_main() { + floor_84658c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void floor_84658c() { + f16vec2 res = floor(f16vec2(0.0hf)); +} + +void compute_main() { + floor_84658c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.msl b/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.msl new file mode 100644 index 0000000000..8167d864e8 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void floor_84658c() { + half2 res = floor(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + floor_84658c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + floor_84658c(); + return; +} + +kernel void compute_main() { + floor_84658c(); + return; +} + diff --git a/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.spvasm new file mode 100644 index 0000000000..2ba5308c85 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %floor_84658c "floor_84658c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%floor_84658c = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Floor %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %floor_84658c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %floor_84658c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %floor_84658c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.wgsl new file mode 100644 index 0000000000..bbf2ee4968 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn floor_84658c() { + var res : vec2 = floor(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_84658c(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_84658c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_84658c(); +} diff --git a/test/tint/builtins/gen/literal/floor/a2d31b.wgsl b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl new file mode 100644 index 0000000000..f64f4ec30c --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn floor(vec<4, f16>) -> vec<4, f16> +fn floor_a2d31b() { + var res: vec4 = floor(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_a2d31b(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_a2d31b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_a2d31b(); +} diff --git a/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8df627e0d8 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void floor_a2d31b() { + vector res = floor((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_a2d31b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_a2d31b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_a2d31b(); + return; +} diff --git a/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2503575088 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void floor_a2d31b() { + vector res = floor((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_a2d31b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_a2d31b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_a2d31b(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002A78E20C3E0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.glsl new file mode 100644 index 0000000000..fa86b13918 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void floor_a2d31b() { + f16vec4 res = floor(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + floor_a2d31b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void floor_a2d31b() { + f16vec4 res = floor(f16vec4(0.0hf)); +} + +void fragment_main() { + floor_a2d31b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void floor_a2d31b() { + f16vec4 res = floor(f16vec4(0.0hf)); +} + +void compute_main() { + floor_a2d31b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.msl b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.msl new file mode 100644 index 0000000000..11dab7e86c --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void floor_a2d31b() { + half4 res = floor(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + floor_a2d31b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + floor_a2d31b(); + return; +} + +kernel void compute_main() { + floor_a2d31b(); + return; +} + diff --git a/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.spvasm new file mode 100644 index 0000000000..f54987e285 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %floor_a2d31b "floor_a2d31b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%floor_a2d31b = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Floor %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %floor_a2d31b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %floor_a2d31b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %floor_a2d31b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.wgsl new file mode 100644 index 0000000000..54977de3dc --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn floor_a2d31b() { + var res : vec4 = floor(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_a2d31b(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_a2d31b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_a2d31b(); +} diff --git a/test/tint/builtins/gen/literal/floor/b6e09c.wgsl b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl new file mode 100644 index 0000000000..5defc3121b --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn floor(f16) -> f16 +fn floor_b6e09c() { + var res: f16 = floor(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_b6e09c(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_b6e09c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_b6e09c(); +} diff --git a/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4e9023c6f8 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void floor_b6e09c() { + float16_t res = floor(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_b6e09c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_b6e09c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_b6e09c(); + return; +} diff --git a/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b56d8ce344 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void floor_b6e09c() { + float16_t res = floor(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_b6e09c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_b6e09c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_b6e09c(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002DCF5190520(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002DCF5190520(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.glsl new file mode 100644 index 0000000000..9e3b55de60 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void floor_b6e09c() { + float16_t res = floor(0.0hf); +} + +vec4 vertex_main() { + floor_b6e09c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void floor_b6e09c() { + float16_t res = floor(0.0hf); +} + +void fragment_main() { + floor_b6e09c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void floor_b6e09c() { + float16_t res = floor(0.0hf); +} + +void compute_main() { + floor_b6e09c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.msl b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.msl new file mode 100644 index 0000000000..5123ed2bb5 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void floor_b6e09c() { + half res = floor(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + floor_b6e09c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + floor_b6e09c(); + return; +} + +kernel void compute_main() { + floor_b6e09c(); + return; +} + diff --git a/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.spvasm new file mode 100644 index 0000000000..4d351dd750 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %floor_b6e09c "floor_b6e09c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%floor_b6e09c = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Floor %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %floor_b6e09c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %floor_b6e09c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %floor_b6e09c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.wgsl new file mode 100644 index 0000000000..59a04ccd30 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn floor_b6e09c() { + var res : f16 = floor(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_b6e09c(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_b6e09c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_b6e09c(); +} diff --git a/test/tint/builtins/gen/literal/fma/ab7818.wgsl b/test/tint/builtins/gen/literal/fma/ab7818.wgsl new file mode 100644 index 0000000000..025402375f --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/ab7818.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn fma(vec<4, f16>, vec<4, f16>, vec<4, f16>) -> vec<4, f16> +fn fma_ab7818() { + var res: vec4 = fma(vec4(f16()), vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_ab7818(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_ab7818(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_ab7818(); +} diff --git a/test/tint/builtins/gen/literal/fma/ab7818.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/fma/ab7818.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0621f2a731 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/ab7818.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void fma_ab7818() { + vector res = mad((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_ab7818(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_ab7818(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_ab7818(); + return; +} diff --git a/test/tint/builtins/gen/literal/fma/ab7818.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/fma/ab7818.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4aee5aeb13 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/ab7818.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void fma_ab7818() { + vector res = mad((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_ab7818(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_ab7818(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_ab7818(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000130923E6FF0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/fma/ab7818.wgsl.expected.glsl b/test/tint/builtins/gen/literal/fma/ab7818.wgsl.expected.glsl new file mode 100644 index 0000000000..ea533429c1 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/ab7818.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fma_ab7818() { + f16vec4 res = ((f16vec4(0.0hf)) * (f16vec4(0.0hf)) + (f16vec4(0.0hf))); +} + +vec4 vertex_main() { + fma_ab7818(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void fma_ab7818() { + f16vec4 res = ((f16vec4(0.0hf)) * (f16vec4(0.0hf)) + (f16vec4(0.0hf))); +} + +void fragment_main() { + fma_ab7818(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fma_ab7818() { + f16vec4 res = ((f16vec4(0.0hf)) * (f16vec4(0.0hf)) + (f16vec4(0.0hf))); +} + +void compute_main() { + fma_ab7818(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/fma/ab7818.wgsl.expected.msl b/test/tint/builtins/gen/literal/fma/ab7818.wgsl.expected.msl new file mode 100644 index 0000000000..1e222235cf --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/ab7818.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void fma_ab7818() { + half4 res = fma(half4(0.0h), half4(0.0h), half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fma_ab7818(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fma_ab7818(); + return; +} + +kernel void compute_main() { + fma_ab7818(); + return; +} + diff --git a/test/tint/builtins/gen/literal/fma/ab7818.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/fma/ab7818.wgsl.expected.spvasm new file mode 100644 index 0000000000..a5bc45f0a8 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/ab7818.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fma_ab7818 "fma_ab7818" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %fma_ab7818 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Fma %17 %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %fma_ab7818 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %fma_ab7818 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %fma_ab7818 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/fma/ab7818.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/fma/ab7818.wgsl.expected.wgsl new file mode 100644 index 0000000000..0732ab88bc --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/ab7818.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn fma_ab7818() { + var res : vec4 = fma(vec4(f16()), vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_ab7818(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_ab7818(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_ab7818(); +} diff --git a/test/tint/builtins/gen/literal/fma/bf21b6.wgsl b/test/tint/builtins/gen/literal/fma/bf21b6.wgsl new file mode 100644 index 0000000000..332799fe60 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/bf21b6.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn fma(vec<2, f16>, vec<2, f16>, vec<2, f16>) -> vec<2, f16> +fn fma_bf21b6() { + var res: vec2 = fma(vec2(f16()), vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_bf21b6(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_bf21b6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_bf21b6(); +} diff --git a/test/tint/builtins/gen/literal/fma/bf21b6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/fma/bf21b6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..85963f933f --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/bf21b6.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void fma_bf21b6() { + vector res = mad((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_bf21b6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_bf21b6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_bf21b6(); + return; +} diff --git a/test/tint/builtins/gen/literal/fma/bf21b6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/fma/bf21b6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cad7d14572 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/bf21b6.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void fma_bf21b6() { + vector res = mad((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_bf21b6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_bf21b6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_bf21b6(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018F50BF5D50(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/fma/bf21b6.wgsl.expected.glsl b/test/tint/builtins/gen/literal/fma/bf21b6.wgsl.expected.glsl new file mode 100644 index 0000000000..576c850f0d --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/bf21b6.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fma_bf21b6() { + f16vec2 res = ((f16vec2(0.0hf)) * (f16vec2(0.0hf)) + (f16vec2(0.0hf))); +} + +vec4 vertex_main() { + fma_bf21b6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void fma_bf21b6() { + f16vec2 res = ((f16vec2(0.0hf)) * (f16vec2(0.0hf)) + (f16vec2(0.0hf))); +} + +void fragment_main() { + fma_bf21b6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fma_bf21b6() { + f16vec2 res = ((f16vec2(0.0hf)) * (f16vec2(0.0hf)) + (f16vec2(0.0hf))); +} + +void compute_main() { + fma_bf21b6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/fma/bf21b6.wgsl.expected.msl b/test/tint/builtins/gen/literal/fma/bf21b6.wgsl.expected.msl new file mode 100644 index 0000000000..7d0d9dfe47 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/bf21b6.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void fma_bf21b6() { + half2 res = fma(half2(0.0h), half2(0.0h), half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fma_bf21b6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fma_bf21b6(); + return; +} + +kernel void compute_main() { + fma_bf21b6(); + return; +} + diff --git a/test/tint/builtins/gen/literal/fma/bf21b6.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/fma/bf21b6.wgsl.expected.spvasm new file mode 100644 index 0000000000..4759d350cd --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/bf21b6.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fma_bf21b6 "fma_bf21b6" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %fma_bf21b6 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Fma %17 %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %fma_bf21b6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %fma_bf21b6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %fma_bf21b6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/fma/bf21b6.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/fma/bf21b6.wgsl.expected.wgsl new file mode 100644 index 0000000000..dcd733b4e5 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/bf21b6.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn fma_bf21b6() { + var res : vec2 = fma(vec2(f16()), vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_bf21b6(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_bf21b6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_bf21b6(); +} diff --git a/test/tint/builtins/gen/literal/fma/c8abb3.wgsl b/test/tint/builtins/gen/literal/fma/c8abb3.wgsl new file mode 100644 index 0000000000..5e605cc7a6 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/c8abb3.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn fma(f16, f16, f16) -> f16 +fn fma_c8abb3() { + var res: f16 = fma(f16(), f16(), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_c8abb3(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_c8abb3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_c8abb3(); +} diff --git a/test/tint/builtins/gen/literal/fma/c8abb3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/fma/c8abb3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..02d0e31166 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/c8abb3.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void fma_c8abb3() { + float16_t res = mad(float16_t(0.0h), float16_t(0.0h), float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_c8abb3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_c8abb3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_c8abb3(); + return; +} diff --git a/test/tint/builtins/gen/literal/fma/c8abb3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/fma/c8abb3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ce74e5a5c1 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/c8abb3.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void fma_c8abb3() { + float16_t res = mad(float16_t(0.0h), float16_t(0.0h), float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_c8abb3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_c8abb3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_c8abb3(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001A4E652BA80(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001A4E652BA80(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/fma/c8abb3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/fma/c8abb3.wgsl.expected.glsl new file mode 100644 index 0000000000..86e6a49ed2 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/c8abb3.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fma_c8abb3() { + float16_t res = ((0.0hf) * (0.0hf) + (0.0hf)); +} + +vec4 vertex_main() { + fma_c8abb3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void fma_c8abb3() { + float16_t res = ((0.0hf) * (0.0hf) + (0.0hf)); +} + +void fragment_main() { + fma_c8abb3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fma_c8abb3() { + float16_t res = ((0.0hf) * (0.0hf) + (0.0hf)); +} + +void compute_main() { + fma_c8abb3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/fma/c8abb3.wgsl.expected.msl b/test/tint/builtins/gen/literal/fma/c8abb3.wgsl.expected.msl new file mode 100644 index 0000000000..9222c9b236 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/c8abb3.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void fma_c8abb3() { + half res = fma(0.0h, 0.0h, 0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fma_c8abb3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fma_c8abb3(); + return; +} + +kernel void compute_main() { + fma_c8abb3(); + return; +} + diff --git a/test/tint/builtins/gen/literal/fma/c8abb3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/fma/c8abb3.wgsl.expected.spvasm new file mode 100644 index 0000000000..bc7d248451 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/c8abb3.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fma_c8abb3 "fma_c8abb3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %fma_c8abb3 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Fma %16 %16 %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %fma_c8abb3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %fma_c8abb3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %fma_c8abb3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/fma/c8abb3.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/fma/c8abb3.wgsl.expected.wgsl new file mode 100644 index 0000000000..44eba4373c --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/c8abb3.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn fma_c8abb3() { + var res : f16 = fma(f16(), f16(), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_c8abb3(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_c8abb3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_c8abb3(); +} diff --git a/test/tint/builtins/gen/literal/fma/e7abdc.wgsl b/test/tint/builtins/gen/literal/fma/e7abdc.wgsl new file mode 100644 index 0000000000..765d3e6349 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/e7abdc.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn fma(vec<3, f16>, vec<3, f16>, vec<3, f16>) -> vec<3, f16> +fn fma_e7abdc() { + var res: vec3 = fma(vec3(f16()), vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_e7abdc(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_e7abdc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_e7abdc(); +} diff --git a/test/tint/builtins/gen/literal/fma/e7abdc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/fma/e7abdc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5ab1666763 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/e7abdc.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void fma_e7abdc() { + vector res = mad((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_e7abdc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_e7abdc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_e7abdc(); + return; +} diff --git a/test/tint/builtins/gen/literal/fma/e7abdc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/fma/e7abdc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2d0f609c60 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/e7abdc.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void fma_e7abdc() { + vector res = mad((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_e7abdc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_e7abdc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_e7abdc(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001A860253980(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/fma/e7abdc.wgsl.expected.glsl b/test/tint/builtins/gen/literal/fma/e7abdc.wgsl.expected.glsl new file mode 100644 index 0000000000..c4e4c74171 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/e7abdc.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fma_e7abdc() { + f16vec3 res = ((f16vec3(0.0hf)) * (f16vec3(0.0hf)) + (f16vec3(0.0hf))); +} + +vec4 vertex_main() { + fma_e7abdc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void fma_e7abdc() { + f16vec3 res = ((f16vec3(0.0hf)) * (f16vec3(0.0hf)) + (f16vec3(0.0hf))); +} + +void fragment_main() { + fma_e7abdc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fma_e7abdc() { + f16vec3 res = ((f16vec3(0.0hf)) * (f16vec3(0.0hf)) + (f16vec3(0.0hf))); +} + +void compute_main() { + fma_e7abdc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/fma/e7abdc.wgsl.expected.msl b/test/tint/builtins/gen/literal/fma/e7abdc.wgsl.expected.msl new file mode 100644 index 0000000000..3622508c6c --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/e7abdc.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void fma_e7abdc() { + half3 res = fma(half3(0.0h), half3(0.0h), half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fma_e7abdc(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fma_e7abdc(); + return; +} + +kernel void compute_main() { + fma_e7abdc(); + return; +} + diff --git a/test/tint/builtins/gen/literal/fma/e7abdc.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/fma/e7abdc.wgsl.expected.spvasm new file mode 100644 index 0000000000..daa3de58c5 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/e7abdc.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fma_e7abdc "fma_e7abdc" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %fma_e7abdc = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Fma %17 %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %fma_e7abdc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %fma_e7abdc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %fma_e7abdc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/fma/e7abdc.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/fma/e7abdc.wgsl.expected.wgsl new file mode 100644 index 0000000000..45afac175a --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/e7abdc.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn fma_e7abdc() { + var res : vec3 = fma(vec3(f16()), vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_e7abdc(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_e7abdc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_e7abdc(); +} diff --git a/test/tint/builtins/gen/literal/fract/181aa9.wgsl b/test/tint/builtins/gen/literal/fract/181aa9.wgsl new file mode 100644 index 0000000000..df799a0bec --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/181aa9.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn fract(vec<2, f16>) -> vec<2, f16> +fn fract_181aa9() { + var res: vec2 = fract(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_181aa9(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_181aa9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_181aa9(); +} diff --git a/test/tint/builtins/gen/literal/fract/181aa9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/fract/181aa9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ff11d3850a --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/181aa9.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void fract_181aa9() { + vector res = frac((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_181aa9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_181aa9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_181aa9(); + return; +} diff --git a/test/tint/builtins/gen/literal/fract/181aa9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/fract/181aa9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c6bb42ea23 --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/181aa9.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void fract_181aa9() { + vector res = frac((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_181aa9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_181aa9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_181aa9(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021E70B80AC0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/fract/181aa9.wgsl.expected.glsl b/test/tint/builtins/gen/literal/fract/181aa9.wgsl.expected.glsl new file mode 100644 index 0000000000..1e4d6bf48b --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/181aa9.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fract_181aa9() { + f16vec2 res = fract(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + fract_181aa9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void fract_181aa9() { + f16vec2 res = fract(f16vec2(0.0hf)); +} + +void fragment_main() { + fract_181aa9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fract_181aa9() { + f16vec2 res = fract(f16vec2(0.0hf)); +} + +void compute_main() { + fract_181aa9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/fract/181aa9.wgsl.expected.msl b/test/tint/builtins/gen/literal/fract/181aa9.wgsl.expected.msl new file mode 100644 index 0000000000..b807118476 --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/181aa9.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void fract_181aa9() { + half2 res = fract(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fract_181aa9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fract_181aa9(); + return; +} + +kernel void compute_main() { + fract_181aa9(); + return; +} + diff --git a/test/tint/builtins/gen/literal/fract/181aa9.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/fract/181aa9.wgsl.expected.spvasm new file mode 100644 index 0000000000..1bd3c4f73b --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/181aa9.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fract_181aa9 "fract_181aa9" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%fract_181aa9 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Fract %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %fract_181aa9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %fract_181aa9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %fract_181aa9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/fract/181aa9.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/fract/181aa9.wgsl.expected.wgsl new file mode 100644 index 0000000000..fbad3966ae --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/181aa9.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn fract_181aa9() { + var res : vec2 = fract(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_181aa9(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_181aa9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_181aa9(); +} diff --git a/test/tint/builtins/gen/literal/fract/498c77.wgsl b/test/tint/builtins/gen/literal/fract/498c77.wgsl new file mode 100644 index 0000000000..5f4dd0e9f0 --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/498c77.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn fract(vec<4, f16>) -> vec<4, f16> +fn fract_498c77() { + var res: vec4 = fract(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_498c77(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_498c77(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_498c77(); +} diff --git a/test/tint/builtins/gen/literal/fract/498c77.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/fract/498c77.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b6fe7b1074 --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/498c77.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void fract_498c77() { + vector res = frac((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_498c77(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_498c77(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_498c77(); + return; +} diff --git a/test/tint/builtins/gen/literal/fract/498c77.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/fract/498c77.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..579a05a4bf --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/498c77.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void fract_498c77() { + vector res = frac((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_498c77(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_498c77(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_498c77(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000293E8528810(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/fract/498c77.wgsl.expected.glsl b/test/tint/builtins/gen/literal/fract/498c77.wgsl.expected.glsl new file mode 100644 index 0000000000..352a8ee81f --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/498c77.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fract_498c77() { + f16vec4 res = fract(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + fract_498c77(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void fract_498c77() { + f16vec4 res = fract(f16vec4(0.0hf)); +} + +void fragment_main() { + fract_498c77(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fract_498c77() { + f16vec4 res = fract(f16vec4(0.0hf)); +} + +void compute_main() { + fract_498c77(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/fract/498c77.wgsl.expected.msl b/test/tint/builtins/gen/literal/fract/498c77.wgsl.expected.msl new file mode 100644 index 0000000000..02f42f436c --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/498c77.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void fract_498c77() { + half4 res = fract(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fract_498c77(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fract_498c77(); + return; +} + +kernel void compute_main() { + fract_498c77(); + return; +} + diff --git a/test/tint/builtins/gen/literal/fract/498c77.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/fract/498c77.wgsl.expected.spvasm new file mode 100644 index 0000000000..8ab3fda8d6 --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/498c77.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fract_498c77 "fract_498c77" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%fract_498c77 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Fract %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %fract_498c77 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %fract_498c77 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %fract_498c77 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/fract/498c77.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/fract/498c77.wgsl.expected.wgsl new file mode 100644 index 0000000000..33a0794881 --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/498c77.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn fract_498c77() { + var res : vec4 = fract(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_498c77(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_498c77(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_498c77(); +} diff --git a/test/tint/builtins/gen/literal/fract/958a1d.wgsl b/test/tint/builtins/gen/literal/fract/958a1d.wgsl new file mode 100644 index 0000000000..a2c98fd09f --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/958a1d.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn fract(vec<3, f16>) -> vec<3, f16> +fn fract_958a1d() { + var res: vec3 = fract(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_958a1d(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_958a1d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_958a1d(); +} diff --git a/test/tint/builtins/gen/literal/fract/958a1d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/fract/958a1d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0c8e9a6ccc --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/958a1d.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void fract_958a1d() { + vector res = frac((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_958a1d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_958a1d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_958a1d(); + return; +} diff --git a/test/tint/builtins/gen/literal/fract/958a1d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/fract/958a1d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f2fcd481b5 --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/958a1d.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void fract_958a1d() { + vector res = frac((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_958a1d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_958a1d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_958a1d(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001490DA5B940(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/fract/958a1d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/fract/958a1d.wgsl.expected.glsl new file mode 100644 index 0000000000..19520f77f3 --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/958a1d.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fract_958a1d() { + f16vec3 res = fract(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + fract_958a1d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void fract_958a1d() { + f16vec3 res = fract(f16vec3(0.0hf)); +} + +void fragment_main() { + fract_958a1d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fract_958a1d() { + f16vec3 res = fract(f16vec3(0.0hf)); +} + +void compute_main() { + fract_958a1d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/fract/958a1d.wgsl.expected.msl b/test/tint/builtins/gen/literal/fract/958a1d.wgsl.expected.msl new file mode 100644 index 0000000000..fb0e54ae3e --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/958a1d.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void fract_958a1d() { + half3 res = fract(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fract_958a1d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fract_958a1d(); + return; +} + +kernel void compute_main() { + fract_958a1d(); + return; +} + diff --git a/test/tint/builtins/gen/literal/fract/958a1d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/fract/958a1d.wgsl.expected.spvasm new file mode 100644 index 0000000000..ea074c7a12 --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/958a1d.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fract_958a1d "fract_958a1d" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%fract_958a1d = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Fract %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %fract_958a1d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %fract_958a1d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %fract_958a1d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/fract/958a1d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/fract/958a1d.wgsl.expected.wgsl new file mode 100644 index 0000000000..c5cafe6b0e --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/958a1d.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn fract_958a1d() { + var res : vec3 = fract(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_958a1d(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_958a1d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_958a1d(); +} diff --git a/test/tint/builtins/gen/literal/fract/eb38ce.wgsl b/test/tint/builtins/gen/literal/fract/eb38ce.wgsl new file mode 100644 index 0000000000..e502ba9884 --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/eb38ce.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn fract(f16) -> f16 +fn fract_eb38ce() { + var res: f16 = fract(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_eb38ce(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_eb38ce(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_eb38ce(); +} diff --git a/test/tint/builtins/gen/literal/fract/eb38ce.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/fract/eb38ce.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ffebafe253 --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/eb38ce.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void fract_eb38ce() { + float16_t res = frac(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_eb38ce(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_eb38ce(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_eb38ce(); + return; +} diff --git a/test/tint/builtins/gen/literal/fract/eb38ce.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/fract/eb38ce.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4bccb6efce --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/eb38ce.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void fract_eb38ce() { + float16_t res = frac(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_eb38ce(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_eb38ce(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_eb38ce(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000230E569A8C0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000230E569A8C0(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/fract/eb38ce.wgsl.expected.glsl b/test/tint/builtins/gen/literal/fract/eb38ce.wgsl.expected.glsl new file mode 100644 index 0000000000..ba80d87081 --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/eb38ce.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fract_eb38ce() { + float16_t res = fract(0.0hf); +} + +vec4 vertex_main() { + fract_eb38ce(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void fract_eb38ce() { + float16_t res = fract(0.0hf); +} + +void fragment_main() { + fract_eb38ce(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fract_eb38ce() { + float16_t res = fract(0.0hf); +} + +void compute_main() { + fract_eb38ce(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/fract/eb38ce.wgsl.expected.msl b/test/tint/builtins/gen/literal/fract/eb38ce.wgsl.expected.msl new file mode 100644 index 0000000000..7b6600f5bd --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/eb38ce.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void fract_eb38ce() { + half res = fract(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fract_eb38ce(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fract_eb38ce(); + return; +} + +kernel void compute_main() { + fract_eb38ce(); + return; +} + diff --git a/test/tint/builtins/gen/literal/fract/eb38ce.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/fract/eb38ce.wgsl.expected.spvasm new file mode 100644 index 0000000000..0cb23c02dc --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/eb38ce.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fract_eb38ce "fract_eb38ce" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%fract_eb38ce = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Fract %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %fract_eb38ce + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %fract_eb38ce + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %fract_eb38ce + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/fract/eb38ce.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/fract/eb38ce.wgsl.expected.wgsl new file mode 100644 index 0000000000..11a5545e7b --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/eb38ce.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn fract_eb38ce() { + var res : f16 = fract(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_eb38ce(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_eb38ce(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_eb38ce(); +} diff --git a/test/tint/builtins/gen/literal/frexp/3dd21e.wgsl b/test/tint/builtins/gen/literal/frexp/3dd21e.wgsl new file mode 100644 index 0000000000..12ecb47908 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/3dd21e.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn frexp(vec<4, f16>) -> __frexp_result_vec<4, f16> +fn frexp_3dd21e() { + var res = frexp(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_3dd21e(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_3dd21e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_3dd21e(); +} diff --git a/test/tint/builtins/gen/literal/frexp/3dd21e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/frexp/3dd21e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a2155f1540 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/3dd21e.wgsl.expected.dxc.hlsl @@ -0,0 +1,41 @@ +struct frexp_result_vec4_f16 { + vector sig; + int4 exp; +}; +frexp_result_vec4_f16 tint_frexp(vector param_0) { + vector exp; + vector sig = frexp(param_0, exp); + frexp_result_vec4_f16 result = {sig, int4(exp)}; + return result; +} + +void frexp_3dd21e() { + frexp_result_vec4_f16 res = tint_frexp((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_3dd21e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_3dd21e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_3dd21e(); + return; +} diff --git a/test/tint/builtins/gen/literal/frexp/3dd21e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/frexp/3dd21e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..45fbb59dc1 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/3dd21e.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +SKIP: FAILED + +struct frexp_result_vec4_f16 { + vector sig; + int4 exp; +}; +frexp_result_vec4_f16 tint_frexp(vector param_0) { + vector exp; + vector sig = frexp(param_0, exp); + frexp_result_vec4_f16 result = {sig, int4(exp)}; + return result; +} + +void frexp_3dd21e() { + frexp_result_vec4_f16 res = tint_frexp((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_3dd21e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_3dd21e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_3dd21e(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D4F5EB9720(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/frexp/3dd21e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/frexp/3dd21e.wgsl.expected.glsl new file mode 100644 index 0000000000..ba7ca1fd8a --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/3dd21e.wgsl.expected.glsl @@ -0,0 +1,88 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct frexp_result_vec4_f16 { + f16vec4 sig; + ivec4 exp; +}; + +frexp_result_vec4_f16 tint_frexp(f16vec4 param_0) { + frexp_result_vec4_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_3dd21e() { + frexp_result_vec4_f16 res = tint_frexp(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + frexp_3dd21e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +struct frexp_result_vec4_f16 { + f16vec4 sig; + ivec4 exp; +}; + +frexp_result_vec4_f16 tint_frexp(f16vec4 param_0) { + frexp_result_vec4_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_3dd21e() { + frexp_result_vec4_f16 res = tint_frexp(f16vec4(0.0hf)); +} + +void fragment_main() { + frexp_3dd21e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct frexp_result_vec4_f16 { + f16vec4 sig; + ivec4 exp; +}; + +frexp_result_vec4_f16 tint_frexp(f16vec4 param_0) { + frexp_result_vec4_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_3dd21e() { + frexp_result_vec4_f16 res = tint_frexp(f16vec4(0.0hf)); +} + +void compute_main() { + frexp_3dd21e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/frexp/3dd21e.wgsl.expected.msl b/test/tint/builtins/gen/literal/frexp/3dd21e.wgsl.expected.msl new file mode 100644 index 0000000000..91c87e7a29 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/3dd21e.wgsl.expected.msl @@ -0,0 +1,44 @@ +#include + +using namespace metal; + +struct frexp_result_vec4_f16 { + half4 sig; + int4 exp; +}; +frexp_result_vec4_f16 tint_frexp(half4 param_0) { + frexp_result_vec4_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + +void frexp_3dd21e() { + frexp_result_vec4_f16 res = tint_frexp(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + frexp_3dd21e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + frexp_3dd21e(); + return; +} + +kernel void compute_main() { + frexp_3dd21e(); + return; +} + diff --git a/test/tint/builtins/gen/literal/frexp/3dd21e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/frexp/3dd21e.wgsl.expected.spvasm new file mode 100644 index 0000000000..6585dc03fd --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/3dd21e.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %frexp_3dd21e "frexp_3dd21e" + OpName %__frexp_result_vec4_f16 "__frexp_result_vec4_f16" + OpMemberName %__frexp_result_vec4_f16 0 "sig" + OpMemberName %__frexp_result_vec4_f16 1 "exp" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__frexp_result_vec4_f16 0 Offset 0 + OpMemberDecorate %__frexp_result_vec4_f16 1 Offset 16 + %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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 +%__frexp_result_vec4_f16 = OpTypeStruct %v4half %v4int + %20 = OpConstantNull %v4half +%_ptr_Function___frexp_result_vec4_f16 = OpTypePointer Function %__frexp_result_vec4_f16 + %23 = OpConstantNull %__frexp_result_vec4_f16 + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%frexp_3dd21e = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function___frexp_result_vec4_f16 Function %23 + %13 = OpExtInst %__frexp_result_vec4_f16 %19 FrexpStruct %20 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %frexp_3dd21e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %frexp_3dd21e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %frexp_3dd21e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/frexp/3dd21e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/frexp/3dd21e.wgsl.expected.wgsl new file mode 100644 index 0000000000..a33fbd09cc --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/3dd21e.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn frexp_3dd21e() { + var res = frexp(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_3dd21e(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_3dd21e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_3dd21e(); +} diff --git a/test/tint/builtins/gen/literal/frexp/5257dd.wgsl b/test/tint/builtins/gen/literal/frexp/5257dd.wgsl new file mode 100644 index 0000000000..6f4f993fda --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/5257dd.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn frexp(f16) -> __frexp_result +fn frexp_5257dd() { + var res = frexp(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_5257dd(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_5257dd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_5257dd(); +} diff --git a/test/tint/builtins/gen/literal/frexp/5257dd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/frexp/5257dd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9e34fba082 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/5257dd.wgsl.expected.dxc.hlsl @@ -0,0 +1,41 @@ +struct frexp_result_f16 { + float16_t sig; + int exp; +}; +frexp_result_f16 tint_frexp(float16_t param_0) { + float16_t exp; + float16_t sig = frexp(param_0, exp); + frexp_result_f16 result = {sig, int(exp)}; + return result; +} + +void frexp_5257dd() { + frexp_result_f16 res = tint_frexp(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_5257dd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_5257dd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_5257dd(); + return; +} diff --git a/test/tint/builtins/gen/literal/frexp/5257dd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/frexp/5257dd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..05c7d5faf9 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/5257dd.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +SKIP: FAILED + +struct frexp_result_f16 { + float16_t sig; + int exp; +}; +frexp_result_f16 tint_frexp(float16_t param_0) { + float16_t exp; + float16_t sig = frexp(param_0, exp); + frexp_result_f16 result = {sig, int(exp)}; + return result; +} + +void frexp_5257dd() { + frexp_result_f16 res = tint_frexp(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_5257dd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_5257dd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_5257dd(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000017322E51900(2,3-11): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/builtins/gen/literal/frexp/5257dd.wgsl.expected.glsl b/test/tint/builtins/gen/literal/frexp/5257dd.wgsl.expected.glsl new file mode 100644 index 0000000000..f08939ec99 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/5257dd.wgsl.expected.glsl @@ -0,0 +1,88 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct frexp_result_f16 { + float16_t sig; + int exp; +}; + +frexp_result_f16 tint_frexp(float16_t param_0) { + frexp_result_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_5257dd() { + frexp_result_f16 res = tint_frexp(0.0hf); +} + +vec4 vertex_main() { + frexp_5257dd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +struct frexp_result_f16 { + float16_t sig; + int exp; +}; + +frexp_result_f16 tint_frexp(float16_t param_0) { + frexp_result_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_5257dd() { + frexp_result_f16 res = tint_frexp(0.0hf); +} + +void fragment_main() { + frexp_5257dd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct frexp_result_f16 { + float16_t sig; + int exp; +}; + +frexp_result_f16 tint_frexp(float16_t param_0) { + frexp_result_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_5257dd() { + frexp_result_f16 res = tint_frexp(0.0hf); +} + +void compute_main() { + frexp_5257dd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/frexp/5257dd.wgsl.expected.msl b/test/tint/builtins/gen/literal/frexp/5257dd.wgsl.expected.msl new file mode 100644 index 0000000000..1920b166b2 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/5257dd.wgsl.expected.msl @@ -0,0 +1,44 @@ +#include + +using namespace metal; + +struct frexp_result_f16 { + half sig; + int exp; +}; +frexp_result_f16 tint_frexp(half param_0) { + frexp_result_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + +void frexp_5257dd() { + frexp_result_f16 res = tint_frexp(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + frexp_5257dd(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + frexp_5257dd(); + return; +} + +kernel void compute_main() { + frexp_5257dd(); + return; +} + diff --git a/test/tint/builtins/gen/literal/frexp/5257dd.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/frexp/5257dd.wgsl.expected.spvasm new file mode 100644 index 0000000000..6c20d394ff --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/5257dd.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %frexp_5257dd "frexp_5257dd" + OpName %__frexp_result_f16 "__frexp_result_f16" + OpMemberName %__frexp_result_f16 0 "sig" + OpMemberName %__frexp_result_f16 1 "exp" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__frexp_result_f16 0 Offset 0 + OpMemberDecorate %__frexp_result_f16 1 Offset 4 + %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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %int = OpTypeInt 32 1 +%__frexp_result_f16 = OpTypeStruct %half %int + %18 = OpConstantNull %half +%_ptr_Function___frexp_result_f16 = OpTypePointer Function %__frexp_result_f16 + %21 = OpConstantNull %__frexp_result_f16 + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%frexp_5257dd = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function___frexp_result_f16 Function %21 + %13 = OpExtInst %__frexp_result_f16 %17 FrexpStruct %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %frexp_5257dd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %frexp_5257dd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %frexp_5257dd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/frexp/5257dd.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/frexp/5257dd.wgsl.expected.wgsl new file mode 100644 index 0000000000..ca55834307 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/5257dd.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn frexp_5257dd() { + var res = frexp(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_5257dd(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_5257dd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_5257dd(); +} diff --git a/test/tint/builtins/gen/literal/frexp/5f47bf.wgsl b/test/tint/builtins/gen/literal/frexp/5f47bf.wgsl new file mode 100644 index 0000000000..7d784db8d6 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/5f47bf.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn frexp(vec<2, f16>) -> __frexp_result_vec<2, f16> +fn frexp_5f47bf() { + var res = frexp(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_5f47bf(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_5f47bf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_5f47bf(); +} diff --git a/test/tint/builtins/gen/literal/frexp/5f47bf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/frexp/5f47bf.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b39e0d6b62 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/5f47bf.wgsl.expected.dxc.hlsl @@ -0,0 +1,41 @@ +struct frexp_result_vec2_f16 { + vector sig; + int2 exp; +}; +frexp_result_vec2_f16 tint_frexp(vector param_0) { + vector exp; + vector sig = frexp(param_0, exp); + frexp_result_vec2_f16 result = {sig, int2(exp)}; + return result; +} + +void frexp_5f47bf() { + frexp_result_vec2_f16 res = tint_frexp((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_5f47bf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_5f47bf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_5f47bf(); + return; +} diff --git a/test/tint/builtins/gen/literal/frexp/5f47bf.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/frexp/5f47bf.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..acfc0caffc --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/5f47bf.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +SKIP: FAILED + +struct frexp_result_vec2_f16 { + vector sig; + int2 exp; +}; +frexp_result_vec2_f16 tint_frexp(vector param_0) { + vector exp; + vector sig = frexp(param_0, exp); + frexp_result_vec2_f16 result = {sig, int2(exp)}; + return result; +} + +void frexp_5f47bf() { + frexp_result_vec2_f16 res = tint_frexp((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_5f47bf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_5f47bf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_5f47bf(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D35F6E9740(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/frexp/5f47bf.wgsl.expected.glsl b/test/tint/builtins/gen/literal/frexp/5f47bf.wgsl.expected.glsl new file mode 100644 index 0000000000..4a75e6c260 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/5f47bf.wgsl.expected.glsl @@ -0,0 +1,88 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct frexp_result_vec2_f16 { + f16vec2 sig; + ivec2 exp; +}; + +frexp_result_vec2_f16 tint_frexp(f16vec2 param_0) { + frexp_result_vec2_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_5f47bf() { + frexp_result_vec2_f16 res = tint_frexp(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + frexp_5f47bf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +struct frexp_result_vec2_f16 { + f16vec2 sig; + ivec2 exp; +}; + +frexp_result_vec2_f16 tint_frexp(f16vec2 param_0) { + frexp_result_vec2_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_5f47bf() { + frexp_result_vec2_f16 res = tint_frexp(f16vec2(0.0hf)); +} + +void fragment_main() { + frexp_5f47bf(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct frexp_result_vec2_f16 { + f16vec2 sig; + ivec2 exp; +}; + +frexp_result_vec2_f16 tint_frexp(f16vec2 param_0) { + frexp_result_vec2_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_5f47bf() { + frexp_result_vec2_f16 res = tint_frexp(f16vec2(0.0hf)); +} + +void compute_main() { + frexp_5f47bf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/frexp/5f47bf.wgsl.expected.msl b/test/tint/builtins/gen/literal/frexp/5f47bf.wgsl.expected.msl new file mode 100644 index 0000000000..a2290a81fb --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/5f47bf.wgsl.expected.msl @@ -0,0 +1,44 @@ +#include + +using namespace metal; + +struct frexp_result_vec2_f16 { + half2 sig; + int2 exp; +}; +frexp_result_vec2_f16 tint_frexp(half2 param_0) { + frexp_result_vec2_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + +void frexp_5f47bf() { + frexp_result_vec2_f16 res = tint_frexp(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + frexp_5f47bf(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + frexp_5f47bf(); + return; +} + +kernel void compute_main() { + frexp_5f47bf(); + return; +} + diff --git a/test/tint/builtins/gen/literal/frexp/5f47bf.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/frexp/5f47bf.wgsl.expected.spvasm new file mode 100644 index 0000000000..e1c51b934d --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/5f47bf.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %frexp_5f47bf "frexp_5f47bf" + OpName %__frexp_result_vec2_f16 "__frexp_result_vec2_f16" + OpMemberName %__frexp_result_vec2_f16 0 "sig" + OpMemberName %__frexp_result_vec2_f16 1 "exp" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__frexp_result_vec2_f16 0 Offset 0 + OpMemberDecorate %__frexp_result_vec2_f16 1 Offset 8 + %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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%__frexp_result_vec2_f16 = OpTypeStruct %v2half %v2int + %20 = OpConstantNull %v2half +%_ptr_Function___frexp_result_vec2_f16 = OpTypePointer Function %__frexp_result_vec2_f16 + %23 = OpConstantNull %__frexp_result_vec2_f16 + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%frexp_5f47bf = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function___frexp_result_vec2_f16 Function %23 + %13 = OpExtInst %__frexp_result_vec2_f16 %19 FrexpStruct %20 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %frexp_5f47bf + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %frexp_5f47bf + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %frexp_5f47bf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/frexp/5f47bf.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/frexp/5f47bf.wgsl.expected.wgsl new file mode 100644 index 0000000000..5dd980e8ed --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/5f47bf.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn frexp_5f47bf() { + var res = frexp(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_5f47bf(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_5f47bf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_5f47bf(); +} diff --git a/test/tint/builtins/gen/literal/frexp/ae4a66.wgsl b/test/tint/builtins/gen/literal/frexp/ae4a66.wgsl new file mode 100644 index 0000000000..9b89a6b716 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/ae4a66.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn frexp(vec<3, f16>) -> __frexp_result_vec<3, f16> +fn frexp_ae4a66() { + var res = frexp(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_ae4a66(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_ae4a66(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_ae4a66(); +} diff --git a/test/tint/builtins/gen/literal/frexp/ae4a66.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/frexp/ae4a66.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..35d6455af6 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/ae4a66.wgsl.expected.dxc.hlsl @@ -0,0 +1,41 @@ +struct frexp_result_vec3_f16 { + vector sig; + int3 exp; +}; +frexp_result_vec3_f16 tint_frexp(vector param_0) { + vector exp; + vector sig = frexp(param_0, exp); + frexp_result_vec3_f16 result = {sig, int3(exp)}; + return result; +} + +void frexp_ae4a66() { + frexp_result_vec3_f16 res = tint_frexp((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_ae4a66(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_ae4a66(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_ae4a66(); + return; +} diff --git a/test/tint/builtins/gen/literal/frexp/ae4a66.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/frexp/ae4a66.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b25e403a68 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/ae4a66.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +SKIP: FAILED + +struct frexp_result_vec3_f16 { + vector sig; + int3 exp; +}; +frexp_result_vec3_f16 tint_frexp(vector param_0) { + vector exp; + vector sig = frexp(param_0, exp); + frexp_result_vec3_f16 result = {sig, int3(exp)}; + return result; +} + +void frexp_ae4a66() { + frexp_result_vec3_f16 res = tint_frexp((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_ae4a66(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_ae4a66(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_ae4a66(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D8ABEFAB20(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/frexp/ae4a66.wgsl.expected.glsl b/test/tint/builtins/gen/literal/frexp/ae4a66.wgsl.expected.glsl new file mode 100644 index 0000000000..e1b82e8579 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/ae4a66.wgsl.expected.glsl @@ -0,0 +1,88 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct frexp_result_vec3_f16 { + f16vec3 sig; + ivec3 exp; +}; + +frexp_result_vec3_f16 tint_frexp(f16vec3 param_0) { + frexp_result_vec3_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_ae4a66() { + frexp_result_vec3_f16 res = tint_frexp(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + frexp_ae4a66(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +struct frexp_result_vec3_f16 { + f16vec3 sig; + ivec3 exp; +}; + +frexp_result_vec3_f16 tint_frexp(f16vec3 param_0) { + frexp_result_vec3_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_ae4a66() { + frexp_result_vec3_f16 res = tint_frexp(f16vec3(0.0hf)); +} + +void fragment_main() { + frexp_ae4a66(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct frexp_result_vec3_f16 { + f16vec3 sig; + ivec3 exp; +}; + +frexp_result_vec3_f16 tint_frexp(f16vec3 param_0) { + frexp_result_vec3_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_ae4a66() { + frexp_result_vec3_f16 res = tint_frexp(f16vec3(0.0hf)); +} + +void compute_main() { + frexp_ae4a66(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/frexp/ae4a66.wgsl.expected.msl b/test/tint/builtins/gen/literal/frexp/ae4a66.wgsl.expected.msl new file mode 100644 index 0000000000..b58cc1025a --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/ae4a66.wgsl.expected.msl @@ -0,0 +1,44 @@ +#include + +using namespace metal; + +struct frexp_result_vec3_f16 { + half3 sig; + int3 exp; +}; +frexp_result_vec3_f16 tint_frexp(half3 param_0) { + frexp_result_vec3_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + +void frexp_ae4a66() { + frexp_result_vec3_f16 res = tint_frexp(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + frexp_ae4a66(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + frexp_ae4a66(); + return; +} + +kernel void compute_main() { + frexp_ae4a66(); + return; +} + diff --git a/test/tint/builtins/gen/literal/frexp/ae4a66.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/frexp/ae4a66.wgsl.expected.spvasm new file mode 100644 index 0000000000..5bf4a21be8 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/ae4a66.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %frexp_ae4a66 "frexp_ae4a66" + OpName %__frexp_result_vec3_f16 "__frexp_result_vec3_f16" + OpMemberName %__frexp_result_vec3_f16 0 "sig" + OpMemberName %__frexp_result_vec3_f16 1 "exp" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__frexp_result_vec3_f16 0 Offset 0 + OpMemberDecorate %__frexp_result_vec3_f16 1 Offset 16 + %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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%__frexp_result_vec3_f16 = OpTypeStruct %v3half %v3int + %20 = OpConstantNull %v3half +%_ptr_Function___frexp_result_vec3_f16 = OpTypePointer Function %__frexp_result_vec3_f16 + %23 = OpConstantNull %__frexp_result_vec3_f16 + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%frexp_ae4a66 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function___frexp_result_vec3_f16 Function %23 + %13 = OpExtInst %__frexp_result_vec3_f16 %19 FrexpStruct %20 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %frexp_ae4a66 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %frexp_ae4a66 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %frexp_ae4a66 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/frexp/ae4a66.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/frexp/ae4a66.wgsl.expected.wgsl new file mode 100644 index 0000000000..fcec0ebcd0 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/ae4a66.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn frexp_ae4a66() { + var res = frexp(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_ae4a66(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_ae4a66(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_ae4a66(); +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/440300.wgsl b/test/tint/builtins/gen/literal/inverseSqrt/440300.wgsl new file mode 100644 index 0000000000..fba79b258c --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/440300.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn inverseSqrt(f16) -> f16 +fn inverseSqrt_440300() { + var res: f16 = inverseSqrt(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_440300(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_440300(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_440300(); +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/440300.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/inverseSqrt/440300.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..39bea641d6 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/440300.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void inverseSqrt_440300() { + float16_t res = rsqrt(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_440300(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_440300(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_440300(); + return; +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/440300.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/inverseSqrt/440300.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..81427b04b7 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/440300.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void inverseSqrt_440300() { + float16_t res = rsqrt(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_440300(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_440300(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_440300(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000237636FBD30(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000237636FBD30(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/inverseSqrt/440300.wgsl.expected.glsl b/test/tint/builtins/gen/literal/inverseSqrt/440300.wgsl.expected.glsl new file mode 100644 index 0000000000..8cc52838ab --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/440300.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void inverseSqrt_440300() { + float16_t res = inversesqrt(0.0hf); +} + +vec4 vertex_main() { + inverseSqrt_440300(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void inverseSqrt_440300() { + float16_t res = inversesqrt(0.0hf); +} + +void fragment_main() { + inverseSqrt_440300(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void inverseSqrt_440300() { + float16_t res = inversesqrt(0.0hf); +} + +void compute_main() { + inverseSqrt_440300(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/440300.wgsl.expected.msl b/test/tint/builtins/gen/literal/inverseSqrt/440300.wgsl.expected.msl new file mode 100644 index 0000000000..0cab7aca0c --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/440300.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void inverseSqrt_440300() { + half res = rsqrt(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + inverseSqrt_440300(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + inverseSqrt_440300(); + return; +} + +kernel void compute_main() { + inverseSqrt_440300(); + return; +} + diff --git a/test/tint/builtins/gen/literal/inverseSqrt/440300.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/inverseSqrt/440300.wgsl.expected.spvasm new file mode 100644 index 0000000000..49ae296817 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/440300.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %inverseSqrt_440300 "inverseSqrt_440300" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%inverseSqrt_440300 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 InverseSqrt %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %inverseSqrt_440300 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %inverseSqrt_440300 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %inverseSqrt_440300 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/inverseSqrt/440300.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/inverseSqrt/440300.wgsl.expected.wgsl new file mode 100644 index 0000000000..c2b635a20d --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/440300.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn inverseSqrt_440300() { + var res : f16 = inverseSqrt(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_440300(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_440300(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_440300(); +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/5f51f8.wgsl b/test/tint/builtins/gen/literal/inverseSqrt/5f51f8.wgsl new file mode 100644 index 0000000000..af9bc17eb1 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/5f51f8.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn inverseSqrt(vec<2, f16>) -> vec<2, f16> +fn inverseSqrt_5f51f8() { + var res: vec2 = inverseSqrt(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_5f51f8(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_5f51f8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_5f51f8(); +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/5f51f8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/inverseSqrt/5f51f8.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f58be189c6 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/5f51f8.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void inverseSqrt_5f51f8() { + vector res = rsqrt((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_5f51f8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_5f51f8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_5f51f8(); + return; +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/5f51f8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/inverseSqrt/5f51f8.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..80d1b6782e --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/5f51f8.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void inverseSqrt_5f51f8() { + vector res = rsqrt((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_5f51f8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_5f51f8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_5f51f8(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000288A2227E00(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/inverseSqrt/5f51f8.wgsl.expected.glsl b/test/tint/builtins/gen/literal/inverseSqrt/5f51f8.wgsl.expected.glsl new file mode 100644 index 0000000000..4e73df641b --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/5f51f8.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void inverseSqrt_5f51f8() { + f16vec2 res = inversesqrt(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + inverseSqrt_5f51f8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void inverseSqrt_5f51f8() { + f16vec2 res = inversesqrt(f16vec2(0.0hf)); +} + +void fragment_main() { + inverseSqrt_5f51f8(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void inverseSqrt_5f51f8() { + f16vec2 res = inversesqrt(f16vec2(0.0hf)); +} + +void compute_main() { + inverseSqrt_5f51f8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/5f51f8.wgsl.expected.msl b/test/tint/builtins/gen/literal/inverseSqrt/5f51f8.wgsl.expected.msl new file mode 100644 index 0000000000..2e7d4bd952 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/5f51f8.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void inverseSqrt_5f51f8() { + half2 res = rsqrt(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + inverseSqrt_5f51f8(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + inverseSqrt_5f51f8(); + return; +} + +kernel void compute_main() { + inverseSqrt_5f51f8(); + return; +} + diff --git a/test/tint/builtins/gen/literal/inverseSqrt/5f51f8.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/inverseSqrt/5f51f8.wgsl.expected.spvasm new file mode 100644 index 0000000000..cd5caca4d4 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/5f51f8.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %inverseSqrt_5f51f8 "inverseSqrt_5f51f8" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%inverseSqrt_5f51f8 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 InverseSqrt %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %inverseSqrt_5f51f8 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %inverseSqrt_5f51f8 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %inverseSqrt_5f51f8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/inverseSqrt/5f51f8.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/inverseSqrt/5f51f8.wgsl.expected.wgsl new file mode 100644 index 0000000000..672f0e39f2 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/5f51f8.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn inverseSqrt_5f51f8() { + var res : vec2 = inverseSqrt(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_5f51f8(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_5f51f8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_5f51f8(); +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/b85ebd.wgsl b/test/tint/builtins/gen/literal/inverseSqrt/b85ebd.wgsl new file mode 100644 index 0000000000..2a389e21ac --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/b85ebd.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn inverseSqrt(vec<3, f16>) -> vec<3, f16> +fn inverseSqrt_b85ebd() { + var res: vec3 = inverseSqrt(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_b85ebd(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_b85ebd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_b85ebd(); +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/b85ebd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/inverseSqrt/b85ebd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ef654c9c6d --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/b85ebd.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void inverseSqrt_b85ebd() { + vector res = rsqrt((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_b85ebd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_b85ebd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_b85ebd(); + return; +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/b85ebd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/inverseSqrt/b85ebd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6e08e83084 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/b85ebd.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void inverseSqrt_b85ebd() { + vector res = rsqrt((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_b85ebd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_b85ebd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_b85ebd(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001FEA9110080(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/inverseSqrt/b85ebd.wgsl.expected.glsl b/test/tint/builtins/gen/literal/inverseSqrt/b85ebd.wgsl.expected.glsl new file mode 100644 index 0000000000..12e5cabfa7 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/b85ebd.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void inverseSqrt_b85ebd() { + f16vec3 res = inversesqrt(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + inverseSqrt_b85ebd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void inverseSqrt_b85ebd() { + f16vec3 res = inversesqrt(f16vec3(0.0hf)); +} + +void fragment_main() { + inverseSqrt_b85ebd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void inverseSqrt_b85ebd() { + f16vec3 res = inversesqrt(f16vec3(0.0hf)); +} + +void compute_main() { + inverseSqrt_b85ebd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/b85ebd.wgsl.expected.msl b/test/tint/builtins/gen/literal/inverseSqrt/b85ebd.wgsl.expected.msl new file mode 100644 index 0000000000..351560a86a --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/b85ebd.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void inverseSqrt_b85ebd() { + half3 res = rsqrt(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + inverseSqrt_b85ebd(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + inverseSqrt_b85ebd(); + return; +} + +kernel void compute_main() { + inverseSqrt_b85ebd(); + return; +} + diff --git a/test/tint/builtins/gen/literal/inverseSqrt/b85ebd.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/inverseSqrt/b85ebd.wgsl.expected.spvasm new file mode 100644 index 0000000000..05243bc21e --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/b85ebd.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %inverseSqrt_b85ebd "inverseSqrt_b85ebd" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%inverseSqrt_b85ebd = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 InverseSqrt %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %inverseSqrt_b85ebd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %inverseSqrt_b85ebd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %inverseSqrt_b85ebd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/inverseSqrt/b85ebd.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/inverseSqrt/b85ebd.wgsl.expected.wgsl new file mode 100644 index 0000000000..e9c1e7e79c --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/b85ebd.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn inverseSqrt_b85ebd() { + var res : vec3 = inverseSqrt(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_b85ebd(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_b85ebd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_b85ebd(); +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/cbdc70.wgsl b/test/tint/builtins/gen/literal/inverseSqrt/cbdc70.wgsl new file mode 100644 index 0000000000..8657926b77 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/cbdc70.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn inverseSqrt(vec<4, f16>) -> vec<4, f16> +fn inverseSqrt_cbdc70() { + var res: vec4 = inverseSqrt(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_cbdc70(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_cbdc70(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_cbdc70(); +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/cbdc70.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/inverseSqrt/cbdc70.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ed1f192d8e --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/cbdc70.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void inverseSqrt_cbdc70() { + vector res = rsqrt((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_cbdc70(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_cbdc70(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_cbdc70(); + return; +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/cbdc70.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/inverseSqrt/cbdc70.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6880c60d75 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/cbdc70.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void inverseSqrt_cbdc70() { + vector res = rsqrt((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_cbdc70(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_cbdc70(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_cbdc70(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E1CCE37DA0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/inverseSqrt/cbdc70.wgsl.expected.glsl b/test/tint/builtins/gen/literal/inverseSqrt/cbdc70.wgsl.expected.glsl new file mode 100644 index 0000000000..43f1edabed --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/cbdc70.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void inverseSqrt_cbdc70() { + f16vec4 res = inversesqrt(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + inverseSqrt_cbdc70(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void inverseSqrt_cbdc70() { + f16vec4 res = inversesqrt(f16vec4(0.0hf)); +} + +void fragment_main() { + inverseSqrt_cbdc70(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void inverseSqrt_cbdc70() { + f16vec4 res = inversesqrt(f16vec4(0.0hf)); +} + +void compute_main() { + inverseSqrt_cbdc70(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/cbdc70.wgsl.expected.msl b/test/tint/builtins/gen/literal/inverseSqrt/cbdc70.wgsl.expected.msl new file mode 100644 index 0000000000..f1610f83d0 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/cbdc70.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void inverseSqrt_cbdc70() { + half4 res = rsqrt(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + inverseSqrt_cbdc70(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + inverseSqrt_cbdc70(); + return; +} + +kernel void compute_main() { + inverseSqrt_cbdc70(); + return; +} + diff --git a/test/tint/builtins/gen/literal/inverseSqrt/cbdc70.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/inverseSqrt/cbdc70.wgsl.expected.spvasm new file mode 100644 index 0000000000..43367c1689 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/cbdc70.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %inverseSqrt_cbdc70 "inverseSqrt_cbdc70" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%inverseSqrt_cbdc70 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 InverseSqrt %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %inverseSqrt_cbdc70 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %inverseSqrt_cbdc70 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %inverseSqrt_cbdc70 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/inverseSqrt/cbdc70.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/inverseSqrt/cbdc70.wgsl.expected.wgsl new file mode 100644 index 0000000000..2290320a6f --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/cbdc70.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn inverseSqrt_cbdc70() { + var res : vec4 = inverseSqrt(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_cbdc70(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_cbdc70(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_cbdc70(); +} diff --git a/test/tint/builtins/gen/literal/ldexp/3d90b4.wgsl b/test/tint/builtins/gen/literal/ldexp/3d90b4.wgsl new file mode 100644 index 0000000000..bed22e2812 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/3d90b4.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn ldexp(vec<2, f16>, vec<2, i32>) -> vec<2, f16> +fn ldexp_3d90b4() { + var res: vec2 = ldexp(vec2(f16()), vec2(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_3d90b4(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_3d90b4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_3d90b4(); +} diff --git a/test/tint/builtins/gen/literal/ldexp/3d90b4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/ldexp/3d90b4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ae0933efb1 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/3d90b4.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void ldexp_3d90b4() { + vector res = ldexp((float16_t(0.0h)).xx, (1).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_3d90b4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_3d90b4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_3d90b4(); + return; +} diff --git a/test/tint/builtins/gen/literal/ldexp/3d90b4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/ldexp/3d90b4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0608e1f9d4 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/3d90b4.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void ldexp_3d90b4() { + vector res = ldexp((float16_t(0.0h)).xx, (1).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_3d90b4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_3d90b4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_3d90b4(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001808B7D81C0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/ldexp/3d90b4.wgsl.expected.glsl b/test/tint/builtins/gen/literal/ldexp/3d90b4.wgsl.expected.glsl new file mode 100644 index 0000000000..74ee06a091 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/3d90b4.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ldexp_3d90b4() { + f16vec2 res = ldexp(f16vec2(0.0hf), ivec2(1)); +} + +vec4 vertex_main() { + ldexp_3d90b4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void ldexp_3d90b4() { + f16vec2 res = ldexp(f16vec2(0.0hf), ivec2(1)); +} + +void fragment_main() { + ldexp_3d90b4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ldexp_3d90b4() { + f16vec2 res = ldexp(f16vec2(0.0hf), ivec2(1)); +} + +void compute_main() { + ldexp_3d90b4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/ldexp/3d90b4.wgsl.expected.msl b/test/tint/builtins/gen/literal/ldexp/3d90b4.wgsl.expected.msl new file mode 100644 index 0000000000..9d9e2ac28e --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/3d90b4.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void ldexp_3d90b4() { + half2 res = ldexp(half2(0.0h), int2(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ldexp_3d90b4(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ldexp_3d90b4(); + return; +} + +kernel void compute_main() { + ldexp_3d90b4(); + return; +} + diff --git a/test/tint/builtins/gen/literal/ldexp/3d90b4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/ldexp/3d90b4.wgsl.expected.spvasm new file mode 100644 index 0000000000..0847908d63 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/3d90b4.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ldexp_3d90b4 "ldexp_3d90b4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_1 = OpConstant %int 1 + %21 = OpConstantComposite %v2int %int_1 %int_1 +%_ptr_Function_v2half = OpTypePointer Function %v2half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%ldexp_3d90b4 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Ldexp %17 %21 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %ldexp_3d90b4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %ldexp_3d90b4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %ldexp_3d90b4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/ldexp/3d90b4.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/ldexp/3d90b4.wgsl.expected.wgsl new file mode 100644 index 0000000000..cacab9eb7a --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/3d90b4.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn ldexp_3d90b4() { + var res : vec2 = ldexp(vec2(f16()), vec2(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_3d90b4(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_3d90b4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_3d90b4(); +} diff --git a/test/tint/builtins/gen/literal/ldexp/624e0c.wgsl b/test/tint/builtins/gen/literal/ldexp/624e0c.wgsl new file mode 100644 index 0000000000..24f8054a57 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/624e0c.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn ldexp(f16, i32) -> f16 +fn ldexp_624e0c() { + var res: f16 = ldexp(f16(), 1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_624e0c(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_624e0c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_624e0c(); +} diff --git a/test/tint/builtins/gen/literal/ldexp/624e0c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/ldexp/624e0c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c978bcfbd4 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/624e0c.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void ldexp_624e0c() { + float16_t res = ldexp(float16_t(0.0h), 1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_624e0c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_624e0c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_624e0c(); + return; +} diff --git a/test/tint/builtins/gen/literal/ldexp/624e0c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/ldexp/624e0c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d3e207e56c --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/624e0c.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void ldexp_624e0c() { + float16_t res = ldexp(float16_t(0.0h), 1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_624e0c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_624e0c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_624e0c(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F949F984D0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F949F984D0(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/ldexp/624e0c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/ldexp/624e0c.wgsl.expected.glsl new file mode 100644 index 0000000000..f856c620e3 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/624e0c.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ldexp_624e0c() { + float16_t res = ldexp(0.0hf, 1); +} + +vec4 vertex_main() { + ldexp_624e0c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void ldexp_624e0c() { + float16_t res = ldexp(0.0hf, 1); +} + +void fragment_main() { + ldexp_624e0c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ldexp_624e0c() { + float16_t res = ldexp(0.0hf, 1); +} + +void compute_main() { + ldexp_624e0c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/ldexp/624e0c.wgsl.expected.msl b/test/tint/builtins/gen/literal/ldexp/624e0c.wgsl.expected.msl new file mode 100644 index 0000000000..e63d73662c --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/624e0c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void ldexp_624e0c() { + half res = ldexp(0.0h, 1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ldexp_624e0c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ldexp_624e0c(); + return; +} + +kernel void compute_main() { + ldexp_624e0c(); + return; +} + diff --git a/test/tint/builtins/gen/literal/ldexp/624e0c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/ldexp/624e0c.wgsl.expected.spvasm new file mode 100644 index 0000000000..13ce90811b --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/624e0c.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ldexp_624e0c "ldexp_624e0c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%ldexp_624e0c = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Ldexp %16 %int_1 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %ldexp_624e0c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %ldexp_624e0c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %ldexp_624e0c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/ldexp/624e0c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/ldexp/624e0c.wgsl.expected.wgsl new file mode 100644 index 0000000000..1d6ebc8418 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/624e0c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn ldexp_624e0c() { + var res : f16 = ldexp(f16(), 1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_624e0c(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_624e0c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_624e0c(); +} diff --git a/test/tint/builtins/gen/literal/ldexp/7485ce.wgsl b/test/tint/builtins/gen/literal/ldexp/7485ce.wgsl new file mode 100644 index 0000000000..01a4e811c7 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/7485ce.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn ldexp(vec<3, f16>, vec<3, i32>) -> vec<3, f16> +fn ldexp_7485ce() { + var res: vec3 = ldexp(vec3(f16()), vec3(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_7485ce(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_7485ce(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_7485ce(); +} diff --git a/test/tint/builtins/gen/literal/ldexp/7485ce.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/ldexp/7485ce.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..731bb5d30a --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/7485ce.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void ldexp_7485ce() { + vector res = ldexp((float16_t(0.0h)).xxx, (1).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_7485ce(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_7485ce(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_7485ce(); + return; +} diff --git a/test/tint/builtins/gen/literal/ldexp/7485ce.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/ldexp/7485ce.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ac6b68f630 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/7485ce.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void ldexp_7485ce() { + vector res = ldexp((float16_t(0.0h)).xxx, (1).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_7485ce(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_7485ce(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_7485ce(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001698F7B0100(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/ldexp/7485ce.wgsl.expected.glsl b/test/tint/builtins/gen/literal/ldexp/7485ce.wgsl.expected.glsl new file mode 100644 index 0000000000..4a19e3c227 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/7485ce.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ldexp_7485ce() { + f16vec3 res = ldexp(f16vec3(0.0hf), ivec3(1)); +} + +vec4 vertex_main() { + ldexp_7485ce(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void ldexp_7485ce() { + f16vec3 res = ldexp(f16vec3(0.0hf), ivec3(1)); +} + +void fragment_main() { + ldexp_7485ce(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ldexp_7485ce() { + f16vec3 res = ldexp(f16vec3(0.0hf), ivec3(1)); +} + +void compute_main() { + ldexp_7485ce(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/ldexp/7485ce.wgsl.expected.msl b/test/tint/builtins/gen/literal/ldexp/7485ce.wgsl.expected.msl new file mode 100644 index 0000000000..b5d93bfe7e --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/7485ce.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void ldexp_7485ce() { + half3 res = ldexp(half3(0.0h), int3(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ldexp_7485ce(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ldexp_7485ce(); + return; +} + +kernel void compute_main() { + ldexp_7485ce(); + return; +} + diff --git a/test/tint/builtins/gen/literal/ldexp/7485ce.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/ldexp/7485ce.wgsl.expected.spvasm new file mode 100644 index 0000000000..985d48996e --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/7485ce.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ldexp_7485ce "ldexp_7485ce" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_1 = OpConstant %int 1 + %21 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Function_v3half = OpTypePointer Function %v3half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%ldexp_7485ce = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Ldexp %17 %21 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %ldexp_7485ce + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %ldexp_7485ce + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %ldexp_7485ce + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/ldexp/7485ce.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/ldexp/7485ce.wgsl.expected.wgsl new file mode 100644 index 0000000000..99f6df264a --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/7485ce.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn ldexp_7485ce() { + var res : vec3 = ldexp(vec3(f16()), vec3(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_7485ce(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_7485ce(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_7485ce(); +} diff --git a/test/tint/builtins/gen/literal/ldexp/7fa13c.wgsl b/test/tint/builtins/gen/literal/ldexp/7fa13c.wgsl new file mode 100644 index 0000000000..a79176797c --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/7fa13c.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn ldexp(vec<4, f16>, vec<4, i32>) -> vec<4, f16> +fn ldexp_7fa13c() { + var res: vec4 = ldexp(vec4(f16()), vec4(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_7fa13c(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_7fa13c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_7fa13c(); +} diff --git a/test/tint/builtins/gen/literal/ldexp/7fa13c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/ldexp/7fa13c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..774c31e308 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/7fa13c.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void ldexp_7fa13c() { + vector res = ldexp((float16_t(0.0h)).xxxx, (1).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_7fa13c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_7fa13c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_7fa13c(); + return; +} diff --git a/test/tint/builtins/gen/literal/ldexp/7fa13c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/ldexp/7fa13c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a53fa359dc --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/7fa13c.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void ldexp_7fa13c() { + vector res = ldexp((float16_t(0.0h)).xxxx, (1).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_7fa13c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_7fa13c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_7fa13c(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018D79877AB0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/ldexp/7fa13c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/ldexp/7fa13c.wgsl.expected.glsl new file mode 100644 index 0000000000..30b6c1d9fa --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/7fa13c.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ldexp_7fa13c() { + f16vec4 res = ldexp(f16vec4(0.0hf), ivec4(1)); +} + +vec4 vertex_main() { + ldexp_7fa13c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void ldexp_7fa13c() { + f16vec4 res = ldexp(f16vec4(0.0hf), ivec4(1)); +} + +void fragment_main() { + ldexp_7fa13c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ldexp_7fa13c() { + f16vec4 res = ldexp(f16vec4(0.0hf), ivec4(1)); +} + +void compute_main() { + ldexp_7fa13c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/ldexp/7fa13c.wgsl.expected.msl b/test/tint/builtins/gen/literal/ldexp/7fa13c.wgsl.expected.msl new file mode 100644 index 0000000000..b348e4a8e7 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/7fa13c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void ldexp_7fa13c() { + half4 res = ldexp(half4(0.0h), int4(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ldexp_7fa13c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ldexp_7fa13c(); + return; +} + +kernel void compute_main() { + ldexp_7fa13c(); + return; +} + diff --git a/test/tint/builtins/gen/literal/ldexp/7fa13c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/ldexp/7fa13c.wgsl.expected.spvasm new file mode 100644 index 0000000000..f389bc34e5 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/7fa13c.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ldexp_7fa13c "ldexp_7fa13c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %int_1 = OpConstant %int 1 + %21 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%_ptr_Function_v4half = OpTypePointer Function %v4half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%ldexp_7fa13c = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Ldexp %17 %21 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %ldexp_7fa13c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %ldexp_7fa13c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %ldexp_7fa13c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/ldexp/7fa13c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/ldexp/7fa13c.wgsl.expected.wgsl new file mode 100644 index 0000000000..a42ea96349 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/7fa13c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn ldexp_7fa13c() { + var res : vec4 = ldexp(vec4(f16()), vec4(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_7fa13c(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_7fa13c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_7fa13c(); +} diff --git a/test/tint/builtins/gen/literal/length/3f0e13.wgsl b/test/tint/builtins/gen/literal/length/3f0e13.wgsl new file mode 100644 index 0000000000..4306efe403 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/3f0e13.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn length(vec<2, f16>) -> f16 +fn length_3f0e13() { + var res: f16 = length(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_3f0e13(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_3f0e13(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_3f0e13(); +} diff --git a/test/tint/builtins/gen/literal/length/3f0e13.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/length/3f0e13.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..08660e8d15 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/3f0e13.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void length_3f0e13() { + float16_t res = length((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_3f0e13(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_3f0e13(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_3f0e13(); + return; +} diff --git a/test/tint/builtins/gen/literal/length/3f0e13.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/length/3f0e13.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..aaa0dceb8f --- /dev/null +++ b/test/tint/builtins/gen/literal/length/3f0e13.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void length_3f0e13() { + float16_t res = length((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_3f0e13(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_3f0e13(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_3f0e13(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000025534170870(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000025534170870(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/length/3f0e13.wgsl.expected.glsl b/test/tint/builtins/gen/literal/length/3f0e13.wgsl.expected.glsl new file mode 100644 index 0000000000..ff3bb99e81 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/3f0e13.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void length_3f0e13() { + float16_t res = length(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + length_3f0e13(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void length_3f0e13() { + float16_t res = length(f16vec2(0.0hf)); +} + +void fragment_main() { + length_3f0e13(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void length_3f0e13() { + float16_t res = length(f16vec2(0.0hf)); +} + +void compute_main() { + length_3f0e13(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/length/3f0e13.wgsl.expected.msl b/test/tint/builtins/gen/literal/length/3f0e13.wgsl.expected.msl new file mode 100644 index 0000000000..2aadef91af --- /dev/null +++ b/test/tint/builtins/gen/literal/length/3f0e13.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void length_3f0e13() { + half res = length(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + length_3f0e13(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + length_3f0e13(); + return; +} + +kernel void compute_main() { + length_3f0e13(); + return; +} + diff --git a/test/tint/builtins/gen/literal/length/3f0e13.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/length/3f0e13.wgsl.expected.spvasm new file mode 100644 index 0000000000..580976223c --- /dev/null +++ b/test/tint/builtins/gen/literal/length/3f0e13.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %length_3f0e13 "length_3f0e13" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_half = OpTypePointer Function %half + %20 = OpConstantNull %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%length_3f0e13 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %20 + %13 = OpExtInst %half %15 Length %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %length_3f0e13 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %length_3f0e13 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %length_3f0e13 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/length/3f0e13.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/length/3f0e13.wgsl.expected.wgsl new file mode 100644 index 0000000000..d97f9c87e2 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/3f0e13.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn length_3f0e13() { + var res : f16 = length(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_3f0e13(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_3f0e13(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_3f0e13(); +} diff --git a/test/tint/builtins/gen/literal/length/5b1a9b.wgsl b/test/tint/builtins/gen/literal/length/5b1a9b.wgsl new file mode 100644 index 0000000000..be2dbf195f --- /dev/null +++ b/test/tint/builtins/gen/literal/length/5b1a9b.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn length(vec<4, f16>) -> f16 +fn length_5b1a9b() { + var res: f16 = length(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_5b1a9b(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_5b1a9b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_5b1a9b(); +} diff --git a/test/tint/builtins/gen/literal/length/5b1a9b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/length/5b1a9b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..efaee527ed --- /dev/null +++ b/test/tint/builtins/gen/literal/length/5b1a9b.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void length_5b1a9b() { + float16_t res = length((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_5b1a9b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_5b1a9b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_5b1a9b(); + return; +} diff --git a/test/tint/builtins/gen/literal/length/5b1a9b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/length/5b1a9b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..736654a6f9 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/5b1a9b.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void length_5b1a9b() { + float16_t res = length((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_5b1a9b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_5b1a9b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_5b1a9b(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000206B010D5C0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000206B010D5C0(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/length/5b1a9b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/length/5b1a9b.wgsl.expected.glsl new file mode 100644 index 0000000000..0fc543333b --- /dev/null +++ b/test/tint/builtins/gen/literal/length/5b1a9b.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void length_5b1a9b() { + float16_t res = length(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + length_5b1a9b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void length_5b1a9b() { + float16_t res = length(f16vec4(0.0hf)); +} + +void fragment_main() { + length_5b1a9b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void length_5b1a9b() { + float16_t res = length(f16vec4(0.0hf)); +} + +void compute_main() { + length_5b1a9b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/length/5b1a9b.wgsl.expected.msl b/test/tint/builtins/gen/literal/length/5b1a9b.wgsl.expected.msl new file mode 100644 index 0000000000..c1013ee8a9 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/5b1a9b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void length_5b1a9b() { + half res = length(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + length_5b1a9b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + length_5b1a9b(); + return; +} + +kernel void compute_main() { + length_5b1a9b(); + return; +} + diff --git a/test/tint/builtins/gen/literal/length/5b1a9b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/length/5b1a9b.wgsl.expected.spvasm new file mode 100644 index 0000000000..c112767a08 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/5b1a9b.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %length_5b1a9b "length_5b1a9b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_half = OpTypePointer Function %half + %20 = OpConstantNull %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%length_5b1a9b = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %20 + %13 = OpExtInst %half %15 Length %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %length_5b1a9b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %length_5b1a9b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %length_5b1a9b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/length/5b1a9b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/length/5b1a9b.wgsl.expected.wgsl new file mode 100644 index 0000000000..526971a68e --- /dev/null +++ b/test/tint/builtins/gen/literal/length/5b1a9b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn length_5b1a9b() { + var res : f16 = length(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_5b1a9b(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_5b1a9b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_5b1a9b(); +} diff --git a/test/tint/builtins/gen/literal/length/ba16d6.wgsl b/test/tint/builtins/gen/literal/length/ba16d6.wgsl new file mode 100644 index 0000000000..a51f78a62f --- /dev/null +++ b/test/tint/builtins/gen/literal/length/ba16d6.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn length(vec<3, f16>) -> f16 +fn length_ba16d6() { + var res: f16 = length(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_ba16d6(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_ba16d6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_ba16d6(); +} diff --git a/test/tint/builtins/gen/literal/length/ba16d6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/length/ba16d6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c0c7954274 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/ba16d6.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void length_ba16d6() { + float16_t res = length((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_ba16d6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_ba16d6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_ba16d6(); + return; +} diff --git a/test/tint/builtins/gen/literal/length/ba16d6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/length/ba16d6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..99ff3bb2c6 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/ba16d6.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void length_ba16d6() { + float16_t res = length((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_ba16d6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_ba16d6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_ba16d6(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001EE9E8E87F0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001EE9E8E87F0(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/length/ba16d6.wgsl.expected.glsl b/test/tint/builtins/gen/literal/length/ba16d6.wgsl.expected.glsl new file mode 100644 index 0000000000..57c51de74c --- /dev/null +++ b/test/tint/builtins/gen/literal/length/ba16d6.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void length_ba16d6() { + float16_t res = length(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + length_ba16d6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void length_ba16d6() { + float16_t res = length(f16vec3(0.0hf)); +} + +void fragment_main() { + length_ba16d6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void length_ba16d6() { + float16_t res = length(f16vec3(0.0hf)); +} + +void compute_main() { + length_ba16d6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/length/ba16d6.wgsl.expected.msl b/test/tint/builtins/gen/literal/length/ba16d6.wgsl.expected.msl new file mode 100644 index 0000000000..c5e50591a3 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/ba16d6.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void length_ba16d6() { + half res = length(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + length_ba16d6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + length_ba16d6(); + return; +} + +kernel void compute_main() { + length_ba16d6(); + return; +} + diff --git a/test/tint/builtins/gen/literal/length/ba16d6.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/length/ba16d6.wgsl.expected.spvasm new file mode 100644 index 0000000000..9cb2b45ee8 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/ba16d6.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %length_ba16d6 "length_ba16d6" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_half = OpTypePointer Function %half + %20 = OpConstantNull %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%length_ba16d6 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %20 + %13 = OpExtInst %half %15 Length %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %length_ba16d6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %length_ba16d6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %length_ba16d6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/length/ba16d6.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/length/ba16d6.wgsl.expected.wgsl new file mode 100644 index 0000000000..ef23cb8166 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/ba16d6.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn length_ba16d6() { + var res : f16 = length(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_ba16d6(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_ba16d6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_ba16d6(); +} diff --git a/test/tint/builtins/gen/literal/length/c158da.wgsl b/test/tint/builtins/gen/literal/length/c158da.wgsl new file mode 100644 index 0000000000..70b692f5b1 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/c158da.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn length(f16) -> f16 +fn length_c158da() { + var res: f16 = length(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_c158da(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_c158da(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_c158da(); +} diff --git a/test/tint/builtins/gen/literal/length/c158da.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/length/c158da.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5b0e775764 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/c158da.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void length_c158da() { + float16_t res = length(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_c158da(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_c158da(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_c158da(); + return; +} diff --git a/test/tint/builtins/gen/literal/length/c158da.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/length/c158da.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2a73153d64 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/c158da.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void length_c158da() { + float16_t res = length(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_c158da(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_c158da(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_c158da(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001B0C50014C0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001B0C50014C0(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/length/c158da.wgsl.expected.glsl b/test/tint/builtins/gen/literal/length/c158da.wgsl.expected.glsl new file mode 100644 index 0000000000..afc15b3d13 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/c158da.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void length_c158da() { + float16_t res = length(0.0hf); +} + +vec4 vertex_main() { + length_c158da(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void length_c158da() { + float16_t res = length(0.0hf); +} + +void fragment_main() { + length_c158da(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void length_c158da() { + float16_t res = length(0.0hf); +} + +void compute_main() { + length_c158da(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/length/c158da.wgsl.expected.msl b/test/tint/builtins/gen/literal/length/c158da.wgsl.expected.msl new file mode 100644 index 0000000000..f9f3a70c57 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/c158da.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void length_c158da() { + half res = fabs(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + length_c158da(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + length_c158da(); + return; +} + +kernel void compute_main() { + length_c158da(); + return; +} + diff --git a/test/tint/builtins/gen/literal/length/c158da.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/length/c158da.wgsl.expected.spvasm new file mode 100644 index 0000000000..8199018c86 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/c158da.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %length_c158da "length_c158da" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%length_c158da = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Length %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %length_c158da + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %length_c158da + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %length_c158da + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/length/c158da.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/length/c158da.wgsl.expected.wgsl new file mode 100644 index 0000000000..3cbfcfe859 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/c158da.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn length_c158da() { + var res : f16 = length(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_c158da(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_c158da(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_c158da(); +} diff --git a/test/tint/builtins/gen/literal/log/6ff86f.wgsl b/test/tint/builtins/gen/literal/log/6ff86f.wgsl new file mode 100644 index 0000000000..761a154d1f --- /dev/null +++ b/test/tint/builtins/gen/literal/log/6ff86f.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn log(vec<3, f16>) -> vec<3, f16> +fn log_6ff86f() { + var res: vec3 = log(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_6ff86f(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_6ff86f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_6ff86f(); +} diff --git a/test/tint/builtins/gen/literal/log/6ff86f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/log/6ff86f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b141371603 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/6ff86f.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void log_6ff86f() { + vector res = log((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_6ff86f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_6ff86f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_6ff86f(); + return; +} diff --git a/test/tint/builtins/gen/literal/log/6ff86f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/log/6ff86f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9f4b2ef8b1 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/6ff86f.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void log_6ff86f() { + vector res = log((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_6ff86f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_6ff86f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_6ff86f(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000269CEF087E0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/log/6ff86f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/log/6ff86f.wgsl.expected.glsl new file mode 100644 index 0000000000..2d6e06dd6a --- /dev/null +++ b/test/tint/builtins/gen/literal/log/6ff86f.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log_6ff86f() { + f16vec3 res = log(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + log_6ff86f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void log_6ff86f() { + f16vec3 res = log(f16vec3(0.0hf)); +} + +void fragment_main() { + log_6ff86f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log_6ff86f() { + f16vec3 res = log(f16vec3(0.0hf)); +} + +void compute_main() { + log_6ff86f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/log/6ff86f.wgsl.expected.msl b/test/tint/builtins/gen/literal/log/6ff86f.wgsl.expected.msl new file mode 100644 index 0000000000..ae294140ea --- /dev/null +++ b/test/tint/builtins/gen/literal/log/6ff86f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void log_6ff86f() { + half3 res = log(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log_6ff86f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log_6ff86f(); + return; +} + +kernel void compute_main() { + log_6ff86f(); + return; +} + diff --git a/test/tint/builtins/gen/literal/log/6ff86f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/log/6ff86f.wgsl.expected.spvasm new file mode 100644 index 0000000000..51676f2424 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/6ff86f.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log_6ff86f "log_6ff86f" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %log_6ff86f = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Log %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %log_6ff86f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %log_6ff86f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %log_6ff86f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/log/6ff86f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/log/6ff86f.wgsl.expected.wgsl new file mode 100644 index 0000000000..9fbbe3ec2d --- /dev/null +++ b/test/tint/builtins/gen/literal/log/6ff86f.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn log_6ff86f() { + var res : vec3 = log(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_6ff86f(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_6ff86f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_6ff86f(); +} diff --git a/test/tint/builtins/gen/literal/log/8f0e32.wgsl b/test/tint/builtins/gen/literal/log/8f0e32.wgsl new file mode 100644 index 0000000000..0f6db81cd3 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/8f0e32.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn log(vec<2, f16>) -> vec<2, f16> +fn log_8f0e32() { + var res: vec2 = log(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_8f0e32(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_8f0e32(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_8f0e32(); +} diff --git a/test/tint/builtins/gen/literal/log/8f0e32.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/log/8f0e32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c73463a00d --- /dev/null +++ b/test/tint/builtins/gen/literal/log/8f0e32.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void log_8f0e32() { + vector res = log((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_8f0e32(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_8f0e32(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_8f0e32(); + return; +} diff --git a/test/tint/builtins/gen/literal/log/8f0e32.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/log/8f0e32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c8ce6df0b3 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/8f0e32.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void log_8f0e32() { + vector res = log((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_8f0e32(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_8f0e32(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_8f0e32(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000262B0B30AC0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/log/8f0e32.wgsl.expected.glsl b/test/tint/builtins/gen/literal/log/8f0e32.wgsl.expected.glsl new file mode 100644 index 0000000000..923ec6a90e --- /dev/null +++ b/test/tint/builtins/gen/literal/log/8f0e32.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log_8f0e32() { + f16vec2 res = log(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + log_8f0e32(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void log_8f0e32() { + f16vec2 res = log(f16vec2(0.0hf)); +} + +void fragment_main() { + log_8f0e32(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log_8f0e32() { + f16vec2 res = log(f16vec2(0.0hf)); +} + +void compute_main() { + log_8f0e32(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/log/8f0e32.wgsl.expected.msl b/test/tint/builtins/gen/literal/log/8f0e32.wgsl.expected.msl new file mode 100644 index 0000000000..ecced226fb --- /dev/null +++ b/test/tint/builtins/gen/literal/log/8f0e32.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void log_8f0e32() { + half2 res = log(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log_8f0e32(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log_8f0e32(); + return; +} + +kernel void compute_main() { + log_8f0e32(); + return; +} + diff --git a/test/tint/builtins/gen/literal/log/8f0e32.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/log/8f0e32.wgsl.expected.spvasm new file mode 100644 index 0000000000..7ff10aa72f --- /dev/null +++ b/test/tint/builtins/gen/literal/log/8f0e32.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log_8f0e32 "log_8f0e32" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %log_8f0e32 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Log %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %log_8f0e32 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %log_8f0e32 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %log_8f0e32 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/log/8f0e32.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/log/8f0e32.wgsl.expected.wgsl new file mode 100644 index 0000000000..e2a7276a45 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/8f0e32.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn log_8f0e32() { + var res : vec2 = log(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_8f0e32(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_8f0e32(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_8f0e32(); +} diff --git a/test/tint/builtins/gen/literal/log/c9f489.wgsl b/test/tint/builtins/gen/literal/log/c9f489.wgsl new file mode 100644 index 0000000000..659b08c475 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/c9f489.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn log(f16) -> f16 +fn log_c9f489() { + var res: f16 = log(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_c9f489(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_c9f489(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_c9f489(); +} diff --git a/test/tint/builtins/gen/literal/log/c9f489.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/log/c9f489.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..eb5150b0a4 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/c9f489.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void log_c9f489() { + float16_t res = log(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_c9f489(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_c9f489(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_c9f489(); + return; +} diff --git a/test/tint/builtins/gen/literal/log/c9f489.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/log/c9f489.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9510d92bf2 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/c9f489.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void log_c9f489() { + float16_t res = log(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_c9f489(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_c9f489(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_c9f489(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000200F08314A0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000200F08314A0(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/log/c9f489.wgsl.expected.glsl b/test/tint/builtins/gen/literal/log/c9f489.wgsl.expected.glsl new file mode 100644 index 0000000000..62eeaa9507 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/c9f489.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log_c9f489() { + float16_t res = log(0.0hf); +} + +vec4 vertex_main() { + log_c9f489(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void log_c9f489() { + float16_t res = log(0.0hf); +} + +void fragment_main() { + log_c9f489(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log_c9f489() { + float16_t res = log(0.0hf); +} + +void compute_main() { + log_c9f489(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/log/c9f489.wgsl.expected.msl b/test/tint/builtins/gen/literal/log/c9f489.wgsl.expected.msl new file mode 100644 index 0000000000..65bd95a721 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/c9f489.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void log_c9f489() { + half res = log(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log_c9f489(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log_c9f489(); + return; +} + +kernel void compute_main() { + log_c9f489(); + return; +} + diff --git a/test/tint/builtins/gen/literal/log/c9f489.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/log/c9f489.wgsl.expected.spvasm new file mode 100644 index 0000000000..304b6ec93d --- /dev/null +++ b/test/tint/builtins/gen/literal/log/c9f489.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log_c9f489 "log_c9f489" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %log_c9f489 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Log %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %log_c9f489 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %log_c9f489 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %log_c9f489 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/log/c9f489.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/log/c9f489.wgsl.expected.wgsl new file mode 100644 index 0000000000..6279a42ab8 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/c9f489.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn log_c9f489() { + var res : f16 = log(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_c9f489(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_c9f489(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_c9f489(); +} diff --git a/test/tint/builtins/gen/literal/log/cdbdc1.wgsl b/test/tint/builtins/gen/literal/log/cdbdc1.wgsl new file mode 100644 index 0000000000..448267561c --- /dev/null +++ b/test/tint/builtins/gen/literal/log/cdbdc1.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn log(vec<4, f16>) -> vec<4, f16> +fn log_cdbdc1() { + var res: vec4 = log(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_cdbdc1(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_cdbdc1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_cdbdc1(); +} diff --git a/test/tint/builtins/gen/literal/log/cdbdc1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/log/cdbdc1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..754e2906d5 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/cdbdc1.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void log_cdbdc1() { + vector res = log((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_cdbdc1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_cdbdc1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_cdbdc1(); + return; +} diff --git a/test/tint/builtins/gen/literal/log/cdbdc1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/log/cdbdc1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..46491bc179 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/cdbdc1.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void log_cdbdc1() { + vector res = log((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_cdbdc1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_cdbdc1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_cdbdc1(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001EBFCF31A60(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/log/cdbdc1.wgsl.expected.glsl b/test/tint/builtins/gen/literal/log/cdbdc1.wgsl.expected.glsl new file mode 100644 index 0000000000..41e6eab215 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/cdbdc1.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log_cdbdc1() { + f16vec4 res = log(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + log_cdbdc1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void log_cdbdc1() { + f16vec4 res = log(f16vec4(0.0hf)); +} + +void fragment_main() { + log_cdbdc1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log_cdbdc1() { + f16vec4 res = log(f16vec4(0.0hf)); +} + +void compute_main() { + log_cdbdc1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/log/cdbdc1.wgsl.expected.msl b/test/tint/builtins/gen/literal/log/cdbdc1.wgsl.expected.msl new file mode 100644 index 0000000000..77806e8fb7 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/cdbdc1.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void log_cdbdc1() { + half4 res = log(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log_cdbdc1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log_cdbdc1(); + return; +} + +kernel void compute_main() { + log_cdbdc1(); + return; +} + diff --git a/test/tint/builtins/gen/literal/log/cdbdc1.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/log/cdbdc1.wgsl.expected.spvasm new file mode 100644 index 0000000000..6eea354d8e --- /dev/null +++ b/test/tint/builtins/gen/literal/log/cdbdc1.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log_cdbdc1 "log_cdbdc1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %log_cdbdc1 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Log %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %log_cdbdc1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %log_cdbdc1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %log_cdbdc1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/log/cdbdc1.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/log/cdbdc1.wgsl.expected.wgsl new file mode 100644 index 0000000000..645ccf90b5 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/cdbdc1.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn log_cdbdc1() { + var res : vec4 = log(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_cdbdc1(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_cdbdc1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_cdbdc1(); +} diff --git a/test/tint/builtins/gen/literal/log2/38b478.wgsl b/test/tint/builtins/gen/literal/log2/38b478.wgsl new file mode 100644 index 0000000000..493fbb21c6 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/38b478.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn log2(vec<3, f16>) -> vec<3, f16> +fn log2_38b478() { + var res: vec3 = log2(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_38b478(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_38b478(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_38b478(); +} diff --git a/test/tint/builtins/gen/literal/log2/38b478.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/log2/38b478.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..029b567536 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/38b478.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void log2_38b478() { + vector res = log2((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_38b478(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_38b478(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_38b478(); + return; +} diff --git a/test/tint/builtins/gen/literal/log2/38b478.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/log2/38b478.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..76ffd386c3 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/38b478.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void log2_38b478() { + vector res = log2((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_38b478(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_38b478(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_38b478(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D9884A1160(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/log2/38b478.wgsl.expected.glsl b/test/tint/builtins/gen/literal/log2/38b478.wgsl.expected.glsl new file mode 100644 index 0000000000..e0f07c61a6 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/38b478.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log2_38b478() { + f16vec3 res = log2(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + log2_38b478(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void log2_38b478() { + f16vec3 res = log2(f16vec3(0.0hf)); +} + +void fragment_main() { + log2_38b478(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log2_38b478() { + f16vec3 res = log2(f16vec3(0.0hf)); +} + +void compute_main() { + log2_38b478(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/log2/38b478.wgsl.expected.msl b/test/tint/builtins/gen/literal/log2/38b478.wgsl.expected.msl new file mode 100644 index 0000000000..a36b81fd14 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/38b478.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void log2_38b478() { + half3 res = log2(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log2_38b478(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log2_38b478(); + return; +} + +kernel void compute_main() { + log2_38b478(); + return; +} + diff --git a/test/tint/builtins/gen/literal/log2/38b478.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/log2/38b478.wgsl.expected.spvasm new file mode 100644 index 0000000000..de97fedcd9 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/38b478.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log2_38b478 "log2_38b478" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%log2_38b478 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Log2 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %log2_38b478 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %log2_38b478 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %log2_38b478 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/log2/38b478.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/log2/38b478.wgsl.expected.wgsl new file mode 100644 index 0000000000..9dee10e9d8 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/38b478.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn log2_38b478() { + var res : vec3 = log2(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_38b478(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_38b478(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_38b478(); +} diff --git a/test/tint/builtins/gen/literal/log2/776088.wgsl b/test/tint/builtins/gen/literal/log2/776088.wgsl new file mode 100644 index 0000000000..3843754756 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/776088.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn log2(vec<4, f16>) -> vec<4, f16> +fn log2_776088() { + var res: vec4 = log2(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_776088(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_776088(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_776088(); +} diff --git a/test/tint/builtins/gen/literal/log2/776088.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/log2/776088.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2a3af8f868 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/776088.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void log2_776088() { + vector res = log2((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_776088(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_776088(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_776088(); + return; +} diff --git a/test/tint/builtins/gen/literal/log2/776088.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/log2/776088.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cc463e0fe9 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/776088.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void log2_776088() { + vector res = log2((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_776088(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_776088(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_776088(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000254F7CB1160(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/log2/776088.wgsl.expected.glsl b/test/tint/builtins/gen/literal/log2/776088.wgsl.expected.glsl new file mode 100644 index 0000000000..ebf4aa1ead --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/776088.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log2_776088() { + f16vec4 res = log2(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + log2_776088(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void log2_776088() { + f16vec4 res = log2(f16vec4(0.0hf)); +} + +void fragment_main() { + log2_776088(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log2_776088() { + f16vec4 res = log2(f16vec4(0.0hf)); +} + +void compute_main() { + log2_776088(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/log2/776088.wgsl.expected.msl b/test/tint/builtins/gen/literal/log2/776088.wgsl.expected.msl new file mode 100644 index 0000000000..eae4b4dd56 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/776088.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void log2_776088() { + half4 res = log2(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log2_776088(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log2_776088(); + return; +} + +kernel void compute_main() { + log2_776088(); + return; +} + diff --git a/test/tint/builtins/gen/literal/log2/776088.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/log2/776088.wgsl.expected.spvasm new file mode 100644 index 0000000000..47d547b781 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/776088.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log2_776088 "log2_776088" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%log2_776088 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Log2 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %log2_776088 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %log2_776088 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %log2_776088 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/log2/776088.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/log2/776088.wgsl.expected.wgsl new file mode 100644 index 0000000000..87971b4c10 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/776088.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn log2_776088() { + var res : vec4 = log2(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_776088(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_776088(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_776088(); +} diff --git a/test/tint/builtins/gen/literal/log2/8c10b3.wgsl b/test/tint/builtins/gen/literal/log2/8c10b3.wgsl new file mode 100644 index 0000000000..669e8ca108 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/8c10b3.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn log2(f16) -> f16 +fn log2_8c10b3() { + var res: f16 = log2(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_8c10b3(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_8c10b3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_8c10b3(); +} diff --git a/test/tint/builtins/gen/literal/log2/8c10b3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/log2/8c10b3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9edb6afaca --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/8c10b3.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void log2_8c10b3() { + float16_t res = log2(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_8c10b3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_8c10b3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_8c10b3(); + return; +} diff --git a/test/tint/builtins/gen/literal/log2/8c10b3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/log2/8c10b3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a1f50c0568 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/8c10b3.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void log2_8c10b3() { + float16_t res = log2(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_8c10b3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_8c10b3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_8c10b3(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021DFAAFB990(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021DFAAFB990(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/log2/8c10b3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/log2/8c10b3.wgsl.expected.glsl new file mode 100644 index 0000000000..7b9deb9413 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/8c10b3.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log2_8c10b3() { + float16_t res = log2(0.0hf); +} + +vec4 vertex_main() { + log2_8c10b3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void log2_8c10b3() { + float16_t res = log2(0.0hf); +} + +void fragment_main() { + log2_8c10b3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log2_8c10b3() { + float16_t res = log2(0.0hf); +} + +void compute_main() { + log2_8c10b3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/log2/8c10b3.wgsl.expected.msl b/test/tint/builtins/gen/literal/log2/8c10b3.wgsl.expected.msl new file mode 100644 index 0000000000..0ea021a45d --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/8c10b3.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void log2_8c10b3() { + half res = log2(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log2_8c10b3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log2_8c10b3(); + return; +} + +kernel void compute_main() { + log2_8c10b3(); + return; +} + diff --git a/test/tint/builtins/gen/literal/log2/8c10b3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/log2/8c10b3.wgsl.expected.spvasm new file mode 100644 index 0000000000..f269f689eb --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/8c10b3.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log2_8c10b3 "log2_8c10b3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%log2_8c10b3 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Log2 %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %log2_8c10b3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %log2_8c10b3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %log2_8c10b3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/log2/8c10b3.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/log2/8c10b3.wgsl.expected.wgsl new file mode 100644 index 0000000000..6de59eced0 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/8c10b3.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn log2_8c10b3() { + var res : f16 = log2(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_8c10b3(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_8c10b3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_8c10b3(); +} diff --git a/test/tint/builtins/gen/literal/log2/fb9f0b.wgsl b/test/tint/builtins/gen/literal/log2/fb9f0b.wgsl new file mode 100644 index 0000000000..9f7c93aff1 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/fb9f0b.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn log2(vec<2, f16>) -> vec<2, f16> +fn log2_fb9f0b() { + var res: vec2 = log2(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_fb9f0b(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_fb9f0b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_fb9f0b(); +} diff --git a/test/tint/builtins/gen/literal/log2/fb9f0b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/log2/fb9f0b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1614719747 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/fb9f0b.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void log2_fb9f0b() { + vector res = log2((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_fb9f0b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_fb9f0b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_fb9f0b(); + return; +} diff --git a/test/tint/builtins/gen/literal/log2/fb9f0b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/log2/fb9f0b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..13779ea4b9 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/fb9f0b.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void log2_fb9f0b() { + vector res = log2((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_fb9f0b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_fb9f0b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_fb9f0b(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D63F9088D0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/log2/fb9f0b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/log2/fb9f0b.wgsl.expected.glsl new file mode 100644 index 0000000000..73abe1d60c --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/fb9f0b.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log2_fb9f0b() { + f16vec2 res = log2(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + log2_fb9f0b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void log2_fb9f0b() { + f16vec2 res = log2(f16vec2(0.0hf)); +} + +void fragment_main() { + log2_fb9f0b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log2_fb9f0b() { + f16vec2 res = log2(f16vec2(0.0hf)); +} + +void compute_main() { + log2_fb9f0b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/log2/fb9f0b.wgsl.expected.msl b/test/tint/builtins/gen/literal/log2/fb9f0b.wgsl.expected.msl new file mode 100644 index 0000000000..0532f4db98 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/fb9f0b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void log2_fb9f0b() { + half2 res = log2(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log2_fb9f0b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log2_fb9f0b(); + return; +} + +kernel void compute_main() { + log2_fb9f0b(); + return; +} + diff --git a/test/tint/builtins/gen/literal/log2/fb9f0b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/log2/fb9f0b.wgsl.expected.spvasm new file mode 100644 index 0000000000..2dfd8bd4ef --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/fb9f0b.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log2_fb9f0b "log2_fb9f0b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%log2_fb9f0b = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Log2 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %log2_fb9f0b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %log2_fb9f0b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %log2_fb9f0b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/log2/fb9f0b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/log2/fb9f0b.wgsl.expected.wgsl new file mode 100644 index 0000000000..4fdced8d39 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/fb9f0b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn log2_fb9f0b() { + var res : vec2 = log2(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_fb9f0b(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_fb9f0b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_fb9f0b(); +} diff --git a/test/tint/builtins/gen/literal/max/111ac0.wgsl b/test/tint/builtins/gen/literal/max/111ac0.wgsl new file mode 100644 index 0000000000..1a46cb56e9 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/111ac0.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn max(f16, f16) -> f16 +fn max_111ac0() { + var res: f16 = max(f16(), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_111ac0(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_111ac0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_111ac0(); +} diff --git a/test/tint/builtins/gen/literal/max/111ac0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/max/111ac0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..972d568803 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/111ac0.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void max_111ac0() { + float16_t res = max(float16_t(0.0h), float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_111ac0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_111ac0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_111ac0(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/111ac0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/max/111ac0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e031d96c8e --- /dev/null +++ b/test/tint/builtins/gen/literal/max/111ac0.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void max_111ac0() { + float16_t res = max(float16_t(0.0h), float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_111ac0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_111ac0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_111ac0(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000215BA37C140(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000215BA37C140(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/max/111ac0.wgsl.expected.glsl b/test/tint/builtins/gen/literal/max/111ac0.wgsl.expected.glsl new file mode 100644 index 0000000000..b0864de5d9 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/111ac0.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void max_111ac0() { + float16_t res = max(0.0hf, 0.0hf); +} + +vec4 vertex_main() { + max_111ac0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void max_111ac0() { + float16_t res = max(0.0hf, 0.0hf); +} + +void fragment_main() { + max_111ac0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void max_111ac0() { + float16_t res = max(0.0hf, 0.0hf); +} + +void compute_main() { + max_111ac0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/111ac0.wgsl.expected.msl b/test/tint/builtins/gen/literal/max/111ac0.wgsl.expected.msl new file mode 100644 index 0000000000..ccbcac5c21 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/111ac0.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void max_111ac0() { + half res = fmax(0.0h, 0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_111ac0(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_111ac0(); + return; +} + +kernel void compute_main() { + max_111ac0(); + return; +} + diff --git a/test/tint/builtins/gen/literal/max/111ac0.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/max/111ac0.wgsl.expected.spvasm new file mode 100644 index 0000000000..b3c080526c --- /dev/null +++ b/test/tint/builtins/gen/literal/max/111ac0.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_111ac0 "max_111ac0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %max_111ac0 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 NMax %16 %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %max_111ac0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %max_111ac0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %max_111ac0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/max/111ac0.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/max/111ac0.wgsl.expected.wgsl new file mode 100644 index 0000000000..86e79dd6bd --- /dev/null +++ b/test/tint/builtins/gen/literal/max/111ac0.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn max_111ac0() { + var res : f16 = max(f16(), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_111ac0(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_111ac0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_111ac0(); +} diff --git a/test/tint/builtins/gen/literal/max/34956e.wgsl b/test/tint/builtins/gen/literal/max/34956e.wgsl new file mode 100644 index 0000000000..2b22a891df --- /dev/null +++ b/test/tint/builtins/gen/literal/max/34956e.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn max(vec<2, f16>, vec<2, f16>) -> vec<2, f16> +fn max_34956e() { + var res: vec2 = max(vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_34956e(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_34956e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_34956e(); +} diff --git a/test/tint/builtins/gen/literal/max/34956e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/max/34956e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5ecb9bd768 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/34956e.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void max_34956e() { + vector res = max((float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_34956e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_34956e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_34956e(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/34956e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/max/34956e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..54be2a8d9c --- /dev/null +++ b/test/tint/builtins/gen/literal/max/34956e.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void max_34956e() { + vector res = max((float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_34956e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_34956e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_34956e(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000016DDE0B63C0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/max/34956e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/max/34956e.wgsl.expected.glsl new file mode 100644 index 0000000000..c9fb73cc88 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/34956e.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void max_34956e() { + f16vec2 res = max(f16vec2(0.0hf), f16vec2(0.0hf)); +} + +vec4 vertex_main() { + max_34956e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void max_34956e() { + f16vec2 res = max(f16vec2(0.0hf), f16vec2(0.0hf)); +} + +void fragment_main() { + max_34956e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void max_34956e() { + f16vec2 res = max(f16vec2(0.0hf), f16vec2(0.0hf)); +} + +void compute_main() { + max_34956e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/34956e.wgsl.expected.msl b/test/tint/builtins/gen/literal/max/34956e.wgsl.expected.msl new file mode 100644 index 0000000000..4f655400f5 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/34956e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void max_34956e() { + half2 res = fmax(half2(0.0h), half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_34956e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_34956e(); + return; +} + +kernel void compute_main() { + max_34956e(); + return; +} + diff --git a/test/tint/builtins/gen/literal/max/34956e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/max/34956e.wgsl.expected.spvasm new file mode 100644 index 0000000000..e8003c296e --- /dev/null +++ b/test/tint/builtins/gen/literal/max/34956e.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_34956e "max_34956e" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %max_34956e = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 NMax %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %max_34956e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %max_34956e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %max_34956e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/max/34956e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/max/34956e.wgsl.expected.wgsl new file mode 100644 index 0000000000..45ee0302f3 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/34956e.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn max_34956e() { + var res : vec2 = max(vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_34956e(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_34956e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_34956e(); +} diff --git a/test/tint/builtins/gen/literal/max/445169.wgsl b/test/tint/builtins/gen/literal/max/445169.wgsl new file mode 100644 index 0000000000..8752c1ed49 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/445169.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn max(vec<3, f16>, vec<3, f16>) -> vec<3, f16> +fn max_445169() { + var res: vec3 = max(vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_445169(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_445169(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_445169(); +} diff --git a/test/tint/builtins/gen/literal/max/445169.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/max/445169.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a291c4c2ba --- /dev/null +++ b/test/tint/builtins/gen/literal/max/445169.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void max_445169() { + vector res = max((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_445169(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_445169(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_445169(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/445169.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/max/445169.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bed53ac19f --- /dev/null +++ b/test/tint/builtins/gen/literal/max/445169.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void max_445169() { + vector res = max((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_445169(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_445169(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_445169(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000280F3D6A940(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/max/445169.wgsl.expected.glsl b/test/tint/builtins/gen/literal/max/445169.wgsl.expected.glsl new file mode 100644 index 0000000000..dd8ccdf5f0 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/445169.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void max_445169() { + f16vec3 res = max(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +vec4 vertex_main() { + max_445169(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void max_445169() { + f16vec3 res = max(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +void fragment_main() { + max_445169(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void max_445169() { + f16vec3 res = max(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +void compute_main() { + max_445169(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/445169.wgsl.expected.msl b/test/tint/builtins/gen/literal/max/445169.wgsl.expected.msl new file mode 100644 index 0000000000..5bd10e91db --- /dev/null +++ b/test/tint/builtins/gen/literal/max/445169.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void max_445169() { + half3 res = fmax(half3(0.0h), half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_445169(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_445169(); + return; +} + +kernel void compute_main() { + max_445169(); + return; +} + diff --git a/test/tint/builtins/gen/literal/max/445169.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/max/445169.wgsl.expected.spvasm new file mode 100644 index 0000000000..3e1a6af228 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/445169.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_445169 "max_445169" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %max_445169 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 NMax %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %max_445169 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %max_445169 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %max_445169 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/max/445169.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/max/445169.wgsl.expected.wgsl new file mode 100644 index 0000000000..4e1c567026 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/445169.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn max_445169() { + var res : vec3 = max(vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_445169(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_445169(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_445169(); +} diff --git a/test/tint/builtins/gen/literal/max/e14f2b.wgsl b/test/tint/builtins/gen/literal/max/e14f2b.wgsl new file mode 100644 index 0000000000..fd8638a5b1 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/e14f2b.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn max(vec<4, f16>, vec<4, f16>) -> vec<4, f16> +fn max_e14f2b() { + var res: vec4 = max(vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_e14f2b(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_e14f2b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_e14f2b(); +} diff --git a/test/tint/builtins/gen/literal/max/e14f2b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/max/e14f2b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5f790278b7 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/e14f2b.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void max_e14f2b() { + vector res = max((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_e14f2b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_e14f2b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_e14f2b(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/e14f2b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/max/e14f2b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cff4cc60fd --- /dev/null +++ b/test/tint/builtins/gen/literal/max/e14f2b.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void max_e14f2b() { + vector res = max((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_e14f2b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_e14f2b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_e14f2b(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002878BF192B0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/max/e14f2b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/max/e14f2b.wgsl.expected.glsl new file mode 100644 index 0000000000..f4f78bb501 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/e14f2b.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void max_e14f2b() { + f16vec4 res = max(f16vec4(0.0hf), f16vec4(0.0hf)); +} + +vec4 vertex_main() { + max_e14f2b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void max_e14f2b() { + f16vec4 res = max(f16vec4(0.0hf), f16vec4(0.0hf)); +} + +void fragment_main() { + max_e14f2b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void max_e14f2b() { + f16vec4 res = max(f16vec4(0.0hf), f16vec4(0.0hf)); +} + +void compute_main() { + max_e14f2b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/e14f2b.wgsl.expected.msl b/test/tint/builtins/gen/literal/max/e14f2b.wgsl.expected.msl new file mode 100644 index 0000000000..3620c0511d --- /dev/null +++ b/test/tint/builtins/gen/literal/max/e14f2b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void max_e14f2b() { + half4 res = fmax(half4(0.0h), half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_e14f2b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_e14f2b(); + return; +} + +kernel void compute_main() { + max_e14f2b(); + return; +} + diff --git a/test/tint/builtins/gen/literal/max/e14f2b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/max/e14f2b.wgsl.expected.spvasm new file mode 100644 index 0000000000..61981040cf --- /dev/null +++ b/test/tint/builtins/gen/literal/max/e14f2b.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_e14f2b "max_e14f2b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %max_e14f2b = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 NMax %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %max_e14f2b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %max_e14f2b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %max_e14f2b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/max/e14f2b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/max/e14f2b.wgsl.expected.wgsl new file mode 100644 index 0000000000..e0d214cfc3 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/e14f2b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn max_e14f2b() { + var res : vec4 = max(vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_e14f2b(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_e14f2b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_e14f2b(); +} diff --git a/test/tint/builtins/gen/literal/min/7c710a.wgsl b/test/tint/builtins/gen/literal/min/7c710a.wgsl new file mode 100644 index 0000000000..f8cf0d3bcf --- /dev/null +++ b/test/tint/builtins/gen/literal/min/7c710a.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn min(vec<4, f16>, vec<4, f16>) -> vec<4, f16> +fn min_7c710a() { + var res: vec4 = min(vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_7c710a(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_7c710a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_7c710a(); +} diff --git a/test/tint/builtins/gen/literal/min/7c710a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/min/7c710a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b065ca877e --- /dev/null +++ b/test/tint/builtins/gen/literal/min/7c710a.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void min_7c710a() { + vector res = min((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_7c710a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_7c710a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_7c710a(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/7c710a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/min/7c710a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8a7bcbdf7f --- /dev/null +++ b/test/tint/builtins/gen/literal/min/7c710a.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void min_7c710a() { + vector res = min((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_7c710a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_7c710a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_7c710a(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000236F63CBD50(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/min/7c710a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/min/7c710a.wgsl.expected.glsl new file mode 100644 index 0000000000..f794845684 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/7c710a.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void min_7c710a() { + f16vec4 res = min(f16vec4(0.0hf), f16vec4(0.0hf)); +} + +vec4 vertex_main() { + min_7c710a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void min_7c710a() { + f16vec4 res = min(f16vec4(0.0hf), f16vec4(0.0hf)); +} + +void fragment_main() { + min_7c710a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void min_7c710a() { + f16vec4 res = min(f16vec4(0.0hf), f16vec4(0.0hf)); +} + +void compute_main() { + min_7c710a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/7c710a.wgsl.expected.msl b/test/tint/builtins/gen/literal/min/7c710a.wgsl.expected.msl new file mode 100644 index 0000000000..7805826d56 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/7c710a.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void min_7c710a() { + half4 res = fmin(half4(0.0h), half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_7c710a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_7c710a(); + return; +} + +kernel void compute_main() { + min_7c710a(); + return; +} + diff --git a/test/tint/builtins/gen/literal/min/7c710a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/min/7c710a.wgsl.expected.spvasm new file mode 100644 index 0000000000..60cd2d2bae --- /dev/null +++ b/test/tint/builtins/gen/literal/min/7c710a.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_7c710a "min_7c710a" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %min_7c710a = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 NMin %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %min_7c710a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %min_7c710a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %min_7c710a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/min/7c710a.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/min/7c710a.wgsl.expected.wgsl new file mode 100644 index 0000000000..ee18161098 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/7c710a.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn min_7c710a() { + var res : vec4 = min(vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_7c710a(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_7c710a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_7c710a(); +} diff --git a/test/tint/builtins/gen/literal/min/ab0acd.wgsl b/test/tint/builtins/gen/literal/min/ab0acd.wgsl new file mode 100644 index 0000000000..568017c8c0 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/ab0acd.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn min(vec<3, f16>, vec<3, f16>) -> vec<3, f16> +fn min_ab0acd() { + var res: vec3 = min(vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_ab0acd(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_ab0acd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_ab0acd(); +} diff --git a/test/tint/builtins/gen/literal/min/ab0acd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/min/ab0acd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..839e6b794f --- /dev/null +++ b/test/tint/builtins/gen/literal/min/ab0acd.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void min_ab0acd() { + vector res = min((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_ab0acd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_ab0acd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_ab0acd(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/ab0acd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/min/ab0acd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9a20bd5133 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/ab0acd.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void min_ab0acd() { + vector res = min((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_ab0acd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_ab0acd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_ab0acd(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002CE0B337DB0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/min/ab0acd.wgsl.expected.glsl b/test/tint/builtins/gen/literal/min/ab0acd.wgsl.expected.glsl new file mode 100644 index 0000000000..bc985d79d0 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/ab0acd.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void min_ab0acd() { + f16vec3 res = min(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +vec4 vertex_main() { + min_ab0acd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void min_ab0acd() { + f16vec3 res = min(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +void fragment_main() { + min_ab0acd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void min_ab0acd() { + f16vec3 res = min(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +void compute_main() { + min_ab0acd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/ab0acd.wgsl.expected.msl b/test/tint/builtins/gen/literal/min/ab0acd.wgsl.expected.msl new file mode 100644 index 0000000000..cbac2a3425 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/ab0acd.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void min_ab0acd() { + half3 res = fmin(half3(0.0h), half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_ab0acd(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_ab0acd(); + return; +} + +kernel void compute_main() { + min_ab0acd(); + return; +} + diff --git a/test/tint/builtins/gen/literal/min/ab0acd.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/min/ab0acd.wgsl.expected.spvasm new file mode 100644 index 0000000000..42feca5959 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/ab0acd.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_ab0acd "min_ab0acd" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %min_ab0acd = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 NMin %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %min_ab0acd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %min_ab0acd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %min_ab0acd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/min/ab0acd.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/min/ab0acd.wgsl.expected.wgsl new file mode 100644 index 0000000000..01c09ea37f --- /dev/null +++ b/test/tint/builtins/gen/literal/min/ab0acd.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn min_ab0acd() { + var res : vec3 = min(vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_ab0acd(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_ab0acd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_ab0acd(); +} diff --git a/test/tint/builtins/gen/literal/min/ac84d6.wgsl b/test/tint/builtins/gen/literal/min/ac84d6.wgsl new file mode 100644 index 0000000000..4222ad4319 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/ac84d6.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn min(f16, f16) -> f16 +fn min_ac84d6() { + var res: f16 = min(f16(), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_ac84d6(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_ac84d6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_ac84d6(); +} diff --git a/test/tint/builtins/gen/literal/min/ac84d6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/min/ac84d6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3d05db9a83 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/ac84d6.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void min_ac84d6() { + float16_t res = min(float16_t(0.0h), float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_ac84d6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_ac84d6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_ac84d6(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/ac84d6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/min/ac84d6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4b61aaa109 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/ac84d6.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void min_ac84d6() { + float16_t res = min(float16_t(0.0h), float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_ac84d6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_ac84d6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_ac84d6(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024815ABE8C0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024815ABE8C0(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/min/ac84d6.wgsl.expected.glsl b/test/tint/builtins/gen/literal/min/ac84d6.wgsl.expected.glsl new file mode 100644 index 0000000000..b79ac60a36 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/ac84d6.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void min_ac84d6() { + float16_t res = min(0.0hf, 0.0hf); +} + +vec4 vertex_main() { + min_ac84d6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void min_ac84d6() { + float16_t res = min(0.0hf, 0.0hf); +} + +void fragment_main() { + min_ac84d6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void min_ac84d6() { + float16_t res = min(0.0hf, 0.0hf); +} + +void compute_main() { + min_ac84d6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/ac84d6.wgsl.expected.msl b/test/tint/builtins/gen/literal/min/ac84d6.wgsl.expected.msl new file mode 100644 index 0000000000..d2674176d7 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/ac84d6.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void min_ac84d6() { + half res = fmin(0.0h, 0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_ac84d6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_ac84d6(); + return; +} + +kernel void compute_main() { + min_ac84d6(); + return; +} + diff --git a/test/tint/builtins/gen/literal/min/ac84d6.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/min/ac84d6.wgsl.expected.spvasm new file mode 100644 index 0000000000..e76e5c3bf4 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/ac84d6.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_ac84d6 "min_ac84d6" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %min_ac84d6 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 NMin %16 %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %min_ac84d6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %min_ac84d6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %min_ac84d6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/min/ac84d6.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/min/ac84d6.wgsl.expected.wgsl new file mode 100644 index 0000000000..9e33bab3ec --- /dev/null +++ b/test/tint/builtins/gen/literal/min/ac84d6.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn min_ac84d6() { + var res : f16 = min(f16(), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_ac84d6(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_ac84d6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_ac84d6(); +} diff --git a/test/tint/builtins/gen/literal/min/e780f9.wgsl b/test/tint/builtins/gen/literal/min/e780f9.wgsl new file mode 100644 index 0000000000..b769097a61 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/e780f9.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn min(vec<2, f16>, vec<2, f16>) -> vec<2, f16> +fn min_e780f9() { + var res: vec2 = min(vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_e780f9(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_e780f9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_e780f9(); +} diff --git a/test/tint/builtins/gen/literal/min/e780f9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/min/e780f9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f9c75ce654 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/e780f9.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void min_e780f9() { + vector res = min((float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_e780f9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_e780f9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_e780f9(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/e780f9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/min/e780f9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a176ab3c84 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/e780f9.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void min_e780f9() { + vector res = min((float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_e780f9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_e780f9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_e780f9(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001FEDC6E7DE0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/min/e780f9.wgsl.expected.glsl b/test/tint/builtins/gen/literal/min/e780f9.wgsl.expected.glsl new file mode 100644 index 0000000000..85e7175282 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/e780f9.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void min_e780f9() { + f16vec2 res = min(f16vec2(0.0hf), f16vec2(0.0hf)); +} + +vec4 vertex_main() { + min_e780f9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void min_e780f9() { + f16vec2 res = min(f16vec2(0.0hf), f16vec2(0.0hf)); +} + +void fragment_main() { + min_e780f9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void min_e780f9() { + f16vec2 res = min(f16vec2(0.0hf), f16vec2(0.0hf)); +} + +void compute_main() { + min_e780f9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/e780f9.wgsl.expected.msl b/test/tint/builtins/gen/literal/min/e780f9.wgsl.expected.msl new file mode 100644 index 0000000000..675ed30e88 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/e780f9.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void min_e780f9() { + half2 res = fmin(half2(0.0h), half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_e780f9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_e780f9(); + return; +} + +kernel void compute_main() { + min_e780f9(); + return; +} + diff --git a/test/tint/builtins/gen/literal/min/e780f9.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/min/e780f9.wgsl.expected.spvasm new file mode 100644 index 0000000000..45dd579ffd --- /dev/null +++ b/test/tint/builtins/gen/literal/min/e780f9.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_e780f9 "min_e780f9" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %min_e780f9 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 NMin %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %min_e780f9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %min_e780f9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %min_e780f9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/min/e780f9.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/min/e780f9.wgsl.expected.wgsl new file mode 100644 index 0000000000..6da42f234a --- /dev/null +++ b/test/tint/builtins/gen/literal/min/e780f9.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn min_e780f9() { + var res : vec2 = min(vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_e780f9(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_e780f9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_e780f9(); +} diff --git a/test/tint/builtins/gen/literal/mix/38cbbb.wgsl b/test/tint/builtins/gen/literal/mix/38cbbb.wgsl new file mode 100644 index 0000000000..66ba78691a --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/38cbbb.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn mix(f16, f16, f16) -> f16 +fn mix_38cbbb() { + var res: f16 = mix(f16(), f16(), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_38cbbb(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_38cbbb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_38cbbb(); +} diff --git a/test/tint/builtins/gen/literal/mix/38cbbb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/mix/38cbbb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f658161ce3 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/38cbbb.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void mix_38cbbb() { + float16_t res = lerp(float16_t(0.0h), float16_t(0.0h), float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_38cbbb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_38cbbb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_38cbbb(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/38cbbb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/mix/38cbbb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d8b981bed6 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/38cbbb.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void mix_38cbbb() { + float16_t res = lerp(float16_t(0.0h), float16_t(0.0h), float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_38cbbb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_38cbbb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_38cbbb(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E08ADE7D50(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E08ADE7D50(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/mix/38cbbb.wgsl.expected.glsl b/test/tint/builtins/gen/literal/mix/38cbbb.wgsl.expected.glsl new file mode 100644 index 0000000000..51e98af0cb --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/38cbbb.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_38cbbb() { + float16_t res = mix(0.0hf, 0.0hf, 0.0hf); +} + +vec4 vertex_main() { + mix_38cbbb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void mix_38cbbb() { + float16_t res = mix(0.0hf, 0.0hf, 0.0hf); +} + +void fragment_main() { + mix_38cbbb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_38cbbb() { + float16_t res = mix(0.0hf, 0.0hf, 0.0hf); +} + +void compute_main() { + mix_38cbbb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/38cbbb.wgsl.expected.msl b/test/tint/builtins/gen/literal/mix/38cbbb.wgsl.expected.msl new file mode 100644 index 0000000000..57e66f3c8e --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/38cbbb.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void mix_38cbbb() { + half res = mix(0.0h, 0.0h, 0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_38cbbb(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_38cbbb(); + return; +} + +kernel void compute_main() { + mix_38cbbb(); + return; +} + diff --git a/test/tint/builtins/gen/literal/mix/38cbbb.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/mix/38cbbb.wgsl.expected.spvasm new file mode 100644 index 0000000000..cbd032d6dd --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/38cbbb.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_38cbbb "mix_38cbbb" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %mix_38cbbb = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 FMix %16 %16 %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %mix_38cbbb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %mix_38cbbb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %mix_38cbbb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/mix/38cbbb.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/mix/38cbbb.wgsl.expected.wgsl new file mode 100644 index 0000000000..383a567c5b --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/38cbbb.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn mix_38cbbb() { + var res : f16 = mix(f16(), f16(), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_38cbbb(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_38cbbb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_38cbbb(); +} diff --git a/test/tint/builtins/gen/literal/mix/63f2fd.wgsl b/test/tint/builtins/gen/literal/mix/63f2fd.wgsl new file mode 100644 index 0000000000..73b7505822 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/63f2fd.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn mix(vec<3, f16>, vec<3, f16>, vec<3, f16>) -> vec<3, f16> +fn mix_63f2fd() { + var res: vec3 = mix(vec3(f16()), vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_63f2fd(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_63f2fd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_63f2fd(); +} diff --git a/test/tint/builtins/gen/literal/mix/63f2fd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/mix/63f2fd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3729fefdbe --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/63f2fd.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void mix_63f2fd() { + vector res = lerp((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_63f2fd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_63f2fd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_63f2fd(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/63f2fd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/mix/63f2fd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..92c760882e --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/63f2fd.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void mix_63f2fd() { + vector res = lerp((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_63f2fd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_63f2fd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_63f2fd(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001B9F0AF6FF0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/mix/63f2fd.wgsl.expected.glsl b/test/tint/builtins/gen/literal/mix/63f2fd.wgsl.expected.glsl new file mode 100644 index 0000000000..e51235ba70 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/63f2fd.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_63f2fd() { + f16vec3 res = mix(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf)); +} + +vec4 vertex_main() { + mix_63f2fd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void mix_63f2fd() { + f16vec3 res = mix(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf)); +} + +void fragment_main() { + mix_63f2fd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_63f2fd() { + f16vec3 res = mix(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf)); +} + +void compute_main() { + mix_63f2fd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/63f2fd.wgsl.expected.msl b/test/tint/builtins/gen/literal/mix/63f2fd.wgsl.expected.msl new file mode 100644 index 0000000000..8a9ca6f273 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/63f2fd.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void mix_63f2fd() { + half3 res = mix(half3(0.0h), half3(0.0h), half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_63f2fd(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_63f2fd(); + return; +} + +kernel void compute_main() { + mix_63f2fd(); + return; +} + diff --git a/test/tint/builtins/gen/literal/mix/63f2fd.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/mix/63f2fd.wgsl.expected.spvasm new file mode 100644 index 0000000000..85d9a38d46 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/63f2fd.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_63f2fd "mix_63f2fd" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %mix_63f2fd = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 FMix %17 %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %mix_63f2fd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %mix_63f2fd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %mix_63f2fd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/mix/63f2fd.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/mix/63f2fd.wgsl.expected.wgsl new file mode 100644 index 0000000000..8aa39e8347 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/63f2fd.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn mix_63f2fd() { + var res : vec3 = mix(vec3(f16()), vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_63f2fd(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_63f2fd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_63f2fd(); +} diff --git a/test/tint/builtins/gen/literal/mix/98ee3e.wgsl b/test/tint/builtins/gen/literal/mix/98ee3e.wgsl new file mode 100644 index 0000000000..3c89b0386b --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/98ee3e.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn mix(vec<2, f16>, vec<2, f16>, vec<2, f16>) -> vec<2, f16> +fn mix_98ee3e() { + var res: vec2 = mix(vec2(f16()), vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_98ee3e(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_98ee3e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_98ee3e(); +} diff --git a/test/tint/builtins/gen/literal/mix/98ee3e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/mix/98ee3e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2cc67bace9 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/98ee3e.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void mix_98ee3e() { + vector res = lerp((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_98ee3e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_98ee3e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_98ee3e(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/98ee3e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/mix/98ee3e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..784bfa3174 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/98ee3e.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void mix_98ee3e() { + vector res = lerp((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_98ee3e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_98ee3e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_98ee3e(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000019DF5529870(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/mix/98ee3e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/mix/98ee3e.wgsl.expected.glsl new file mode 100644 index 0000000000..977312c5e0 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/98ee3e.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_98ee3e() { + f16vec2 res = mix(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf)); +} + +vec4 vertex_main() { + mix_98ee3e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void mix_98ee3e() { + f16vec2 res = mix(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf)); +} + +void fragment_main() { + mix_98ee3e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_98ee3e() { + f16vec2 res = mix(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf)); +} + +void compute_main() { + mix_98ee3e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/98ee3e.wgsl.expected.msl b/test/tint/builtins/gen/literal/mix/98ee3e.wgsl.expected.msl new file mode 100644 index 0000000000..4f98b7ad1e --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/98ee3e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void mix_98ee3e() { + half2 res = mix(half2(0.0h), half2(0.0h), half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_98ee3e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_98ee3e(); + return; +} + +kernel void compute_main() { + mix_98ee3e(); + return; +} + diff --git a/test/tint/builtins/gen/literal/mix/98ee3e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/mix/98ee3e.wgsl.expected.spvasm new file mode 100644 index 0000000000..47c734a523 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/98ee3e.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_98ee3e "mix_98ee3e" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %mix_98ee3e = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 FMix %17 %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %mix_98ee3e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %mix_98ee3e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %mix_98ee3e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/mix/98ee3e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/mix/98ee3e.wgsl.expected.wgsl new file mode 100644 index 0000000000..bb4929d442 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/98ee3e.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn mix_98ee3e() { + var res : vec2 = mix(vec2(f16()), vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_98ee3e(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_98ee3e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_98ee3e(); +} diff --git a/test/tint/builtins/gen/literal/mix/c1aec6.wgsl b/test/tint/builtins/gen/literal/mix/c1aec6.wgsl new file mode 100644 index 0000000000..21231efd79 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/c1aec6.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn mix(vec<3, f16>, vec<3, f16>, f16) -> vec<3, f16> +fn mix_c1aec6() { + var res: vec3 = mix(vec3(f16()), vec3(f16()), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_c1aec6(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_c1aec6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_c1aec6(); +} diff --git a/test/tint/builtins/gen/literal/mix/c1aec6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/mix/c1aec6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3463407e3e --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/c1aec6.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void mix_c1aec6() { + vector res = lerp((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_c1aec6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_c1aec6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_c1aec6(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/c1aec6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/mix/c1aec6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..90e3fb0baf --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/c1aec6.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void mix_c1aec6() { + vector res = lerp((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_c1aec6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_c1aec6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_c1aec6(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000197E6FB4A90(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/mix/c1aec6.wgsl.expected.glsl b/test/tint/builtins/gen/literal/mix/c1aec6.wgsl.expected.glsl new file mode 100644 index 0000000000..8411e258e5 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/c1aec6.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_c1aec6() { + f16vec3 res = mix(f16vec3(0.0hf), f16vec3(0.0hf), 0.0hf); +} + +vec4 vertex_main() { + mix_c1aec6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void mix_c1aec6() { + f16vec3 res = mix(f16vec3(0.0hf), f16vec3(0.0hf), 0.0hf); +} + +void fragment_main() { + mix_c1aec6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_c1aec6() { + f16vec3 res = mix(f16vec3(0.0hf), f16vec3(0.0hf), 0.0hf); +} + +void compute_main() { + mix_c1aec6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/c1aec6.wgsl.expected.msl b/test/tint/builtins/gen/literal/mix/c1aec6.wgsl.expected.msl new file mode 100644 index 0000000000..a8285baea8 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/c1aec6.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void mix_c1aec6() { + half3 res = mix(half3(0.0h), half3(0.0h), 0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_c1aec6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_c1aec6(); + return; +} + +kernel void compute_main() { + mix_c1aec6(); + return; +} + diff --git a/test/tint/builtins/gen/literal/mix/c1aec6.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/mix/c1aec6.wgsl.expected.spvasm new file mode 100644 index 0000000000..7b6a048a10 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/c1aec6.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_c1aec6 "mix_c1aec6" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half + %18 = OpConstantNull %half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %mix_c1aec6 = OpFunction %void None %9 + %12 = OpLabel + %19 = OpVariable %_ptr_Function_v3half Function %17 + %res = OpVariable %_ptr_Function_v3half Function %17 + %21 = OpCompositeConstruct %v3half %18 %18 %18 + %13 = OpExtInst %v3half %16 FMix %17 %17 %21 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %mix_c1aec6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %mix_c1aec6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %mix_c1aec6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/mix/c1aec6.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/mix/c1aec6.wgsl.expected.wgsl new file mode 100644 index 0000000000..6665965b40 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/c1aec6.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn mix_c1aec6() { + var res : vec3 = mix(vec3(f16()), vec3(f16()), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_c1aec6(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_c1aec6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_c1aec6(); +} diff --git a/test/tint/builtins/gen/literal/mix/e46a83.wgsl b/test/tint/builtins/gen/literal/mix/e46a83.wgsl new file mode 100644 index 0000000000..6adeecb725 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/e46a83.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn mix(vec<2, f16>, vec<2, f16>, f16) -> vec<2, f16> +fn mix_e46a83() { + var res: vec2 = mix(vec2(f16()), vec2(f16()), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_e46a83(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_e46a83(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_e46a83(); +} diff --git a/test/tint/builtins/gen/literal/mix/e46a83.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/mix/e46a83.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fa0f9c2e1d --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/e46a83.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void mix_e46a83() { + vector res = lerp((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_e46a83(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_e46a83(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_e46a83(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/e46a83.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/mix/e46a83.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6ce6313eff --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/e46a83.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void mix_e46a83() { + vector res = lerp((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_e46a83(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_e46a83(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_e46a83(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F8B7BA68A0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/mix/e46a83.wgsl.expected.glsl b/test/tint/builtins/gen/literal/mix/e46a83.wgsl.expected.glsl new file mode 100644 index 0000000000..bae9e6d35a --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/e46a83.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_e46a83() { + f16vec2 res = mix(f16vec2(0.0hf), f16vec2(0.0hf), 0.0hf); +} + +vec4 vertex_main() { + mix_e46a83(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void mix_e46a83() { + f16vec2 res = mix(f16vec2(0.0hf), f16vec2(0.0hf), 0.0hf); +} + +void fragment_main() { + mix_e46a83(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_e46a83() { + f16vec2 res = mix(f16vec2(0.0hf), f16vec2(0.0hf), 0.0hf); +} + +void compute_main() { + mix_e46a83(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/e46a83.wgsl.expected.msl b/test/tint/builtins/gen/literal/mix/e46a83.wgsl.expected.msl new file mode 100644 index 0000000000..15babbee22 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/e46a83.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void mix_e46a83() { + half2 res = mix(half2(0.0h), half2(0.0h), 0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_e46a83(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_e46a83(); + return; +} + +kernel void compute_main() { + mix_e46a83(); + return; +} + diff --git a/test/tint/builtins/gen/literal/mix/e46a83.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/mix/e46a83.wgsl.expected.spvasm new file mode 100644 index 0000000000..8dfbb2c974 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/e46a83.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_e46a83 "mix_e46a83" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half + %18 = OpConstantNull %half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %mix_e46a83 = OpFunction %void None %9 + %12 = OpLabel + %19 = OpVariable %_ptr_Function_v2half Function %17 + %res = OpVariable %_ptr_Function_v2half Function %17 + %21 = OpCompositeConstruct %v2half %18 %18 + %13 = OpExtInst %v2half %16 FMix %17 %17 %21 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %mix_e46a83 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %mix_e46a83 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %mix_e46a83 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/mix/e46a83.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/mix/e46a83.wgsl.expected.wgsl new file mode 100644 index 0000000000..44b19f2a56 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/e46a83.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn mix_e46a83() { + var res : vec2 = mix(vec2(f16()), vec2(f16()), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_e46a83(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_e46a83(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_e46a83(); +} diff --git a/test/tint/builtins/gen/literal/mix/ee2468.wgsl b/test/tint/builtins/gen/literal/mix/ee2468.wgsl new file mode 100644 index 0000000000..7bf17b5730 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/ee2468.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn mix(vec<4, f16>, vec<4, f16>, vec<4, f16>) -> vec<4, f16> +fn mix_ee2468() { + var res: vec4 = mix(vec4(f16()), vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_ee2468(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_ee2468(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_ee2468(); +} diff --git a/test/tint/builtins/gen/literal/mix/ee2468.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/mix/ee2468.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..daaa4163eb --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/ee2468.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void mix_ee2468() { + vector res = lerp((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_ee2468(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_ee2468(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_ee2468(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/ee2468.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/mix/ee2468.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..012c44190b --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/ee2468.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void mix_ee2468() { + vector res = lerp((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_ee2468(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_ee2468(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_ee2468(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001B8684C57F0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/mix/ee2468.wgsl.expected.glsl b/test/tint/builtins/gen/literal/mix/ee2468.wgsl.expected.glsl new file mode 100644 index 0000000000..16c94d2738 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/ee2468.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_ee2468() { + f16vec4 res = mix(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf)); +} + +vec4 vertex_main() { + mix_ee2468(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void mix_ee2468() { + f16vec4 res = mix(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf)); +} + +void fragment_main() { + mix_ee2468(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_ee2468() { + f16vec4 res = mix(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf)); +} + +void compute_main() { + mix_ee2468(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/ee2468.wgsl.expected.msl b/test/tint/builtins/gen/literal/mix/ee2468.wgsl.expected.msl new file mode 100644 index 0000000000..2eabc8960b --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/ee2468.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void mix_ee2468() { + half4 res = mix(half4(0.0h), half4(0.0h), half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_ee2468(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_ee2468(); + return; +} + +kernel void compute_main() { + mix_ee2468(); + return; +} + diff --git a/test/tint/builtins/gen/literal/mix/ee2468.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/mix/ee2468.wgsl.expected.spvasm new file mode 100644 index 0000000000..8ff66bb838 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/ee2468.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_ee2468 "mix_ee2468" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %mix_ee2468 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 FMix %17 %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %mix_ee2468 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %mix_ee2468 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %mix_ee2468 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/mix/ee2468.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/mix/ee2468.wgsl.expected.wgsl new file mode 100644 index 0000000000..15e853163a --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/ee2468.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn mix_ee2468() { + var res : vec4 = mix(vec4(f16()), vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_ee2468(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_ee2468(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_ee2468(); +} diff --git a/test/tint/builtins/gen/literal/mix/f1a543.wgsl b/test/tint/builtins/gen/literal/mix/f1a543.wgsl new file mode 100644 index 0000000000..5ff2c85e7d --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/f1a543.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn mix(vec<4, f16>, vec<4, f16>, f16) -> vec<4, f16> +fn mix_f1a543() { + var res: vec4 = mix(vec4(f16()), vec4(f16()), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_f1a543(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_f1a543(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_f1a543(); +} diff --git a/test/tint/builtins/gen/literal/mix/f1a543.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/mix/f1a543.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0701d56694 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/f1a543.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void mix_f1a543() { + vector res = lerp((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_f1a543(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_f1a543(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_f1a543(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/f1a543.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/mix/f1a543.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..26ebdc4e47 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/f1a543.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void mix_f1a543() { + vector res = lerp((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_f1a543(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_f1a543(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_f1a543(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020D39006FD0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/mix/f1a543.wgsl.expected.glsl b/test/tint/builtins/gen/literal/mix/f1a543.wgsl.expected.glsl new file mode 100644 index 0000000000..730990d4cc --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/f1a543.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_f1a543() { + f16vec4 res = mix(f16vec4(0.0hf), f16vec4(0.0hf), 0.0hf); +} + +vec4 vertex_main() { + mix_f1a543(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void mix_f1a543() { + f16vec4 res = mix(f16vec4(0.0hf), f16vec4(0.0hf), 0.0hf); +} + +void fragment_main() { + mix_f1a543(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_f1a543() { + f16vec4 res = mix(f16vec4(0.0hf), f16vec4(0.0hf), 0.0hf); +} + +void compute_main() { + mix_f1a543(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/f1a543.wgsl.expected.msl b/test/tint/builtins/gen/literal/mix/f1a543.wgsl.expected.msl new file mode 100644 index 0000000000..823de59c88 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/f1a543.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void mix_f1a543() { + half4 res = mix(half4(0.0h), half4(0.0h), 0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_f1a543(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_f1a543(); + return; +} + +kernel void compute_main() { + mix_f1a543(); + return; +} + diff --git a/test/tint/builtins/gen/literal/mix/f1a543.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/mix/f1a543.wgsl.expected.spvasm new file mode 100644 index 0000000000..7f1efc566e --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/f1a543.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_f1a543 "mix_f1a543" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half + %18 = OpConstantNull %half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %mix_f1a543 = OpFunction %void None %9 + %12 = OpLabel + %19 = OpVariable %_ptr_Function_v4half Function %17 + %res = OpVariable %_ptr_Function_v4half Function %17 + %21 = OpCompositeConstruct %v4half %18 %18 %18 %18 + %13 = OpExtInst %v4half %16 FMix %17 %17 %21 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %mix_f1a543 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %mix_f1a543 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %mix_f1a543 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/mix/f1a543.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/mix/f1a543.wgsl.expected.wgsl new file mode 100644 index 0000000000..c42b7dae8d --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/f1a543.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn mix_f1a543() { + var res : vec4 = mix(vec4(f16()), vec4(f16()), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_f1a543(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_f1a543(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_f1a543(); +} diff --git a/test/tint/builtins/gen/literal/modf/45005f.wgsl b/test/tint/builtins/gen/literal/modf/45005f.wgsl new file mode 100644 index 0000000000..236e165b2a --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/45005f.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn modf(vec<3, f16>) -> __modf_result_vec<3, f16> +fn modf_45005f() { + var res = modf(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_45005f(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_45005f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_45005f(); +} diff --git a/test/tint/builtins/gen/literal/modf/45005f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/modf/45005f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..30ed6b2046 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/45005f.wgsl.expected.dxc.hlsl @@ -0,0 +1,40 @@ +struct modf_result_vec3_f16 { + vector fract; + vector whole; +}; +modf_result_vec3_f16 tint_modf(vector param_0) { + modf_result_vec3_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_45005f() { + modf_result_vec3_f16 res = tint_modf((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_45005f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_45005f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_45005f(); + return; +} diff --git a/test/tint/builtins/gen/literal/modf/45005f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/modf/45005f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9f164dad2f --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/45005f.wgsl.expected.fxc.hlsl @@ -0,0 +1,45 @@ +SKIP: FAILED + +struct modf_result_vec3_f16 { + vector fract; + vector whole; +}; +modf_result_vec3_f16 tint_modf(vector param_0) { + modf_result_vec3_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_45005f() { + modf_result_vec3_f16 res = tint_modf((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_45005f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_45005f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_45005f(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001B818324B80(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/modf/45005f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/modf/45005f.wgsl.expected.glsl new file mode 100644 index 0000000000..c2ef9d1bd9 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/45005f.wgsl.expected.glsl @@ -0,0 +1,88 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct modf_result_vec3_f16 { + f16vec3 fract; + f16vec3 whole; +}; + +modf_result_vec3_f16 tint_modf(f16vec3 param_0) { + modf_result_vec3_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_45005f() { + modf_result_vec3_f16 res = tint_modf(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + modf_45005f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +struct modf_result_vec3_f16 { + f16vec3 fract; + f16vec3 whole; +}; + +modf_result_vec3_f16 tint_modf(f16vec3 param_0) { + modf_result_vec3_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_45005f() { + modf_result_vec3_f16 res = tint_modf(f16vec3(0.0hf)); +} + +void fragment_main() { + modf_45005f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct modf_result_vec3_f16 { + f16vec3 fract; + f16vec3 whole; +}; + +modf_result_vec3_f16 tint_modf(f16vec3 param_0) { + modf_result_vec3_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_45005f() { + modf_result_vec3_f16 res = tint_modf(f16vec3(0.0hf)); +} + +void compute_main() { + modf_45005f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/modf/45005f.wgsl.expected.msl b/test/tint/builtins/gen/literal/modf/45005f.wgsl.expected.msl new file mode 100644 index 0000000000..b07ab06c66 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/45005f.wgsl.expected.msl @@ -0,0 +1,44 @@ +#include + +using namespace metal; + +struct modf_result_vec3_f16 { + half3 fract; + half3 whole; +}; +modf_result_vec3_f16 tint_modf(half3 param_0) { + modf_result_vec3_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_45005f() { + modf_result_vec3_f16 res = tint_modf(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + modf_45005f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + modf_45005f(); + return; +} + +kernel void compute_main() { + modf_45005f(); + return; +} + diff --git a/test/tint/builtins/gen/literal/modf/45005f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/modf/45005f.wgsl.expected.spvasm new file mode 100644 index 0000000000..1e06f7ac0c --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/45005f.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %modf_45005f "modf_45005f" + OpName %__modf_result_vec3_f16 "__modf_result_vec3_f16" + OpMemberName %__modf_result_vec3_f16 0 "fract" + OpMemberName %__modf_result_vec3_f16 1 "whole" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__modf_result_vec3_f16 0 Offset 0 + OpMemberDecorate %__modf_result_vec3_f16 1 Offset 8 + %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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 +%__modf_result_vec3_f16 = OpTypeStruct %v3half %v3half + %18 = OpConstantNull %v3half +%_ptr_Function___modf_result_vec3_f16 = OpTypePointer Function %__modf_result_vec3_f16 + %21 = OpConstantNull %__modf_result_vec3_f16 + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%modf_45005f = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function___modf_result_vec3_f16 Function %21 + %13 = OpExtInst %__modf_result_vec3_f16 %17 ModfStruct %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %modf_45005f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %modf_45005f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %modf_45005f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/modf/45005f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/modf/45005f.wgsl.expected.wgsl new file mode 100644 index 0000000000..57f4b3b0a9 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/45005f.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn modf_45005f() { + var res = modf(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_45005f(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_45005f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_45005f(); +} diff --git a/test/tint/builtins/gen/literal/modf/8dbbbf.wgsl b/test/tint/builtins/gen/literal/modf/8dbbbf.wgsl new file mode 100644 index 0000000000..71e26385e4 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/8dbbbf.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn modf(f16) -> __modf_result +fn modf_8dbbbf() { + var res = modf(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_8dbbbf(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_8dbbbf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_8dbbbf(); +} diff --git a/test/tint/builtins/gen/literal/modf/8dbbbf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/modf/8dbbbf.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..802fe2a87d --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/8dbbbf.wgsl.expected.dxc.hlsl @@ -0,0 +1,40 @@ +struct modf_result_f16 { + float16_t fract; + float16_t whole; +}; +modf_result_f16 tint_modf(float16_t param_0) { + modf_result_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_8dbbbf() { + modf_result_f16 res = tint_modf(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_8dbbbf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_8dbbbf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_8dbbbf(); + return; +} diff --git a/test/tint/builtins/gen/literal/modf/8dbbbf.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/modf/8dbbbf.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ce161cd1f7 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/8dbbbf.wgsl.expected.fxc.hlsl @@ -0,0 +1,45 @@ +SKIP: FAILED + +struct modf_result_f16 { + float16_t fract; + float16_t whole; +}; +modf_result_f16 tint_modf(float16_t param_0) { + modf_result_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_8dbbbf() { + modf_result_f16 res = tint_modf(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_8dbbbf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_8dbbbf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_8dbbbf(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024604C24BA0(2,3-11): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/builtins/gen/literal/modf/8dbbbf.wgsl.expected.glsl b/test/tint/builtins/gen/literal/modf/8dbbbf.wgsl.expected.glsl new file mode 100644 index 0000000000..f949198626 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/8dbbbf.wgsl.expected.glsl @@ -0,0 +1,88 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct modf_result_f16 { + float16_t fract; + float16_t whole; +}; + +modf_result_f16 tint_modf(float16_t param_0) { + modf_result_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_8dbbbf() { + modf_result_f16 res = tint_modf(0.0hf); +} + +vec4 vertex_main() { + modf_8dbbbf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +struct modf_result_f16 { + float16_t fract; + float16_t whole; +}; + +modf_result_f16 tint_modf(float16_t param_0) { + modf_result_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_8dbbbf() { + modf_result_f16 res = tint_modf(0.0hf); +} + +void fragment_main() { + modf_8dbbbf(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct modf_result_f16 { + float16_t fract; + float16_t whole; +}; + +modf_result_f16 tint_modf(float16_t param_0) { + modf_result_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_8dbbbf() { + modf_result_f16 res = tint_modf(0.0hf); +} + +void compute_main() { + modf_8dbbbf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/modf/8dbbbf.wgsl.expected.msl b/test/tint/builtins/gen/literal/modf/8dbbbf.wgsl.expected.msl new file mode 100644 index 0000000000..f0a8d58991 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/8dbbbf.wgsl.expected.msl @@ -0,0 +1,44 @@ +#include + +using namespace metal; + +struct modf_result_f16 { + half fract; + half whole; +}; +modf_result_f16 tint_modf(half param_0) { + modf_result_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_8dbbbf() { + modf_result_f16 res = tint_modf(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + modf_8dbbbf(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + modf_8dbbbf(); + return; +} + +kernel void compute_main() { + modf_8dbbbf(); + return; +} + diff --git a/test/tint/builtins/gen/literal/modf/8dbbbf.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/modf/8dbbbf.wgsl.expected.spvasm new file mode 100644 index 0000000000..53162e3865 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/8dbbbf.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %modf_8dbbbf "modf_8dbbbf" + OpName %__modf_result_f16 "__modf_result_f16" + OpMemberName %__modf_result_f16 0 "fract" + OpMemberName %__modf_result_f16 1 "whole" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__modf_result_f16 0 Offset 0 + OpMemberDecorate %__modf_result_f16 1 Offset 2 + %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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 +%__modf_result_f16 = OpTypeStruct %half %half + %17 = OpConstantNull %half +%_ptr_Function___modf_result_f16 = OpTypePointer Function %__modf_result_f16 + %20 = OpConstantNull %__modf_result_f16 + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%modf_8dbbbf = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function___modf_result_f16 Function %20 + %13 = OpExtInst %__modf_result_f16 %16 ModfStruct %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %modf_8dbbbf + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %modf_8dbbbf + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %modf_8dbbbf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/modf/8dbbbf.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/modf/8dbbbf.wgsl.expected.wgsl new file mode 100644 index 0000000000..2ab39a6f3c --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/8dbbbf.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn modf_8dbbbf() { + var res = modf(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_8dbbbf(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_8dbbbf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_8dbbbf(); +} diff --git a/test/tint/builtins/gen/literal/modf/995934.wgsl b/test/tint/builtins/gen/literal/modf/995934.wgsl new file mode 100644 index 0000000000..ef2c6aec4f --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/995934.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn modf(vec<4, f16>) -> __modf_result_vec<4, f16> +fn modf_995934() { + var res = modf(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_995934(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_995934(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_995934(); +} diff --git a/test/tint/builtins/gen/literal/modf/995934.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/modf/995934.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d1b1051608 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/995934.wgsl.expected.dxc.hlsl @@ -0,0 +1,40 @@ +struct modf_result_vec4_f16 { + vector fract; + vector whole; +}; +modf_result_vec4_f16 tint_modf(vector param_0) { + modf_result_vec4_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_995934() { + modf_result_vec4_f16 res = tint_modf((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_995934(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_995934(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_995934(); + return; +} diff --git a/test/tint/builtins/gen/literal/modf/995934.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/modf/995934.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7a708c7ca0 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/995934.wgsl.expected.fxc.hlsl @@ -0,0 +1,45 @@ +SKIP: FAILED + +struct modf_result_vec4_f16 { + vector fract; + vector whole; +}; +modf_result_vec4_f16 tint_modf(vector param_0) { + modf_result_vec4_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_995934() { + modf_result_vec4_f16 res = tint_modf((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_995934(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_995934(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_995934(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000016E71A92D00(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/modf/995934.wgsl.expected.glsl b/test/tint/builtins/gen/literal/modf/995934.wgsl.expected.glsl new file mode 100644 index 0000000000..f3e71cb8be --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/995934.wgsl.expected.glsl @@ -0,0 +1,88 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct modf_result_vec4_f16 { + f16vec4 fract; + f16vec4 whole; +}; + +modf_result_vec4_f16 tint_modf(f16vec4 param_0) { + modf_result_vec4_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_995934() { + modf_result_vec4_f16 res = tint_modf(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + modf_995934(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +struct modf_result_vec4_f16 { + f16vec4 fract; + f16vec4 whole; +}; + +modf_result_vec4_f16 tint_modf(f16vec4 param_0) { + modf_result_vec4_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_995934() { + modf_result_vec4_f16 res = tint_modf(f16vec4(0.0hf)); +} + +void fragment_main() { + modf_995934(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct modf_result_vec4_f16 { + f16vec4 fract; + f16vec4 whole; +}; + +modf_result_vec4_f16 tint_modf(f16vec4 param_0) { + modf_result_vec4_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_995934() { + modf_result_vec4_f16 res = tint_modf(f16vec4(0.0hf)); +} + +void compute_main() { + modf_995934(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/modf/995934.wgsl.expected.msl b/test/tint/builtins/gen/literal/modf/995934.wgsl.expected.msl new file mode 100644 index 0000000000..93df00a5b7 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/995934.wgsl.expected.msl @@ -0,0 +1,44 @@ +#include + +using namespace metal; + +struct modf_result_vec4_f16 { + half4 fract; + half4 whole; +}; +modf_result_vec4_f16 tint_modf(half4 param_0) { + modf_result_vec4_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_995934() { + modf_result_vec4_f16 res = tint_modf(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + modf_995934(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + modf_995934(); + return; +} + +kernel void compute_main() { + modf_995934(); + return; +} + diff --git a/test/tint/builtins/gen/literal/modf/995934.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/modf/995934.wgsl.expected.spvasm new file mode 100644 index 0000000000..6fa7c2f351 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/995934.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %modf_995934 "modf_995934" + OpName %__modf_result_vec4_f16 "__modf_result_vec4_f16" + OpMemberName %__modf_result_vec4_f16 0 "fract" + OpMemberName %__modf_result_vec4_f16 1 "whole" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__modf_result_vec4_f16 0 Offset 0 + OpMemberDecorate %__modf_result_vec4_f16 1 Offset 8 + %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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 +%__modf_result_vec4_f16 = OpTypeStruct %v4half %v4half + %18 = OpConstantNull %v4half +%_ptr_Function___modf_result_vec4_f16 = OpTypePointer Function %__modf_result_vec4_f16 + %21 = OpConstantNull %__modf_result_vec4_f16 + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%modf_995934 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function___modf_result_vec4_f16 Function %21 + %13 = OpExtInst %__modf_result_vec4_f16 %17 ModfStruct %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %modf_995934 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %modf_995934 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %modf_995934 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/modf/995934.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/modf/995934.wgsl.expected.wgsl new file mode 100644 index 0000000000..1568993174 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/995934.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn modf_995934() { + var res = modf(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_995934(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_995934(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_995934(); +} diff --git a/test/tint/builtins/gen/literal/modf/a545b9.wgsl b/test/tint/builtins/gen/literal/modf/a545b9.wgsl new file mode 100644 index 0000000000..5b3d8b5137 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/a545b9.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn modf(vec<2, f16>) -> __modf_result_vec<2, f16> +fn modf_a545b9() { + var res = modf(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_a545b9(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_a545b9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_a545b9(); +} diff --git a/test/tint/builtins/gen/literal/modf/a545b9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/modf/a545b9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d14629192a --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/a545b9.wgsl.expected.dxc.hlsl @@ -0,0 +1,40 @@ +struct modf_result_vec2_f16 { + vector fract; + vector whole; +}; +modf_result_vec2_f16 tint_modf(vector param_0) { + modf_result_vec2_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_a545b9() { + modf_result_vec2_f16 res = tint_modf((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_a545b9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_a545b9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_a545b9(); + return; +} diff --git a/test/tint/builtins/gen/literal/modf/a545b9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/modf/a545b9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..63d6da7271 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/a545b9.wgsl.expected.fxc.hlsl @@ -0,0 +1,45 @@ +SKIP: FAILED + +struct modf_result_vec2_f16 { + vector fract; + vector whole; +}; +modf_result_vec2_f16 tint_modf(vector param_0) { + modf_result_vec2_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_a545b9() { + modf_result_vec2_f16 res = tint_modf((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_a545b9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_a545b9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_a545b9(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002393F2A4B80(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/modf/a545b9.wgsl.expected.glsl b/test/tint/builtins/gen/literal/modf/a545b9.wgsl.expected.glsl new file mode 100644 index 0000000000..9a4b37ae4b --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/a545b9.wgsl.expected.glsl @@ -0,0 +1,88 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct modf_result_vec2_f16 { + f16vec2 fract; + f16vec2 whole; +}; + +modf_result_vec2_f16 tint_modf(f16vec2 param_0) { + modf_result_vec2_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_a545b9() { + modf_result_vec2_f16 res = tint_modf(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + modf_a545b9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +struct modf_result_vec2_f16 { + f16vec2 fract; + f16vec2 whole; +}; + +modf_result_vec2_f16 tint_modf(f16vec2 param_0) { + modf_result_vec2_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_a545b9() { + modf_result_vec2_f16 res = tint_modf(f16vec2(0.0hf)); +} + +void fragment_main() { + modf_a545b9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct modf_result_vec2_f16 { + f16vec2 fract; + f16vec2 whole; +}; + +modf_result_vec2_f16 tint_modf(f16vec2 param_0) { + modf_result_vec2_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_a545b9() { + modf_result_vec2_f16 res = tint_modf(f16vec2(0.0hf)); +} + +void compute_main() { + modf_a545b9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/modf/a545b9.wgsl.expected.msl b/test/tint/builtins/gen/literal/modf/a545b9.wgsl.expected.msl new file mode 100644 index 0000000000..a9f218aeee --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/a545b9.wgsl.expected.msl @@ -0,0 +1,44 @@ +#include + +using namespace metal; + +struct modf_result_vec2_f16 { + half2 fract; + half2 whole; +}; +modf_result_vec2_f16 tint_modf(half2 param_0) { + modf_result_vec2_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_a545b9() { + modf_result_vec2_f16 res = tint_modf(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + modf_a545b9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + modf_a545b9(); + return; +} + +kernel void compute_main() { + modf_a545b9(); + return; +} + diff --git a/test/tint/builtins/gen/literal/modf/a545b9.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/modf/a545b9.wgsl.expected.spvasm new file mode 100644 index 0000000000..a47a13827b --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/a545b9.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %modf_a545b9 "modf_a545b9" + OpName %__modf_result_vec2_f16 "__modf_result_vec2_f16" + OpMemberName %__modf_result_vec2_f16 0 "fract" + OpMemberName %__modf_result_vec2_f16 1 "whole" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__modf_result_vec2_f16 0 Offset 0 + OpMemberDecorate %__modf_result_vec2_f16 1 Offset 4 + %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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 +%__modf_result_vec2_f16 = OpTypeStruct %v2half %v2half + %18 = OpConstantNull %v2half +%_ptr_Function___modf_result_vec2_f16 = OpTypePointer Function %__modf_result_vec2_f16 + %21 = OpConstantNull %__modf_result_vec2_f16 + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%modf_a545b9 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function___modf_result_vec2_f16 Function %21 + %13 = OpExtInst %__modf_result_vec2_f16 %17 ModfStruct %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %modf_a545b9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %modf_a545b9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %modf_a545b9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/modf/a545b9.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/modf/a545b9.wgsl.expected.wgsl new file mode 100644 index 0000000000..177b0e97da --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/a545b9.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn modf_a545b9() { + var res = modf(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_a545b9(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_a545b9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_a545b9(); +} diff --git a/test/tint/builtins/gen/literal/normalize/39d5ec.wgsl b/test/tint/builtins/gen/literal/normalize/39d5ec.wgsl new file mode 100644 index 0000000000..3c612c65b6 --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/39d5ec.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn normalize(vec<3, f16>) -> vec<3, f16> +fn normalize_39d5ec() { + var res: vec3 = normalize(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + normalize_39d5ec(); + return vec4(); +} + +@fragment +fn fragment_main() { + normalize_39d5ec(); +} + +@compute @workgroup_size(1) +fn compute_main() { + normalize_39d5ec(); +} diff --git a/test/tint/builtins/gen/literal/normalize/39d5ec.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/normalize/39d5ec.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4ad650fbbc --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/39d5ec.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void normalize_39d5ec() { + vector res = normalize((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + normalize_39d5ec(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + normalize_39d5ec(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + normalize_39d5ec(); + return; +} diff --git a/test/tint/builtins/gen/literal/normalize/39d5ec.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/normalize/39d5ec.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2533db5094 --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/39d5ec.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void normalize_39d5ec() { + vector res = normalize((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + normalize_39d5ec(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + normalize_39d5ec(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + normalize_39d5ec(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002467316DBB0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/normalize/39d5ec.wgsl.expected.glsl b/test/tint/builtins/gen/literal/normalize/39d5ec.wgsl.expected.glsl new file mode 100644 index 0000000000..e129ddcbd8 --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/39d5ec.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void normalize_39d5ec() { + f16vec3 res = normalize(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + normalize_39d5ec(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void normalize_39d5ec() { + f16vec3 res = normalize(f16vec3(0.0hf)); +} + +void fragment_main() { + normalize_39d5ec(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void normalize_39d5ec() { + f16vec3 res = normalize(f16vec3(0.0hf)); +} + +void compute_main() { + normalize_39d5ec(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/normalize/39d5ec.wgsl.expected.msl b/test/tint/builtins/gen/literal/normalize/39d5ec.wgsl.expected.msl new file mode 100644 index 0000000000..683a2ad492 --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/39d5ec.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void normalize_39d5ec() { + half3 res = normalize(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + normalize_39d5ec(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + normalize_39d5ec(); + return; +} + +kernel void compute_main() { + normalize_39d5ec(); + return; +} + diff --git a/test/tint/builtins/gen/literal/normalize/39d5ec.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/normalize/39d5ec.wgsl.expected.spvasm new file mode 100644 index 0000000000..7f5230775e --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/39d5ec.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %normalize_39d5ec "normalize_39d5ec" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%normalize_39d5ec = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Normalize %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %normalize_39d5ec + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %normalize_39d5ec + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %normalize_39d5ec + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/normalize/39d5ec.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/normalize/39d5ec.wgsl.expected.wgsl new file mode 100644 index 0000000000..f8f2e8fa2b --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/39d5ec.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn normalize_39d5ec() { + var res : vec3 = normalize(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + normalize_39d5ec(); + return vec4(); +} + +@fragment +fn fragment_main() { + normalize_39d5ec(); +} + +@compute @workgroup_size(1) +fn compute_main() { + normalize_39d5ec(); +} diff --git a/test/tint/builtins/gen/literal/normalize/7990f3.wgsl b/test/tint/builtins/gen/literal/normalize/7990f3.wgsl new file mode 100644 index 0000000000..8b3c478526 --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/7990f3.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn normalize(vec<2, f16>) -> vec<2, f16> +fn normalize_7990f3() { + var res: vec2 = normalize(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + normalize_7990f3(); + return vec4(); +} + +@fragment +fn fragment_main() { + normalize_7990f3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + normalize_7990f3(); +} diff --git a/test/tint/builtins/gen/literal/normalize/7990f3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/normalize/7990f3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b0e04e189a --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/7990f3.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void normalize_7990f3() { + vector res = normalize((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + normalize_7990f3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + normalize_7990f3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + normalize_7990f3(); + return; +} diff --git a/test/tint/builtins/gen/literal/normalize/7990f3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/normalize/7990f3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..52cbb8babf --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/7990f3.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void normalize_7990f3() { + vector res = normalize((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + normalize_7990f3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + normalize_7990f3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + normalize_7990f3(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E10FCEEA50(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/normalize/7990f3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/normalize/7990f3.wgsl.expected.glsl new file mode 100644 index 0000000000..f59eb6dbb2 --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/7990f3.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void normalize_7990f3() { + f16vec2 res = normalize(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + normalize_7990f3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void normalize_7990f3() { + f16vec2 res = normalize(f16vec2(0.0hf)); +} + +void fragment_main() { + normalize_7990f3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void normalize_7990f3() { + f16vec2 res = normalize(f16vec2(0.0hf)); +} + +void compute_main() { + normalize_7990f3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/normalize/7990f3.wgsl.expected.msl b/test/tint/builtins/gen/literal/normalize/7990f3.wgsl.expected.msl new file mode 100644 index 0000000000..bea065fc45 --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/7990f3.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void normalize_7990f3() { + half2 res = normalize(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + normalize_7990f3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + normalize_7990f3(); + return; +} + +kernel void compute_main() { + normalize_7990f3(); + return; +} + diff --git a/test/tint/builtins/gen/literal/normalize/7990f3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/normalize/7990f3.wgsl.expected.spvasm new file mode 100644 index 0000000000..d00d9f3f26 --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/7990f3.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %normalize_7990f3 "normalize_7990f3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%normalize_7990f3 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Normalize %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %normalize_7990f3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %normalize_7990f3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %normalize_7990f3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/normalize/7990f3.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/normalize/7990f3.wgsl.expected.wgsl new file mode 100644 index 0000000000..ce0b29f2ef --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/7990f3.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn normalize_7990f3() { + var res : vec2 = normalize(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + normalize_7990f3(); + return vec4(); +} + +@fragment +fn fragment_main() { + normalize_7990f3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + normalize_7990f3(); +} diff --git a/test/tint/builtins/gen/literal/normalize/b8cb8d.wgsl b/test/tint/builtins/gen/literal/normalize/b8cb8d.wgsl new file mode 100644 index 0000000000..81f49c1d66 --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/b8cb8d.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn normalize(vec<4, f16>) -> vec<4, f16> +fn normalize_b8cb8d() { + var res: vec4 = normalize(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + normalize_b8cb8d(); + return vec4(); +} + +@fragment +fn fragment_main() { + normalize_b8cb8d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + normalize_b8cb8d(); +} diff --git a/test/tint/builtins/gen/literal/normalize/b8cb8d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/normalize/b8cb8d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..24ac211c15 --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/b8cb8d.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void normalize_b8cb8d() { + vector res = normalize((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + normalize_b8cb8d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + normalize_b8cb8d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + normalize_b8cb8d(); + return; +} diff --git a/test/tint/builtins/gen/literal/normalize/b8cb8d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/normalize/b8cb8d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3eafadc5b4 --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/b8cb8d.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void normalize_b8cb8d() { + vector res = normalize((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + normalize_b8cb8d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + normalize_b8cb8d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + normalize_b8cb8d(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000027C766AD380(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/normalize/b8cb8d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/normalize/b8cb8d.wgsl.expected.glsl new file mode 100644 index 0000000000..897b4f936c --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/b8cb8d.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void normalize_b8cb8d() { + f16vec4 res = normalize(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + normalize_b8cb8d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void normalize_b8cb8d() { + f16vec4 res = normalize(f16vec4(0.0hf)); +} + +void fragment_main() { + normalize_b8cb8d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void normalize_b8cb8d() { + f16vec4 res = normalize(f16vec4(0.0hf)); +} + +void compute_main() { + normalize_b8cb8d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/normalize/b8cb8d.wgsl.expected.msl b/test/tint/builtins/gen/literal/normalize/b8cb8d.wgsl.expected.msl new file mode 100644 index 0000000000..4481b97c17 --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/b8cb8d.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void normalize_b8cb8d() { + half4 res = normalize(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + normalize_b8cb8d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + normalize_b8cb8d(); + return; +} + +kernel void compute_main() { + normalize_b8cb8d(); + return; +} + diff --git a/test/tint/builtins/gen/literal/normalize/b8cb8d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/normalize/b8cb8d.wgsl.expected.spvasm new file mode 100644 index 0000000000..ce722dba27 --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/b8cb8d.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %normalize_b8cb8d "normalize_b8cb8d" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%normalize_b8cb8d = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Normalize %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %normalize_b8cb8d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %normalize_b8cb8d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %normalize_b8cb8d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/normalize/b8cb8d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/normalize/b8cb8d.wgsl.expected.wgsl new file mode 100644 index 0000000000..07214277df --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/b8cb8d.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn normalize_b8cb8d() { + var res : vec4 = normalize(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + normalize_b8cb8d(); + return vec4(); +} + +@fragment +fn fragment_main() { + normalize_b8cb8d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + normalize_b8cb8d(); +} diff --git a/test/tint/builtins/gen/literal/pow/4f33b2.wgsl b/test/tint/builtins/gen/literal/pow/4f33b2.wgsl new file mode 100644 index 0000000000..58ab00c606 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/4f33b2.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn pow(vec<4, f16>, vec<4, f16>) -> vec<4, f16> +fn pow_4f33b2() { + var res: vec4 = pow(vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_4f33b2(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_4f33b2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_4f33b2(); +} diff --git a/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..28040580a3 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void pow_4f33b2() { + vector res = pow((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_4f33b2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_4f33b2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_4f33b2(); + return; +} diff --git a/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bca42d2356 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void pow_4f33b2() { + vector res = pow((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_4f33b2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_4f33b2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_4f33b2(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000027797C56270(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.glsl b/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.glsl new file mode 100644 index 0000000000..cec05e4dc2 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void pow_4f33b2() { + f16vec4 res = pow(f16vec4(0.0hf), f16vec4(0.0hf)); +} + +vec4 vertex_main() { + pow_4f33b2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void pow_4f33b2() { + f16vec4 res = pow(f16vec4(0.0hf), f16vec4(0.0hf)); +} + +void fragment_main() { + pow_4f33b2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void pow_4f33b2() { + f16vec4 res = pow(f16vec4(0.0hf), f16vec4(0.0hf)); +} + +void compute_main() { + pow_4f33b2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.msl b/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.msl new file mode 100644 index 0000000000..abc7e9e73c --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void pow_4f33b2() { + half4 res = pow(half4(0.0h), half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + pow_4f33b2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + pow_4f33b2(); + return; +} + +kernel void compute_main() { + pow_4f33b2(); + return; +} + diff --git a/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.spvasm new file mode 100644 index 0000000000..669759df1f --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %pow_4f33b2 "pow_4f33b2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %pow_4f33b2 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Pow %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %pow_4f33b2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %pow_4f33b2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %pow_4f33b2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.wgsl new file mode 100644 index 0000000000..bb9db59bfc --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn pow_4f33b2() { + var res : vec4 = pow(vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_4f33b2(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_4f33b2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_4f33b2(); +} diff --git a/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl b/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl new file mode 100644 index 0000000000..c9a6522cdf --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn pow(f16, f16) -> f16 +fn pow_ce9ef5() { + var res: f16 = pow(f16(), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_ce9ef5(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_ce9ef5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_ce9ef5(); +} diff --git a/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1f9e7123a3 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void pow_ce9ef5() { + float16_t res = pow(float16_t(0.0h), float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_ce9ef5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_ce9ef5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_ce9ef5(); + return; +} diff --git a/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a10ed77984 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void pow_ce9ef5() { + float16_t res = pow(float16_t(0.0h), float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_ce9ef5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_ce9ef5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_ce9ef5(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022B8A05C140(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022B8A05C140(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.glsl b/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.glsl new file mode 100644 index 0000000000..23f08dbe3d --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void pow_ce9ef5() { + float16_t res = pow(0.0hf, 0.0hf); +} + +vec4 vertex_main() { + pow_ce9ef5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void pow_ce9ef5() { + float16_t res = pow(0.0hf, 0.0hf); +} + +void fragment_main() { + pow_ce9ef5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void pow_ce9ef5() { + float16_t res = pow(0.0hf, 0.0hf); +} + +void compute_main() { + pow_ce9ef5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.msl b/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.msl new file mode 100644 index 0000000000..9346414b9a --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void pow_ce9ef5() { + half res = pow(0.0h, 0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + pow_ce9ef5(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + pow_ce9ef5(); + return; +} + +kernel void compute_main() { + pow_ce9ef5(); + return; +} + diff --git a/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.spvasm new file mode 100644 index 0000000000..219cfcfeed --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %pow_ce9ef5 "pow_ce9ef5" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %pow_ce9ef5 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Pow %16 %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %pow_ce9ef5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %pow_ce9ef5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %pow_ce9ef5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.wgsl new file mode 100644 index 0000000000..dc2c9c4e13 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn pow_ce9ef5() { + var res : f16 = pow(f16(), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_ce9ef5(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_ce9ef5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_ce9ef5(); +} diff --git a/test/tint/builtins/gen/literal/pow/f37b25.wgsl b/test/tint/builtins/gen/literal/pow/f37b25.wgsl new file mode 100644 index 0000000000..b63e93e75e --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/f37b25.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn pow(vec<2, f16>, vec<2, f16>) -> vec<2, f16> +fn pow_f37b25() { + var res: vec2 = pow(vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_f37b25(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_f37b25(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_f37b25(); +} diff --git a/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8efda2bd3a --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void pow_f37b25() { + vector res = pow((float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_f37b25(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_f37b25(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_f37b25(); + return; +} diff --git a/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fa7eaa6255 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void pow_f37b25() { + vector res = pow((float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_f37b25(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_f37b25(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_f37b25(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001EE95DF6780(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.glsl b/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.glsl new file mode 100644 index 0000000000..ac933cbbcc --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void pow_f37b25() { + f16vec2 res = pow(f16vec2(0.0hf), f16vec2(0.0hf)); +} + +vec4 vertex_main() { + pow_f37b25(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void pow_f37b25() { + f16vec2 res = pow(f16vec2(0.0hf), f16vec2(0.0hf)); +} + +void fragment_main() { + pow_f37b25(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void pow_f37b25() { + f16vec2 res = pow(f16vec2(0.0hf), f16vec2(0.0hf)); +} + +void compute_main() { + pow_f37b25(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.msl b/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.msl new file mode 100644 index 0000000000..3962dd1e78 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void pow_f37b25() { + half2 res = pow(half2(0.0h), half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + pow_f37b25(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + pow_f37b25(); + return; +} + +kernel void compute_main() { + pow_f37b25(); + return; +} + diff --git a/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.spvasm new file mode 100644 index 0000000000..53e3689a54 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %pow_f37b25 "pow_f37b25" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %pow_f37b25 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Pow %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %pow_f37b25 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %pow_f37b25 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %pow_f37b25 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.wgsl new file mode 100644 index 0000000000..96ff2a23ff --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn pow_f37b25() { + var res : vec2 = pow(vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_f37b25(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_f37b25(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_f37b25(); +} diff --git a/test/tint/builtins/gen/literal/pow/fa5429.wgsl b/test/tint/builtins/gen/literal/pow/fa5429.wgsl new file mode 100644 index 0000000000..51ecff311c --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/fa5429.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn pow(vec<3, f16>, vec<3, f16>) -> vec<3, f16> +fn pow_fa5429() { + var res: vec3 = pow(vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_fa5429(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_fa5429(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_fa5429(); +} diff --git a/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fc999c6261 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void pow_fa5429() { + vector res = pow((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_fa5429(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_fa5429(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_fa5429(); + return; +} diff --git a/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cae49c55fe --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void pow_fa5429() { + vector res = pow((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_fa5429(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_fa5429(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_fa5429(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000028F07286290(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.glsl b/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.glsl new file mode 100644 index 0000000000..113b3ab6c3 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void pow_fa5429() { + f16vec3 res = pow(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +vec4 vertex_main() { + pow_fa5429(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void pow_fa5429() { + f16vec3 res = pow(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +void fragment_main() { + pow_fa5429(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void pow_fa5429() { + f16vec3 res = pow(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +void compute_main() { + pow_fa5429(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.msl b/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.msl new file mode 100644 index 0000000000..249c3f3f42 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void pow_fa5429() { + half3 res = pow(half3(0.0h), half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + pow_fa5429(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + pow_fa5429(); + return; +} + +kernel void compute_main() { + pow_fa5429(); + return; +} + diff --git a/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.spvasm new file mode 100644 index 0000000000..bc20475f25 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %pow_fa5429 "pow_fa5429" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %pow_fa5429 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Pow %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %pow_fa5429 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %pow_fa5429 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %pow_fa5429 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.wgsl new file mode 100644 index 0000000000..46002ea14b --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn pow_fa5429() { + var res : vec3 = pow(vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_fa5429(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_fa5429(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_fa5429(); +} diff --git a/test/tint/builtins/gen/literal/radians/208fd9.wgsl b/test/tint/builtins/gen/literal/radians/208fd9.wgsl new file mode 100644 index 0000000000..c60793b14d --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/208fd9.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn radians(f16) -> f16 +fn radians_208fd9() { + var res: f16 = radians(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_208fd9(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_208fd9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_208fd9(); +} diff --git a/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b7b76cd22a --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +float16_t tint_radians(float16_t param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_208fd9() { + float16_t res = tint_radians(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_208fd9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_208fd9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_208fd9(); + return; +} diff --git a/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d1aeacee8c --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +float16_t tint_radians(float16_t param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_208fd9() { + float16_t res = tint_radians(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_208fd9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_208fd9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_208fd9(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001B5647B0440(1,1-9): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.glsl b/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.glsl new file mode 100644 index 0000000000..cf4c962810 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +float16_t tint_radians(float16_t param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_208fd9() { + float16_t res = tint_radians(0.0hf); +} + +vec4 vertex_main() { + radians_208fd9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +float16_t tint_radians(float16_t param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_208fd9() { + float16_t res = tint_radians(0.0hf); +} + +void fragment_main() { + radians_208fd9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +float16_t tint_radians(float16_t param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_208fd9() { + float16_t res = tint_radians(0.0hf); +} + +void compute_main() { + radians_208fd9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.msl b/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.msl new file mode 100644 index 0000000000..d12b406a14 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; + +half tint_radians(half param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_208fd9() { + half res = tint_radians(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + radians_208fd9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + radians_208fd9(); + return; +} + +kernel void compute_main() { + radians_208fd9(); + return; +} + diff --git a/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.spvasm new file mode 100644 index 0000000000..8fc9e39929 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %radians_208fd9 "radians_208fd9" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%radians_208fd9 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Radians %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %radians_208fd9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %radians_208fd9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %radians_208fd9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.wgsl new file mode 100644 index 0000000000..1febb6ea6f --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn radians_208fd9() { + var res : f16 = radians(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_208fd9(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_208fd9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_208fd9(); +} diff --git a/test/tint/builtins/gen/literal/radians/44f20b.wgsl b/test/tint/builtins/gen/literal/radians/44f20b.wgsl new file mode 100644 index 0000000000..a7887fb257 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/44f20b.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn radians(vec<4, f16>) -> vec<4, f16> +fn radians_44f20b() { + var res: vec4 = radians(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_44f20b(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_44f20b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_44f20b(); +} diff --git a/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6c3cce992b --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +vector tint_radians(vector param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_44f20b() { + vector res = tint_radians((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_44f20b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_44f20b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_44f20b(); + return; +} diff --git a/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ac64196fd4 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +vector tint_radians(vector param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_44f20b() { + vector res = tint_radians((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_44f20b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_44f20b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_44f20b(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024C9C3BC350(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.glsl new file mode 100644 index 0000000000..2b3d4c7660 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec4 tint_radians(f16vec4 param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_44f20b() { + f16vec4 res = tint_radians(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + radians_44f20b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec4 tint_radians(f16vec4 param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_44f20b() { + f16vec4 res = tint_radians(f16vec4(0.0hf)); +} + +void fragment_main() { + radians_44f20b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec4 tint_radians(f16vec4 param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_44f20b() { + f16vec4 res = tint_radians(f16vec4(0.0hf)); +} + +void compute_main() { + radians_44f20b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.msl b/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.msl new file mode 100644 index 0000000000..1e20066dfe --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; + +half4 tint_radians(half4 param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_44f20b() { + half4 res = tint_radians(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + radians_44f20b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + radians_44f20b(); + return; +} + +kernel void compute_main() { + radians_44f20b(); + return; +} + diff --git a/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.spvasm new file mode 100644 index 0000000000..6321aaa71e --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %radians_44f20b "radians_44f20b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%radians_44f20b = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Radians %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %radians_44f20b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %radians_44f20b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %radians_44f20b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.wgsl new file mode 100644 index 0000000000..35170cc4fc --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn radians_44f20b() { + var res : vec4 = radians(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_44f20b(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_44f20b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_44f20b(); +} diff --git a/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl b/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl new file mode 100644 index 0000000000..4e2a23c574 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn radians(vec<3, f16>) -> vec<3, f16> +fn radians_7ea4c7() { + var res: vec3 = radians(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_7ea4c7(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_7ea4c7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_7ea4c7(); +} diff --git a/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a9f6f96235 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +vector tint_radians(vector param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_7ea4c7() { + vector res = tint_radians((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_7ea4c7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_7ea4c7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_7ea4c7(); + return; +} diff --git a/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6a13fc22ca --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +vector tint_radians(vector param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_7ea4c7() { + vector res = tint_radians((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_7ea4c7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_7ea4c7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_7ea4c7(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C0F82EE760(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.glsl b/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.glsl new file mode 100644 index 0000000000..a8cc9ab526 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec3 tint_radians(f16vec3 param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_7ea4c7() { + f16vec3 res = tint_radians(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + radians_7ea4c7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec3 tint_radians(f16vec3 param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_7ea4c7() { + f16vec3 res = tint_radians(f16vec3(0.0hf)); +} + +void fragment_main() { + radians_7ea4c7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec3 tint_radians(f16vec3 param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_7ea4c7() { + f16vec3 res = tint_radians(f16vec3(0.0hf)); +} + +void compute_main() { + radians_7ea4c7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.msl b/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.msl new file mode 100644 index 0000000000..34ca856153 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; + +half3 tint_radians(half3 param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_7ea4c7() { + half3 res = tint_radians(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + radians_7ea4c7(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + radians_7ea4c7(); + return; +} + +kernel void compute_main() { + radians_7ea4c7(); + return; +} + diff --git a/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.spvasm new file mode 100644 index 0000000000..9ef7401389 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %radians_7ea4c7 "radians_7ea4c7" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%radians_7ea4c7 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Radians %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %radians_7ea4c7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %radians_7ea4c7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %radians_7ea4c7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.wgsl new file mode 100644 index 0000000000..56b01aa764 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn radians_7ea4c7() { + var res : vec3 = radians(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_7ea4c7(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_7ea4c7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_7ea4c7(); +} diff --git a/test/tint/builtins/gen/literal/radians/fbacf0.wgsl b/test/tint/builtins/gen/literal/radians/fbacf0.wgsl new file mode 100644 index 0000000000..f3d4acbdfe --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/fbacf0.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn radians(vec<2, f16>) -> vec<2, f16> +fn radians_fbacf0() { + var res: vec2 = radians(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_fbacf0(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_fbacf0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_fbacf0(); +} diff --git a/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8d3e076240 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +vector tint_radians(vector param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_fbacf0() { + vector res = tint_radians((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_fbacf0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_fbacf0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_fbacf0(); + return; +} diff --git a/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..880018add9 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +vector tint_radians(vector param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_fbacf0() { + vector res = tint_radians((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_fbacf0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_fbacf0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_fbacf0(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000028D5138C350(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.glsl b/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.glsl new file mode 100644 index 0000000000..ce24c39b8e --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec2 tint_radians(f16vec2 param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_fbacf0() { + f16vec2 res = tint_radians(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + radians_fbacf0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec2 tint_radians(f16vec2 param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_fbacf0() { + f16vec2 res = tint_radians(f16vec2(0.0hf)); +} + +void fragment_main() { + radians_fbacf0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec2 tint_radians(f16vec2 param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_fbacf0() { + f16vec2 res = tint_radians(f16vec2(0.0hf)); +} + +void compute_main() { + radians_fbacf0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.msl b/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.msl new file mode 100644 index 0000000000..9359855280 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; + +half2 tint_radians(half2 param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_fbacf0() { + half2 res = tint_radians(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + radians_fbacf0(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + radians_fbacf0(); + return; +} + +kernel void compute_main() { + radians_fbacf0(); + return; +} + diff --git a/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.spvasm new file mode 100644 index 0000000000..f798f519b7 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %radians_fbacf0 "radians_fbacf0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%radians_fbacf0 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Radians %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %radians_fbacf0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %radians_fbacf0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %radians_fbacf0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.wgsl new file mode 100644 index 0000000000..0aba9cc1af --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn radians_fbacf0() { + var res : vec2 = radians(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_fbacf0(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_fbacf0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_fbacf0(); +} diff --git a/test/tint/builtins/gen/literal/reflect/310de5.wgsl b/test/tint/builtins/gen/literal/reflect/310de5.wgsl new file mode 100644 index 0000000000..9d8a01b5b4 --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/310de5.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn reflect(vec<4, f16>, vec<4, f16>) -> vec<4, f16> +fn reflect_310de5() { + var res: vec4 = reflect(vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reflect_310de5(); + return vec4(); +} + +@fragment +fn fragment_main() { + reflect_310de5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reflect_310de5(); +} diff --git a/test/tint/builtins/gen/literal/reflect/310de5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/reflect/310de5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4a7f8f4139 --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/310de5.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void reflect_310de5() { + vector res = reflect((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reflect_310de5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reflect_310de5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reflect_310de5(); + return; +} diff --git a/test/tint/builtins/gen/literal/reflect/310de5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/reflect/310de5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e4fb2cc9e5 --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/310de5.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void reflect_310de5() { + vector res = reflect((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reflect_310de5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reflect_310de5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reflect_310de5(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001EFC20B7D70(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/reflect/310de5.wgsl.expected.glsl b/test/tint/builtins/gen/literal/reflect/310de5.wgsl.expected.glsl new file mode 100644 index 0000000000..92a222f6e0 --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/310de5.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void reflect_310de5() { + f16vec4 res = reflect(f16vec4(0.0hf), f16vec4(0.0hf)); +} + +vec4 vertex_main() { + reflect_310de5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void reflect_310de5() { + f16vec4 res = reflect(f16vec4(0.0hf), f16vec4(0.0hf)); +} + +void fragment_main() { + reflect_310de5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void reflect_310de5() { + f16vec4 res = reflect(f16vec4(0.0hf), f16vec4(0.0hf)); +} + +void compute_main() { + reflect_310de5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/reflect/310de5.wgsl.expected.msl b/test/tint/builtins/gen/literal/reflect/310de5.wgsl.expected.msl new file mode 100644 index 0000000000..774dfb7f58 --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/310de5.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void reflect_310de5() { + half4 res = reflect(half4(0.0h), half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + reflect_310de5(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + reflect_310de5(); + return; +} + +kernel void compute_main() { + reflect_310de5(); + return; +} + diff --git a/test/tint/builtins/gen/literal/reflect/310de5.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/reflect/310de5.wgsl.expected.spvasm new file mode 100644 index 0000000000..e77a355b51 --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/310de5.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %reflect_310de5 "reflect_310de5" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%reflect_310de5 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Reflect %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %reflect_310de5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %reflect_310de5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %reflect_310de5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/reflect/310de5.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/reflect/310de5.wgsl.expected.wgsl new file mode 100644 index 0000000000..61a2100238 --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/310de5.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn reflect_310de5() { + var res : vec4 = reflect(vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reflect_310de5(); + return vec4(); +} + +@fragment +fn fragment_main() { + reflect_310de5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reflect_310de5(); +} diff --git a/test/tint/builtins/gen/literal/reflect/61ca21.wgsl b/test/tint/builtins/gen/literal/reflect/61ca21.wgsl new file mode 100644 index 0000000000..85df287a0e --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/61ca21.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn reflect(vec<3, f16>, vec<3, f16>) -> vec<3, f16> +fn reflect_61ca21() { + var res: vec3 = reflect(vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reflect_61ca21(); + return vec4(); +} + +@fragment +fn fragment_main() { + reflect_61ca21(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reflect_61ca21(); +} diff --git a/test/tint/builtins/gen/literal/reflect/61ca21.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/reflect/61ca21.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5a2f305300 --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/61ca21.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void reflect_61ca21() { + vector res = reflect((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reflect_61ca21(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reflect_61ca21(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reflect_61ca21(); + return; +} diff --git a/test/tint/builtins/gen/literal/reflect/61ca21.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/reflect/61ca21.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3e8b18048d --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/61ca21.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void reflect_61ca21() { + vector res = reflect((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reflect_61ca21(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reflect_61ca21(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reflect_61ca21(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E16EDB83B0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/reflect/61ca21.wgsl.expected.glsl b/test/tint/builtins/gen/literal/reflect/61ca21.wgsl.expected.glsl new file mode 100644 index 0000000000..c3b3b78b6a --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/61ca21.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void reflect_61ca21() { + f16vec3 res = reflect(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +vec4 vertex_main() { + reflect_61ca21(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void reflect_61ca21() { + f16vec3 res = reflect(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +void fragment_main() { + reflect_61ca21(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void reflect_61ca21() { + f16vec3 res = reflect(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +void compute_main() { + reflect_61ca21(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/reflect/61ca21.wgsl.expected.msl b/test/tint/builtins/gen/literal/reflect/61ca21.wgsl.expected.msl new file mode 100644 index 0000000000..2bd9b84054 --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/61ca21.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void reflect_61ca21() { + half3 res = reflect(half3(0.0h), half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + reflect_61ca21(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + reflect_61ca21(); + return; +} + +kernel void compute_main() { + reflect_61ca21(); + return; +} + diff --git a/test/tint/builtins/gen/literal/reflect/61ca21.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/reflect/61ca21.wgsl.expected.spvasm new file mode 100644 index 0000000000..10d9a3559e --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/61ca21.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %reflect_61ca21 "reflect_61ca21" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%reflect_61ca21 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Reflect %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %reflect_61ca21 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %reflect_61ca21 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %reflect_61ca21 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/reflect/61ca21.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/reflect/61ca21.wgsl.expected.wgsl new file mode 100644 index 0000000000..a30006a585 --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/61ca21.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn reflect_61ca21() { + var res : vec3 = reflect(vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reflect_61ca21(); + return vec4(); +} + +@fragment +fn fragment_main() { + reflect_61ca21(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reflect_61ca21(); +} diff --git a/test/tint/builtins/gen/literal/reflect/bb15ac.wgsl b/test/tint/builtins/gen/literal/reflect/bb15ac.wgsl new file mode 100644 index 0000000000..854ac7e391 --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/bb15ac.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn reflect(vec<2, f16>, vec<2, f16>) -> vec<2, f16> +fn reflect_bb15ac() { + var res: vec2 = reflect(vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reflect_bb15ac(); + return vec4(); +} + +@fragment +fn fragment_main() { + reflect_bb15ac(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reflect_bb15ac(); +} diff --git a/test/tint/builtins/gen/literal/reflect/bb15ac.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/reflect/bb15ac.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ec357faabd --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/bb15ac.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void reflect_bb15ac() { + vector res = reflect((float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reflect_bb15ac(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reflect_bb15ac(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reflect_bb15ac(); + return; +} diff --git a/test/tint/builtins/gen/literal/reflect/bb15ac.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/reflect/bb15ac.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..983ff2ab01 --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/bb15ac.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void reflect_bb15ac() { + vector res = reflect((float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reflect_bb15ac(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reflect_bb15ac(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reflect_bb15ac(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E110B86630(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/reflect/bb15ac.wgsl.expected.glsl b/test/tint/builtins/gen/literal/reflect/bb15ac.wgsl.expected.glsl new file mode 100644 index 0000000000..6ea875d9b8 --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/bb15ac.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void reflect_bb15ac() { + f16vec2 res = reflect(f16vec2(0.0hf), f16vec2(0.0hf)); +} + +vec4 vertex_main() { + reflect_bb15ac(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void reflect_bb15ac() { + f16vec2 res = reflect(f16vec2(0.0hf), f16vec2(0.0hf)); +} + +void fragment_main() { + reflect_bb15ac(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void reflect_bb15ac() { + f16vec2 res = reflect(f16vec2(0.0hf), f16vec2(0.0hf)); +} + +void compute_main() { + reflect_bb15ac(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/reflect/bb15ac.wgsl.expected.msl b/test/tint/builtins/gen/literal/reflect/bb15ac.wgsl.expected.msl new file mode 100644 index 0000000000..5ade63c4ab --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/bb15ac.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void reflect_bb15ac() { + half2 res = reflect(half2(0.0h), half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + reflect_bb15ac(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + reflect_bb15ac(); + return; +} + +kernel void compute_main() { + reflect_bb15ac(); + return; +} + diff --git a/test/tint/builtins/gen/literal/reflect/bb15ac.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/reflect/bb15ac.wgsl.expected.spvasm new file mode 100644 index 0000000000..c9e584e56f --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/bb15ac.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %reflect_bb15ac "reflect_bb15ac" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%reflect_bb15ac = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Reflect %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %reflect_bb15ac + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %reflect_bb15ac + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %reflect_bb15ac + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/reflect/bb15ac.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/reflect/bb15ac.wgsl.expected.wgsl new file mode 100644 index 0000000000..8e50cf379e --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/bb15ac.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn reflect_bb15ac() { + var res : vec2 = reflect(vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reflect_bb15ac(); + return vec4(); +} + +@fragment +fn fragment_main() { + reflect_bb15ac(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reflect_bb15ac(); +} diff --git a/test/tint/builtins/gen/literal/refract/0594ba.wgsl b/test/tint/builtins/gen/literal/refract/0594ba.wgsl new file mode 100644 index 0000000000..5614a4ec2b --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/0594ba.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn refract(vec<4, f16>, vec<4, f16>, f16) -> vec<4, f16> +fn refract_0594ba() { + var res: vec4 = refract(vec4(f16()), vec4(f16()), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + refract_0594ba(); + return vec4(); +} + +@fragment +fn fragment_main() { + refract_0594ba(); +} + +@compute @workgroup_size(1) +fn compute_main() { + refract_0594ba(); +} diff --git a/test/tint/builtins/gen/literal/refract/0594ba.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/refract/0594ba.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cdb4a1c5d7 --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/0594ba.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void refract_0594ba() { + vector res = refract((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + refract_0594ba(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + refract_0594ba(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + refract_0594ba(); + return; +} diff --git a/test/tint/builtins/gen/literal/refract/0594ba.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/refract/0594ba.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..776bfd5cdf --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/0594ba.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void refract_0594ba() { + vector res = refract((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + refract_0594ba(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + refract_0594ba(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + refract_0594ba(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001B24EF980B0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/refract/0594ba.wgsl.expected.glsl b/test/tint/builtins/gen/literal/refract/0594ba.wgsl.expected.glsl new file mode 100644 index 0000000000..dd0c411e87 --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/0594ba.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void refract_0594ba() { + f16vec4 res = refract(f16vec4(0.0hf), f16vec4(0.0hf), 0.0hf); +} + +vec4 vertex_main() { + refract_0594ba(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void refract_0594ba() { + f16vec4 res = refract(f16vec4(0.0hf), f16vec4(0.0hf), 0.0hf); +} + +void fragment_main() { + refract_0594ba(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void refract_0594ba() { + f16vec4 res = refract(f16vec4(0.0hf), f16vec4(0.0hf), 0.0hf); +} + +void compute_main() { + refract_0594ba(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/refract/0594ba.wgsl.expected.msl b/test/tint/builtins/gen/literal/refract/0594ba.wgsl.expected.msl new file mode 100644 index 0000000000..5bb163e2ba --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/0594ba.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void refract_0594ba() { + half4 res = refract(half4(0.0h), half4(0.0h), 0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + refract_0594ba(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + refract_0594ba(); + return; +} + +kernel void compute_main() { + refract_0594ba(); + return; +} + diff --git a/test/tint/builtins/gen/literal/refract/0594ba.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/refract/0594ba.wgsl.expected.spvasm new file mode 100644 index 0000000000..5d0cc45742 --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/0594ba.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %refract_0594ba "refract_0594ba" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half + %18 = OpConstantNull %half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%refract_0594ba = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Refract %17 %17 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %refract_0594ba + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %refract_0594ba + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %refract_0594ba + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/refract/0594ba.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/refract/0594ba.wgsl.expected.wgsl new file mode 100644 index 0000000000..ab78c7e94d --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/0594ba.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn refract_0594ba() { + var res : vec4 = refract(vec4(f16()), vec4(f16()), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + refract_0594ba(); + return vec4(); +} + +@fragment +fn fragment_main() { + refract_0594ba(); +} + +@compute @workgroup_size(1) +fn compute_main() { + refract_0594ba(); +} diff --git a/test/tint/builtins/gen/literal/refract/570cb3.wgsl b/test/tint/builtins/gen/literal/refract/570cb3.wgsl new file mode 100644 index 0000000000..130e4492ad --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/570cb3.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn refract(vec<2, f16>, vec<2, f16>, f16) -> vec<2, f16> +fn refract_570cb3() { + var res: vec2 = refract(vec2(f16()), vec2(f16()), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + refract_570cb3(); + return vec4(); +} + +@fragment +fn fragment_main() { + refract_570cb3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + refract_570cb3(); +} diff --git a/test/tint/builtins/gen/literal/refract/570cb3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/refract/570cb3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1f7f29d341 --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/570cb3.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void refract_570cb3() { + vector res = refract((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + refract_570cb3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + refract_570cb3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + refract_570cb3(); + return; +} diff --git a/test/tint/builtins/gen/literal/refract/570cb3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/refract/570cb3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..10ae4be2c9 --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/570cb3.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void refract_570cb3() { + vector res = refract((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + refract_570cb3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + refract_570cb3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + refract_570cb3(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F32B087F20(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/refract/570cb3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/refract/570cb3.wgsl.expected.glsl new file mode 100644 index 0000000000..14fad7d88d --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/570cb3.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void refract_570cb3() { + f16vec2 res = refract(f16vec2(0.0hf), f16vec2(0.0hf), 0.0hf); +} + +vec4 vertex_main() { + refract_570cb3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void refract_570cb3() { + f16vec2 res = refract(f16vec2(0.0hf), f16vec2(0.0hf), 0.0hf); +} + +void fragment_main() { + refract_570cb3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void refract_570cb3() { + f16vec2 res = refract(f16vec2(0.0hf), f16vec2(0.0hf), 0.0hf); +} + +void compute_main() { + refract_570cb3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/refract/570cb3.wgsl.expected.msl b/test/tint/builtins/gen/literal/refract/570cb3.wgsl.expected.msl new file mode 100644 index 0000000000..da86c8c659 --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/570cb3.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void refract_570cb3() { + half2 res = refract(half2(0.0h), half2(0.0h), 0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + refract_570cb3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + refract_570cb3(); + return; +} + +kernel void compute_main() { + refract_570cb3(); + return; +} + diff --git a/test/tint/builtins/gen/literal/refract/570cb3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/refract/570cb3.wgsl.expected.spvasm new file mode 100644 index 0000000000..238e6f1e3a --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/570cb3.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %refract_570cb3 "refract_570cb3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half + %18 = OpConstantNull %half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%refract_570cb3 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Refract %17 %17 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %refract_570cb3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %refract_570cb3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %refract_570cb3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/refract/570cb3.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/refract/570cb3.wgsl.expected.wgsl new file mode 100644 index 0000000000..45a3472273 --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/570cb3.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn refract_570cb3() { + var res : vec2 = refract(vec2(f16()), vec2(f16()), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + refract_570cb3(); + return vec4(); +} + +@fragment +fn fragment_main() { + refract_570cb3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + refract_570cb3(); +} diff --git a/test/tint/builtins/gen/literal/refract/8984af.wgsl b/test/tint/builtins/gen/literal/refract/8984af.wgsl new file mode 100644 index 0000000000..ccc6f61488 --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/8984af.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn refract(vec<3, f16>, vec<3, f16>, f16) -> vec<3, f16> +fn refract_8984af() { + var res: vec3 = refract(vec3(f16()), vec3(f16()), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + refract_8984af(); + return vec4(); +} + +@fragment +fn fragment_main() { + refract_8984af(); +} + +@compute @workgroup_size(1) +fn compute_main() { + refract_8984af(); +} diff --git a/test/tint/builtins/gen/literal/refract/8984af.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/refract/8984af.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..82aa4adaab --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/8984af.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void refract_8984af() { + vector res = refract((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + refract_8984af(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + refract_8984af(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + refract_8984af(); + return; +} diff --git a/test/tint/builtins/gen/literal/refract/8984af.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/refract/8984af.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fd30a49b55 --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/8984af.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void refract_8984af() { + vector res = refract((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + refract_8984af(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + refract_8984af(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + refract_8984af(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000019FDBAB9D00(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/refract/8984af.wgsl.expected.glsl b/test/tint/builtins/gen/literal/refract/8984af.wgsl.expected.glsl new file mode 100644 index 0000000000..cd538f62d4 --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/8984af.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void refract_8984af() { + f16vec3 res = refract(f16vec3(0.0hf), f16vec3(0.0hf), 0.0hf); +} + +vec4 vertex_main() { + refract_8984af(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void refract_8984af() { + f16vec3 res = refract(f16vec3(0.0hf), f16vec3(0.0hf), 0.0hf); +} + +void fragment_main() { + refract_8984af(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void refract_8984af() { + f16vec3 res = refract(f16vec3(0.0hf), f16vec3(0.0hf), 0.0hf); +} + +void compute_main() { + refract_8984af(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/refract/8984af.wgsl.expected.msl b/test/tint/builtins/gen/literal/refract/8984af.wgsl.expected.msl new file mode 100644 index 0000000000..54ca61d49b --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/8984af.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void refract_8984af() { + half3 res = refract(half3(0.0h), half3(0.0h), 0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + refract_8984af(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + refract_8984af(); + return; +} + +kernel void compute_main() { + refract_8984af(); + return; +} + diff --git a/test/tint/builtins/gen/literal/refract/8984af.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/refract/8984af.wgsl.expected.spvasm new file mode 100644 index 0000000000..28804a8632 --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/8984af.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %refract_8984af "refract_8984af" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half + %18 = OpConstantNull %half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%refract_8984af = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Refract %17 %17 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %refract_8984af + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %refract_8984af + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %refract_8984af + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/refract/8984af.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/refract/8984af.wgsl.expected.wgsl new file mode 100644 index 0000000000..8ce7e19cbc --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/8984af.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn refract_8984af() { + var res : vec3 = refract(vec3(f16()), vec3(f16()), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + refract_8984af(); + return vec4(); +} + +@fragment +fn fragment_main() { + refract_8984af(); +} + +@compute @workgroup_size(1) +fn compute_main() { + refract_8984af(); +} diff --git a/test/tint/builtins/gen/literal/round/9078ef.wgsl b/test/tint/builtins/gen/literal/round/9078ef.wgsl new file mode 100644 index 0000000000..d5223dcf61 --- /dev/null +++ b/test/tint/builtins/gen/literal/round/9078ef.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn round(f16) -> f16 +fn round_9078ef() { + var res: f16 = round(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_9078ef(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_9078ef(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_9078ef(); +} diff --git a/test/tint/builtins/gen/literal/round/9078ef.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/round/9078ef.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e695f9b52f --- /dev/null +++ b/test/tint/builtins/gen/literal/round/9078ef.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void round_9078ef() { + float16_t res = round(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_9078ef(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_9078ef(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_9078ef(); + return; +} diff --git a/test/tint/builtins/gen/literal/round/9078ef.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/round/9078ef.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ba25fa1fcc --- /dev/null +++ b/test/tint/builtins/gen/literal/round/9078ef.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void round_9078ef() { + float16_t res = round(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_9078ef(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_9078ef(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_9078ef(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001AFF97C0AC0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001AFF97C0AC0(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/round/9078ef.wgsl.expected.glsl b/test/tint/builtins/gen/literal/round/9078ef.wgsl.expected.glsl new file mode 100644 index 0000000000..34f4fd1fdf --- /dev/null +++ b/test/tint/builtins/gen/literal/round/9078ef.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void round_9078ef() { + float16_t res = round(0.0hf); +} + +vec4 vertex_main() { + round_9078ef(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void round_9078ef() { + float16_t res = round(0.0hf); +} + +void fragment_main() { + round_9078ef(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void round_9078ef() { + float16_t res = round(0.0hf); +} + +void compute_main() { + round_9078ef(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/round/9078ef.wgsl.expected.msl b/test/tint/builtins/gen/literal/round/9078ef.wgsl.expected.msl new file mode 100644 index 0000000000..c400dc4cbb --- /dev/null +++ b/test/tint/builtins/gen/literal/round/9078ef.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void round_9078ef() { + half res = rint(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + round_9078ef(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + round_9078ef(); + return; +} + +kernel void compute_main() { + round_9078ef(); + return; +} + diff --git a/test/tint/builtins/gen/literal/round/9078ef.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/round/9078ef.wgsl.expected.spvasm new file mode 100644 index 0000000000..80c9f07b49 --- /dev/null +++ b/test/tint/builtins/gen/literal/round/9078ef.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %round_9078ef "round_9078ef" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%round_9078ef = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 RoundEven %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %round_9078ef + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %round_9078ef + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %round_9078ef + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/round/9078ef.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/round/9078ef.wgsl.expected.wgsl new file mode 100644 index 0000000000..f918a9048d --- /dev/null +++ b/test/tint/builtins/gen/literal/round/9078ef.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn round_9078ef() { + var res : f16 = round(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_9078ef(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_9078ef(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_9078ef(); +} diff --git a/test/tint/builtins/gen/literal/round/d87e84.wgsl b/test/tint/builtins/gen/literal/round/d87e84.wgsl new file mode 100644 index 0000000000..3ca7f698eb --- /dev/null +++ b/test/tint/builtins/gen/literal/round/d87e84.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn round(vec<2, f16>) -> vec<2, f16> +fn round_d87e84() { + var res: vec2 = round(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_d87e84(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_d87e84(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_d87e84(); +} diff --git a/test/tint/builtins/gen/literal/round/d87e84.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/round/d87e84.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..dc48afa9c7 --- /dev/null +++ b/test/tint/builtins/gen/literal/round/d87e84.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void round_d87e84() { + vector res = round((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_d87e84(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_d87e84(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_d87e84(); + return; +} diff --git a/test/tint/builtins/gen/literal/round/d87e84.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/round/d87e84.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b025eb8bf8 --- /dev/null +++ b/test/tint/builtins/gen/literal/round/d87e84.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void round_d87e84() { + vector res = round((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_d87e84(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_d87e84(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_d87e84(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D031328810(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/round/d87e84.wgsl.expected.glsl b/test/tint/builtins/gen/literal/round/d87e84.wgsl.expected.glsl new file mode 100644 index 0000000000..e2e82c9dd1 --- /dev/null +++ b/test/tint/builtins/gen/literal/round/d87e84.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void round_d87e84() { + f16vec2 res = round(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + round_d87e84(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void round_d87e84() { + f16vec2 res = round(f16vec2(0.0hf)); +} + +void fragment_main() { + round_d87e84(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void round_d87e84() { + f16vec2 res = round(f16vec2(0.0hf)); +} + +void compute_main() { + round_d87e84(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/round/d87e84.wgsl.expected.msl b/test/tint/builtins/gen/literal/round/d87e84.wgsl.expected.msl new file mode 100644 index 0000000000..af2b9b241e --- /dev/null +++ b/test/tint/builtins/gen/literal/round/d87e84.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void round_d87e84() { + half2 res = rint(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + round_d87e84(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + round_d87e84(); + return; +} + +kernel void compute_main() { + round_d87e84(); + return; +} + diff --git a/test/tint/builtins/gen/literal/round/d87e84.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/round/d87e84.wgsl.expected.spvasm new file mode 100644 index 0000000000..e6698b4cae --- /dev/null +++ b/test/tint/builtins/gen/literal/round/d87e84.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %round_d87e84 "round_d87e84" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%round_d87e84 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 RoundEven %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %round_d87e84 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %round_d87e84 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %round_d87e84 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/round/d87e84.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/round/d87e84.wgsl.expected.wgsl new file mode 100644 index 0000000000..d3a6cc463c --- /dev/null +++ b/test/tint/builtins/gen/literal/round/d87e84.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn round_d87e84() { + var res : vec2 = round(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_d87e84(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_d87e84(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_d87e84(); +} diff --git a/test/tint/builtins/gen/literal/round/e1bba2.wgsl b/test/tint/builtins/gen/literal/round/e1bba2.wgsl new file mode 100644 index 0000000000..dfa126475a --- /dev/null +++ b/test/tint/builtins/gen/literal/round/e1bba2.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn round(vec<3, f16>) -> vec<3, f16> +fn round_e1bba2() { + var res: vec3 = round(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_e1bba2(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_e1bba2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_e1bba2(); +} diff --git a/test/tint/builtins/gen/literal/round/e1bba2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/round/e1bba2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4941302523 --- /dev/null +++ b/test/tint/builtins/gen/literal/round/e1bba2.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void round_e1bba2() { + vector res = round((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_e1bba2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_e1bba2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_e1bba2(); + return; +} diff --git a/test/tint/builtins/gen/literal/round/e1bba2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/round/e1bba2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..899f28dd9e --- /dev/null +++ b/test/tint/builtins/gen/literal/round/e1bba2.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void round_e1bba2() { + vector res = round((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_e1bba2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_e1bba2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_e1bba2(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021F98A3E5C0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/round/e1bba2.wgsl.expected.glsl b/test/tint/builtins/gen/literal/round/e1bba2.wgsl.expected.glsl new file mode 100644 index 0000000000..873d32a4aa --- /dev/null +++ b/test/tint/builtins/gen/literal/round/e1bba2.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void round_e1bba2() { + f16vec3 res = round(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + round_e1bba2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void round_e1bba2() { + f16vec3 res = round(f16vec3(0.0hf)); +} + +void fragment_main() { + round_e1bba2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void round_e1bba2() { + f16vec3 res = round(f16vec3(0.0hf)); +} + +void compute_main() { + round_e1bba2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/round/e1bba2.wgsl.expected.msl b/test/tint/builtins/gen/literal/round/e1bba2.wgsl.expected.msl new file mode 100644 index 0000000000..c4670c64cf --- /dev/null +++ b/test/tint/builtins/gen/literal/round/e1bba2.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void round_e1bba2() { + half3 res = rint(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + round_e1bba2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + round_e1bba2(); + return; +} + +kernel void compute_main() { + round_e1bba2(); + return; +} + diff --git a/test/tint/builtins/gen/literal/round/e1bba2.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/round/e1bba2.wgsl.expected.spvasm new file mode 100644 index 0000000000..122df56e4b --- /dev/null +++ b/test/tint/builtins/gen/literal/round/e1bba2.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %round_e1bba2 "round_e1bba2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%round_e1bba2 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 RoundEven %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %round_e1bba2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %round_e1bba2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %round_e1bba2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/round/e1bba2.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/round/e1bba2.wgsl.expected.wgsl new file mode 100644 index 0000000000..6da51860cc --- /dev/null +++ b/test/tint/builtins/gen/literal/round/e1bba2.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn round_e1bba2() { + var res : vec3 = round(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_e1bba2(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_e1bba2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_e1bba2(); +} diff --git a/test/tint/builtins/gen/literal/round/f665b5.wgsl b/test/tint/builtins/gen/literal/round/f665b5.wgsl new file mode 100644 index 0000000000..62932390ff --- /dev/null +++ b/test/tint/builtins/gen/literal/round/f665b5.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn round(vec<4, f16>) -> vec<4, f16> +fn round_f665b5() { + var res: vec4 = round(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_f665b5(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_f665b5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_f665b5(); +} diff --git a/test/tint/builtins/gen/literal/round/f665b5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/round/f665b5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..287b5e1d4b --- /dev/null +++ b/test/tint/builtins/gen/literal/round/f665b5.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void round_f665b5() { + vector res = round((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_f665b5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_f665b5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_f665b5(); + return; +} diff --git a/test/tint/builtins/gen/literal/round/f665b5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/round/f665b5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c73645a7a6 --- /dev/null +++ b/test/tint/builtins/gen/literal/round/f665b5.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void round_f665b5() { + vector res = round((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_f665b5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_f665b5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_f665b5(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000017F6B0D8810(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/round/f665b5.wgsl.expected.glsl b/test/tint/builtins/gen/literal/round/f665b5.wgsl.expected.glsl new file mode 100644 index 0000000000..bc044ed5b4 --- /dev/null +++ b/test/tint/builtins/gen/literal/round/f665b5.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void round_f665b5() { + f16vec4 res = round(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + round_f665b5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void round_f665b5() { + f16vec4 res = round(f16vec4(0.0hf)); +} + +void fragment_main() { + round_f665b5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void round_f665b5() { + f16vec4 res = round(f16vec4(0.0hf)); +} + +void compute_main() { + round_f665b5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/round/f665b5.wgsl.expected.msl b/test/tint/builtins/gen/literal/round/f665b5.wgsl.expected.msl new file mode 100644 index 0000000000..db3fa98c66 --- /dev/null +++ b/test/tint/builtins/gen/literal/round/f665b5.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void round_f665b5() { + half4 res = rint(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + round_f665b5(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + round_f665b5(); + return; +} + +kernel void compute_main() { + round_f665b5(); + return; +} + diff --git a/test/tint/builtins/gen/literal/round/f665b5.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/round/f665b5.wgsl.expected.spvasm new file mode 100644 index 0000000000..9600ad74d0 --- /dev/null +++ b/test/tint/builtins/gen/literal/round/f665b5.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %round_f665b5 "round_f665b5" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%round_f665b5 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 RoundEven %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %round_f665b5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %round_f665b5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %round_f665b5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/round/f665b5.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/round/f665b5.wgsl.expected.wgsl new file mode 100644 index 0000000000..9338453976 --- /dev/null +++ b/test/tint/builtins/gen/literal/round/f665b5.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn round_f665b5() { + var res : vec4 = round(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_f665b5(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_f665b5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_f665b5(); +} diff --git a/test/tint/builtins/gen/literal/select/10e73b.wgsl b/test/tint/builtins/gen/literal/select/10e73b.wgsl new file mode 100644 index 0000000000..96320641af --- /dev/null +++ b/test/tint/builtins/gen/literal/select/10e73b.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn select(f16, f16, bool) -> f16 +fn select_10e73b() { + var res: f16 = select(f16(), f16(), true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_10e73b(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_10e73b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_10e73b(); +} diff --git a/test/tint/builtins/gen/literal/select/10e73b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/select/10e73b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1aaa5caac9 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/10e73b.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void select_10e73b() { + float16_t res = (true ? float16_t(0.0h) : float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_10e73b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_10e73b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_10e73b(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/10e73b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/select/10e73b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9d0c5f2281 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/10e73b.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void select_10e73b() { + float16_t res = (true ? float16_t(0.0h) : float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_10e73b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_10e73b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_10e73b(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001A45741F510(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001A45741F510(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/select/10e73b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/10e73b.wgsl.expected.glsl new file mode 100644 index 0000000000..bab4323c43 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/10e73b.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_10e73b() { + float16_t res = (true ? 0.0hf : 0.0hf); +} + +vec4 vertex_main() { + select_10e73b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void select_10e73b() { + float16_t res = (true ? 0.0hf : 0.0hf); +} + +void fragment_main() { + select_10e73b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_10e73b() { + float16_t res = (true ? 0.0hf : 0.0hf); +} + +void compute_main() { + select_10e73b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/10e73b.wgsl.expected.msl b/test/tint/builtins/gen/literal/select/10e73b.wgsl.expected.msl new file mode 100644 index 0000000000..b7c4cd594f --- /dev/null +++ b/test/tint/builtins/gen/literal/select/10e73b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void select_10e73b() { + half res = select(0.0h, 0.0h, true); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_10e73b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_10e73b(); + return; +} + +kernel void compute_main() { + select_10e73b(); + return; +} + diff --git a/test/tint/builtins/gen/literal/select/10e73b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/select/10e73b.wgsl.expected.spvasm new file mode 100644 index 0000000000..af36e83608 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/10e73b.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_10e73b "select_10e73b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %bool = OpTypeBool + %true = OpConstantTrue %bool + %17 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_10e73b = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %17 + %13 = OpSelect %half %true %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %select_10e73b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %select_10e73b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %select_10e73b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/select/10e73b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/select/10e73b.wgsl.expected.wgsl new file mode 100644 index 0000000000..4aa334d0a2 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/10e73b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn select_10e73b() { + var res : f16 = select(f16(), f16(), true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_10e73b(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_10e73b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_10e73b(); +} diff --git a/test/tint/builtins/gen/literal/select/1ada2a.wgsl b/test/tint/builtins/gen/literal/select/1ada2a.wgsl new file mode 100644 index 0000000000..2278b71f56 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/1ada2a.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn select(vec<3, f16>, vec<3, f16>, bool) -> vec<3, f16> +fn select_1ada2a() { + var res: vec3 = select(vec3(f16()), vec3(f16()), true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_1ada2a(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_1ada2a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_1ada2a(); +} diff --git a/test/tint/builtins/gen/literal/select/1ada2a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/select/1ada2a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..87d78068f0 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/1ada2a.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void select_1ada2a() { + vector res = (true ? (float16_t(0.0h)).xxx : (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_1ada2a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_1ada2a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_1ada2a(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/1ada2a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/select/1ada2a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2165304d45 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/1ada2a.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void select_1ada2a() { + vector res = (true ? (float16_t(0.0h)).xxx : (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_1ada2a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_1ada2a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_1ada2a(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001FD85D20100(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/select/1ada2a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/1ada2a.wgsl.expected.glsl new file mode 100644 index 0000000000..63526f1b59 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/1ada2a.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_1ada2a() { + f16vec3 res = (true ? f16vec3(0.0hf) : f16vec3(0.0hf)); +} + +vec4 vertex_main() { + select_1ada2a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void select_1ada2a() { + f16vec3 res = (true ? f16vec3(0.0hf) : f16vec3(0.0hf)); +} + +void fragment_main() { + select_1ada2a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_1ada2a() { + f16vec3 res = (true ? f16vec3(0.0hf) : f16vec3(0.0hf)); +} + +void compute_main() { + select_1ada2a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/1ada2a.wgsl.expected.msl b/test/tint/builtins/gen/literal/select/1ada2a.wgsl.expected.msl new file mode 100644 index 0000000000..bc21eda6ab --- /dev/null +++ b/test/tint/builtins/gen/literal/select/1ada2a.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void select_1ada2a() { + half3 res = select(half3(0.0h), half3(0.0h), true); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_1ada2a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_1ada2a(); + return; +} + +kernel void compute_main() { + select_1ada2a(); + return; +} + diff --git a/test/tint/builtins/gen/literal/select/1ada2a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/select/1ada2a.wgsl.expected.spvasm new file mode 100644 index 0000000000..23393570b4 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/1ada2a.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_1ada2a "select_1ada2a" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %bool = OpTypeBool + %true = OpConstantTrue %bool + %18 = OpConstantNull %v3half + %v3bool = OpTypeVector %bool 3 +%_ptr_Function_v3bool = OpTypePointer Function %v3bool + %22 = OpConstantNull %v3bool +%_ptr_Function_v3half = OpTypePointer Function %v3half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_1ada2a = OpFunction %void None %9 + %12 = OpLabel + %20 = OpVariable %_ptr_Function_v3bool Function %22 + %res = OpVariable %_ptr_Function_v3half Function %18 + %23 = OpCompositeConstruct %v3bool %true %true %true + %13 = OpSelect %v3half %23 %18 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %select_1ada2a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %select_1ada2a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %select_1ada2a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/select/1ada2a.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/select/1ada2a.wgsl.expected.wgsl new file mode 100644 index 0000000000..64fb37129f --- /dev/null +++ b/test/tint/builtins/gen/literal/select/1ada2a.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn select_1ada2a() { + var res : vec3 = select(vec3(f16()), vec3(f16()), true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_1ada2a(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_1ada2a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_1ada2a(); +} diff --git a/test/tint/builtins/gen/literal/select/53d518.wgsl b/test/tint/builtins/gen/literal/select/53d518.wgsl new file mode 100644 index 0000000000..a511c17c43 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/53d518.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn select(vec<3, f16>, vec<3, f16>, vec<3, bool>) -> vec<3, f16> +fn select_53d518() { + var res: vec3 = select(vec3(f16()), vec3(f16()), vec3(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_53d518(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_53d518(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_53d518(); +} diff --git a/test/tint/builtins/gen/literal/select/53d518.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/select/53d518.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..95ed17f271 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/53d518.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void select_53d518() { + vector res = ((true).xxx ? (float16_t(0.0h)).xxx : (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_53d518(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_53d518(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_53d518(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/53d518.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/select/53d518.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3117c7bb35 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/53d518.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void select_53d518() { + vector res = ((true).xxx ? (float16_t(0.0h)).xxx : (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_53d518(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_53d518(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_53d518(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000025E61DB8680(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/select/53d518.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/53d518.wgsl.expected.glsl new file mode 100644 index 0000000000..1ecee212e7 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/53d518.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_53d518() { + f16vec3 res = mix(f16vec3(0.0hf), f16vec3(0.0hf), bvec3(true)); +} + +vec4 vertex_main() { + select_53d518(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void select_53d518() { + f16vec3 res = mix(f16vec3(0.0hf), f16vec3(0.0hf), bvec3(true)); +} + +void fragment_main() { + select_53d518(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_53d518() { + f16vec3 res = mix(f16vec3(0.0hf), f16vec3(0.0hf), bvec3(true)); +} + +void compute_main() { + select_53d518(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/53d518.wgsl.expected.msl b/test/tint/builtins/gen/literal/select/53d518.wgsl.expected.msl new file mode 100644 index 0000000000..9338705490 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/53d518.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void select_53d518() { + half3 res = select(half3(0.0h), half3(0.0h), bool3(true)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_53d518(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_53d518(); + return; +} + +kernel void compute_main() { + select_53d518(); + return; +} + diff --git a/test/tint/builtins/gen/literal/select/53d518.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/select/53d518.wgsl.expected.spvasm new file mode 100644 index 0000000000..f76cbacd9e --- /dev/null +++ b/test/tint/builtins/gen/literal/select/53d518.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_53d518 "select_53d518" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %true = OpConstantTrue %bool + %19 = OpConstantComposite %v3bool %true %true %true + %20 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_53d518 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %20 + %13 = OpSelect %v3half %19 %20 %20 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %select_53d518 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %select_53d518 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %select_53d518 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/select/53d518.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/select/53d518.wgsl.expected.wgsl new file mode 100644 index 0000000000..425a44b087 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/53d518.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn select_53d518() { + var res : vec3 = select(vec3(f16()), vec3(f16()), vec3(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_53d518(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_53d518(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_53d518(); +} diff --git a/test/tint/builtins/gen/literal/select/830dd9.wgsl b/test/tint/builtins/gen/literal/select/830dd9.wgsl new file mode 100644 index 0000000000..f1fda9e5a9 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/830dd9.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn select(vec<4, f16>, vec<4, f16>, bool) -> vec<4, f16> +fn select_830dd9() { + var res: vec4 = select(vec4(f16()), vec4(f16()), true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_830dd9(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_830dd9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_830dd9(); +} diff --git a/test/tint/builtins/gen/literal/select/830dd9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/select/830dd9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3bf576f1cb --- /dev/null +++ b/test/tint/builtins/gen/literal/select/830dd9.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void select_830dd9() { + vector res = (true ? (float16_t(0.0h)).xxxx : (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_830dd9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_830dd9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_830dd9(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/830dd9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/select/830dd9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..522a9e3ebd --- /dev/null +++ b/test/tint/builtins/gen/literal/select/830dd9.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void select_830dd9() { + vector res = (true ? (float16_t(0.0h)).xxxx : (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_830dd9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_830dd9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_830dd9(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E721C969A0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/select/830dd9.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/830dd9.wgsl.expected.glsl new file mode 100644 index 0000000000..69a2b653d9 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/830dd9.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_830dd9() { + f16vec4 res = (true ? f16vec4(0.0hf) : f16vec4(0.0hf)); +} + +vec4 vertex_main() { + select_830dd9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void select_830dd9() { + f16vec4 res = (true ? f16vec4(0.0hf) : f16vec4(0.0hf)); +} + +void fragment_main() { + select_830dd9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_830dd9() { + f16vec4 res = (true ? f16vec4(0.0hf) : f16vec4(0.0hf)); +} + +void compute_main() { + select_830dd9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/830dd9.wgsl.expected.msl b/test/tint/builtins/gen/literal/select/830dd9.wgsl.expected.msl new file mode 100644 index 0000000000..f779aebce2 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/830dd9.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void select_830dd9() { + half4 res = select(half4(0.0h), half4(0.0h), true); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_830dd9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_830dd9(); + return; +} + +kernel void compute_main() { + select_830dd9(); + return; +} + diff --git a/test/tint/builtins/gen/literal/select/830dd9.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/select/830dd9.wgsl.expected.spvasm new file mode 100644 index 0000000000..5dfcbe6249 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/830dd9.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_830dd9 "select_830dd9" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %bool = OpTypeBool + %true = OpConstantTrue %bool + %18 = OpConstantNull %v4half + %v4bool = OpTypeVector %bool 4 +%_ptr_Function_v4bool = OpTypePointer Function %v4bool + %22 = OpConstantNull %v4bool +%_ptr_Function_v4half = OpTypePointer Function %v4half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_830dd9 = OpFunction %void None %9 + %12 = OpLabel + %20 = OpVariable %_ptr_Function_v4bool Function %22 + %res = OpVariable %_ptr_Function_v4half Function %18 + %23 = OpCompositeConstruct %v4bool %true %true %true %true + %13 = OpSelect %v4half %23 %18 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %select_830dd9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %select_830dd9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %select_830dd9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/select/830dd9.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/select/830dd9.wgsl.expected.wgsl new file mode 100644 index 0000000000..cb99917b9a --- /dev/null +++ b/test/tint/builtins/gen/literal/select/830dd9.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn select_830dd9() { + var res : vec4 = select(vec4(f16()), vec4(f16()), true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_830dd9(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_830dd9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_830dd9(); +} diff --git a/test/tint/builtins/gen/literal/select/86f9bd.wgsl b/test/tint/builtins/gen/literal/select/86f9bd.wgsl new file mode 100644 index 0000000000..0cb4dc050b --- /dev/null +++ b/test/tint/builtins/gen/literal/select/86f9bd.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn select(vec<2, f16>, vec<2, f16>, bool) -> vec<2, f16> +fn select_86f9bd() { + var res: vec2 = select(vec2(f16()), vec2(f16()), true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_86f9bd(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_86f9bd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_86f9bd(); +} diff --git a/test/tint/builtins/gen/literal/select/86f9bd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/select/86f9bd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..528ebaf882 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/86f9bd.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void select_86f9bd() { + vector res = (true ? (float16_t(0.0h)).xx : (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_86f9bd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_86f9bd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_86f9bd(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/86f9bd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/select/86f9bd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d789a21fd7 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/86f9bd.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void select_86f9bd() { + vector res = (true ? (float16_t(0.0h)).xx : (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_86f9bd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_86f9bd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_86f9bd(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021328920540(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/select/86f9bd.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/86f9bd.wgsl.expected.glsl new file mode 100644 index 0000000000..1ee2a35bf4 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/86f9bd.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_86f9bd() { + f16vec2 res = (true ? f16vec2(0.0hf) : f16vec2(0.0hf)); +} + +vec4 vertex_main() { + select_86f9bd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void select_86f9bd() { + f16vec2 res = (true ? f16vec2(0.0hf) : f16vec2(0.0hf)); +} + +void fragment_main() { + select_86f9bd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_86f9bd() { + f16vec2 res = (true ? f16vec2(0.0hf) : f16vec2(0.0hf)); +} + +void compute_main() { + select_86f9bd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/86f9bd.wgsl.expected.msl b/test/tint/builtins/gen/literal/select/86f9bd.wgsl.expected.msl new file mode 100644 index 0000000000..7b01210106 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/86f9bd.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void select_86f9bd() { + half2 res = select(half2(0.0h), half2(0.0h), true); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_86f9bd(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_86f9bd(); + return; +} + +kernel void compute_main() { + select_86f9bd(); + return; +} + diff --git a/test/tint/builtins/gen/literal/select/86f9bd.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/select/86f9bd.wgsl.expected.spvasm new file mode 100644 index 0000000000..410963b624 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/86f9bd.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_86f9bd "select_86f9bd" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %bool = OpTypeBool + %true = OpConstantTrue %bool + %18 = OpConstantNull %v2half + %v2bool = OpTypeVector %bool 2 +%_ptr_Function_v2bool = OpTypePointer Function %v2bool + %22 = OpConstantNull %v2bool +%_ptr_Function_v2half = OpTypePointer Function %v2half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_86f9bd = OpFunction %void None %9 + %12 = OpLabel + %20 = OpVariable %_ptr_Function_v2bool Function %22 + %res = OpVariable %_ptr_Function_v2half Function %18 + %23 = OpCompositeConstruct %v2bool %true %true + %13 = OpSelect %v2half %23 %18 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %select_86f9bd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %select_86f9bd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %select_86f9bd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/select/86f9bd.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/select/86f9bd.wgsl.expected.wgsl new file mode 100644 index 0000000000..0454417a50 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/86f9bd.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn select_86f9bd() { + var res : vec2 = select(vec2(f16()), vec2(f16()), true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_86f9bd(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_86f9bd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_86f9bd(); +} diff --git a/test/tint/builtins/gen/literal/select/a081f1.wgsl b/test/tint/builtins/gen/literal/select/a081f1.wgsl new file mode 100644 index 0000000000..9f4e789a0a --- /dev/null +++ b/test/tint/builtins/gen/literal/select/a081f1.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn select(vec<4, f16>, vec<4, f16>, vec<4, bool>) -> vec<4, f16> +fn select_a081f1() { + var res: vec4 = select(vec4(f16()), vec4(f16()), vec4(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_a081f1(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_a081f1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_a081f1(); +} diff --git a/test/tint/builtins/gen/literal/select/a081f1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/select/a081f1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3eb1517459 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/a081f1.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void select_a081f1() { + vector res = ((true).xxxx ? (float16_t(0.0h)).xxxx : (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_a081f1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_a081f1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_a081f1(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/a081f1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/select/a081f1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..651eaf722a --- /dev/null +++ b/test/tint/builtins/gen/literal/select/a081f1.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void select_a081f1() { + vector res = ((true).xxxx ? (float16_t(0.0h)).xxxx : (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_a081f1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_a081f1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_a081f1(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000202B4A94A10(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/select/a081f1.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/a081f1.wgsl.expected.glsl new file mode 100644 index 0000000000..a486535d5c --- /dev/null +++ b/test/tint/builtins/gen/literal/select/a081f1.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_a081f1() { + f16vec4 res = mix(f16vec4(0.0hf), f16vec4(0.0hf), bvec4(true)); +} + +vec4 vertex_main() { + select_a081f1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void select_a081f1() { + f16vec4 res = mix(f16vec4(0.0hf), f16vec4(0.0hf), bvec4(true)); +} + +void fragment_main() { + select_a081f1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_a081f1() { + f16vec4 res = mix(f16vec4(0.0hf), f16vec4(0.0hf), bvec4(true)); +} + +void compute_main() { + select_a081f1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/a081f1.wgsl.expected.msl b/test/tint/builtins/gen/literal/select/a081f1.wgsl.expected.msl new file mode 100644 index 0000000000..fddeb4d432 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/a081f1.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void select_a081f1() { + half4 res = select(half4(0.0h), half4(0.0h), bool4(true)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_a081f1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_a081f1(); + return; +} + +kernel void compute_main() { + select_a081f1(); + return; +} + diff --git a/test/tint/builtins/gen/literal/select/a081f1.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/select/a081f1.wgsl.expected.spvasm new file mode 100644 index 0000000000..37e70c6c25 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/a081f1.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_a081f1 "select_a081f1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %true = OpConstantTrue %bool + %19 = OpConstantComposite %v4bool %true %true %true %true + %20 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_a081f1 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %20 + %13 = OpSelect %v4half %19 %20 %20 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %select_a081f1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %select_a081f1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %select_a081f1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/select/a081f1.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/select/a081f1.wgsl.expected.wgsl new file mode 100644 index 0000000000..feefad7fcf --- /dev/null +++ b/test/tint/builtins/gen/literal/select/a081f1.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn select_a081f1() { + var res : vec4 = select(vec4(f16()), vec4(f16()), vec4(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_a081f1(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_a081f1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_a081f1(); +} diff --git a/test/tint/builtins/gen/literal/select/ed7c13.wgsl b/test/tint/builtins/gen/literal/select/ed7c13.wgsl new file mode 100644 index 0000000000..1d862f657b --- /dev/null +++ b/test/tint/builtins/gen/literal/select/ed7c13.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn select(vec<2, f16>, vec<2, f16>, vec<2, bool>) -> vec<2, f16> +fn select_ed7c13() { + var res: vec2 = select(vec2(f16()), vec2(f16()), vec2(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_ed7c13(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_ed7c13(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_ed7c13(); +} diff --git a/test/tint/builtins/gen/literal/select/ed7c13.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/select/ed7c13.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1db2ca48d2 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/ed7c13.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void select_ed7c13() { + vector res = ((true).xx ? (float16_t(0.0h)).xx : (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_ed7c13(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_ed7c13(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_ed7c13(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/ed7c13.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/select/ed7c13.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0006a34c2e --- /dev/null +++ b/test/tint/builtins/gen/literal/select/ed7c13.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void select_ed7c13() { + vector res = ((true).xx ? (float16_t(0.0h)).xx : (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_ed7c13(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_ed7c13(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_ed7c13(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024686E0D4B0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/select/ed7c13.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/ed7c13.wgsl.expected.glsl new file mode 100644 index 0000000000..3e0564b2f8 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/ed7c13.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_ed7c13() { + f16vec2 res = mix(f16vec2(0.0hf), f16vec2(0.0hf), bvec2(true)); +} + +vec4 vertex_main() { + select_ed7c13(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void select_ed7c13() { + f16vec2 res = mix(f16vec2(0.0hf), f16vec2(0.0hf), bvec2(true)); +} + +void fragment_main() { + select_ed7c13(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_ed7c13() { + f16vec2 res = mix(f16vec2(0.0hf), f16vec2(0.0hf), bvec2(true)); +} + +void compute_main() { + select_ed7c13(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/ed7c13.wgsl.expected.msl b/test/tint/builtins/gen/literal/select/ed7c13.wgsl.expected.msl new file mode 100644 index 0000000000..172c6dd67d --- /dev/null +++ b/test/tint/builtins/gen/literal/select/ed7c13.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void select_ed7c13() { + half2 res = select(half2(0.0h), half2(0.0h), bool2(true)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_ed7c13(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_ed7c13(); + return; +} + +kernel void compute_main() { + select_ed7c13(); + return; +} + diff --git a/test/tint/builtins/gen/literal/select/ed7c13.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/select/ed7c13.wgsl.expected.spvasm new file mode 100644 index 0000000000..3112c00a14 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/ed7c13.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_ed7c13 "select_ed7c13" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %true = OpConstantTrue %bool + %19 = OpConstantComposite %v2bool %true %true + %20 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_ed7c13 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %20 + %13 = OpSelect %v2half %19 %20 %20 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %select_ed7c13 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %select_ed7c13 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %select_ed7c13 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/select/ed7c13.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/select/ed7c13.wgsl.expected.wgsl new file mode 100644 index 0000000000..427fba2d5e --- /dev/null +++ b/test/tint/builtins/gen/literal/select/ed7c13.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn select_ed7c13() { + var res : vec2 = select(vec2(f16()), vec2(f16()), vec2(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_ed7c13(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_ed7c13(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_ed7c13(); +} diff --git a/test/tint/builtins/gen/literal/sign/160933.wgsl b/test/tint/builtins/gen/literal/sign/160933.wgsl new file mode 100644 index 0000000000..13a6c3b97c --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/160933.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sign(vec<4, f16>) -> vec<4, f16> +fn sign_160933() { + var res: vec4 = sign(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_160933(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_160933(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_160933(); +} diff --git a/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b8e2784506 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sign_160933() { + vector res = sign((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_160933(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_160933(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_160933(); + return; +} diff --git a/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b111818e94 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void sign_160933() { + vector res = sign((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_160933(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_160933(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_160933(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001A1A601ACD0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.glsl new file mode 100644 index 0000000000..23eade5d6f --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sign_160933() { + f16vec4 res = sign(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + sign_160933(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sign_160933() { + f16vec4 res = sign(f16vec4(0.0hf)); +} + +void fragment_main() { + sign_160933(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sign_160933() { + f16vec4 res = sign(f16vec4(0.0hf)); +} + +void compute_main() { + sign_160933(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.msl b/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.msl new file mode 100644 index 0000000000..faf94eda01 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sign_160933() { + half4 res = sign(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sign_160933(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sign_160933(); + return; +} + +kernel void compute_main() { + sign_160933(); + return; +} + diff --git a/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.spvasm new file mode 100644 index 0000000000..9a1664ca13 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sign_160933 "sign_160933" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sign_160933 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 FSign %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %sign_160933 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %sign_160933 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %sign_160933 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.wgsl new file mode 100644 index 0000000000..5633954c2c --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn sign_160933() { + var res : vec4 = sign(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_160933(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_160933(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_160933(); +} diff --git a/test/tint/builtins/gen/literal/sign/5d283a.wgsl b/test/tint/builtins/gen/literal/sign/5d283a.wgsl new file mode 100644 index 0000000000..dc23259a5e --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/5d283a.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sign(vec<3, f16>) -> vec<3, f16> +fn sign_5d283a() { + var res: vec3 = sign(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_5d283a(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_5d283a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_5d283a(); +} diff --git a/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0331539bb5 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sign_5d283a() { + vector res = sign((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_5d283a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_5d283a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_5d283a(); + return; +} diff --git a/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7493bb0e29 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void sign_5d283a() { + vector res = sign((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_5d283a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_5d283a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_5d283a(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002BE5E5FBCB0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.glsl new file mode 100644 index 0000000000..4cda792691 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sign_5d283a() { + f16vec3 res = sign(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + sign_5d283a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sign_5d283a() { + f16vec3 res = sign(f16vec3(0.0hf)); +} + +void fragment_main() { + sign_5d283a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sign_5d283a() { + f16vec3 res = sign(f16vec3(0.0hf)); +} + +void compute_main() { + sign_5d283a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.msl b/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.msl new file mode 100644 index 0000000000..3ffb6b8b5b --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sign_5d283a() { + half3 res = sign(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sign_5d283a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sign_5d283a(); + return; +} + +kernel void compute_main() { + sign_5d283a(); + return; +} + diff --git a/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.spvasm new file mode 100644 index 0000000000..487c9682f3 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sign_5d283a "sign_5d283a" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sign_5d283a = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 FSign %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %sign_5d283a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %sign_5d283a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %sign_5d283a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.wgsl new file mode 100644 index 0000000000..754ba8baa0 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn sign_5d283a() { + var res : vec3 = sign(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_5d283a(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_5d283a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_5d283a(); +} diff --git a/test/tint/builtins/gen/literal/sign/7c85ea.wgsl b/test/tint/builtins/gen/literal/sign/7c85ea.wgsl new file mode 100644 index 0000000000..b8d85dca5b --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/7c85ea.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sign(f16) -> f16 +fn sign_7c85ea() { + var res: f16 = sign(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_7c85ea(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_7c85ea(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_7c85ea(); +} diff --git a/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fa81821bcb --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sign_7c85ea() { + float16_t res = sign(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_7c85ea(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_7c85ea(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_7c85ea(); + return; +} diff --git a/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6690d62726 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void sign_7c85ea() { + float16_t res = sign(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_7c85ea(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_7c85ea(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_7c85ea(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001A85B767D00(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001A85B767D00(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.glsl new file mode 100644 index 0000000000..c49bc28c17 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sign_7c85ea() { + float16_t res = sign(0.0hf); +} + +vec4 vertex_main() { + sign_7c85ea(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sign_7c85ea() { + float16_t res = sign(0.0hf); +} + +void fragment_main() { + sign_7c85ea(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sign_7c85ea() { + float16_t res = sign(0.0hf); +} + +void compute_main() { + sign_7c85ea(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.msl b/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.msl new file mode 100644 index 0000000000..9f39434dd5 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sign_7c85ea() { + half res = sign(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sign_7c85ea(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sign_7c85ea(); + return; +} + +kernel void compute_main() { + sign_7c85ea(); + return; +} + diff --git a/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.spvasm new file mode 100644 index 0000000000..f3a19c03d1 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sign_7c85ea "sign_7c85ea" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sign_7c85ea = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 FSign %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %sign_7c85ea + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %sign_7c85ea + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sign_7c85ea + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.wgsl new file mode 100644 index 0000000000..5080143825 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn sign_7c85ea() { + var res : f16 = sign(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_7c85ea(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_7c85ea(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_7c85ea(); +} diff --git a/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl b/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl new file mode 100644 index 0000000000..169814e40b --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sign(vec<2, f16>) -> vec<2, f16> +fn sign_ccdb3c() { + var res: vec2 = sign(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_ccdb3c(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_ccdb3c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_ccdb3c(); +} diff --git a/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e0c820cec0 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sign_ccdb3c() { + vector res = sign((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_ccdb3c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_ccdb3c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_ccdb3c(); + return; +} diff --git a/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a77b50bc6e --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void sign_ccdb3c() { + vector res = sign((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_ccdb3c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_ccdb3c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_ccdb3c(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001FE218EE9E0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.glsl new file mode 100644 index 0000000000..fae505304b --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sign_ccdb3c() { + f16vec2 res = sign(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + sign_ccdb3c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sign_ccdb3c() { + f16vec2 res = sign(f16vec2(0.0hf)); +} + +void fragment_main() { + sign_ccdb3c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sign_ccdb3c() { + f16vec2 res = sign(f16vec2(0.0hf)); +} + +void compute_main() { + sign_ccdb3c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.msl b/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.msl new file mode 100644 index 0000000000..8df474b1de --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sign_ccdb3c() { + half2 res = sign(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sign_ccdb3c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sign_ccdb3c(); + return; +} + +kernel void compute_main() { + sign_ccdb3c(); + return; +} + diff --git a/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.spvasm new file mode 100644 index 0000000000..8366c62671 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sign_ccdb3c "sign_ccdb3c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sign_ccdb3c = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 FSign %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %sign_ccdb3c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %sign_ccdb3c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %sign_ccdb3c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.wgsl new file mode 100644 index 0000000000..0a5f0ec369 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn sign_ccdb3c() { + var res : vec2 = sign(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_ccdb3c(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_ccdb3c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_ccdb3c(); +} diff --git a/test/tint/builtins/gen/literal/sin/2c903b.wgsl b/test/tint/builtins/gen/literal/sin/2c903b.wgsl new file mode 100644 index 0000000000..abe172c90e --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/2c903b.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sin(vec<3, f16>) -> vec<3, f16> +fn sin_2c903b() { + var res: vec3 = sin(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_2c903b(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_2c903b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_2c903b(); +} diff --git a/test/tint/builtins/gen/literal/sin/2c903b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sin/2c903b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8da2e1c888 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/2c903b.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sin_2c903b() { + vector res = sin((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_2c903b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_2c903b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_2c903b(); + return; +} diff --git a/test/tint/builtins/gen/literal/sin/2c903b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sin/2c903b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b22e7085dc --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/2c903b.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void sin_2c903b() { + vector res = sin((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_2c903b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_2c903b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_2c903b(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000153299087E0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/sin/2c903b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sin/2c903b.wgsl.expected.glsl new file mode 100644 index 0000000000..21de9a7b39 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/2c903b.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sin_2c903b() { + f16vec3 res = sin(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + sin_2c903b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sin_2c903b() { + f16vec3 res = sin(f16vec3(0.0hf)); +} + +void fragment_main() { + sin_2c903b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sin_2c903b() { + f16vec3 res = sin(f16vec3(0.0hf)); +} + +void compute_main() { + sin_2c903b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sin/2c903b.wgsl.expected.msl b/test/tint/builtins/gen/literal/sin/2c903b.wgsl.expected.msl new file mode 100644 index 0000000000..85bf223af8 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/2c903b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sin_2c903b() { + half3 res = sin(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sin_2c903b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sin_2c903b(); + return; +} + +kernel void compute_main() { + sin_2c903b(); + return; +} + diff --git a/test/tint/builtins/gen/literal/sin/2c903b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sin/2c903b.wgsl.expected.spvasm new file mode 100644 index 0000000000..ad41fb308f --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/2c903b.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sin_2c903b "sin_2c903b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %sin_2c903b = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Sin %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %sin_2c903b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %sin_2c903b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %sin_2c903b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/sin/2c903b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sin/2c903b.wgsl.expected.wgsl new file mode 100644 index 0000000000..dd038f5ccb --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/2c903b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn sin_2c903b() { + var res : vec3 = sin(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_2c903b(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_2c903b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_2c903b(); +} diff --git a/test/tint/builtins/gen/literal/sin/3cca11.wgsl b/test/tint/builtins/gen/literal/sin/3cca11.wgsl new file mode 100644 index 0000000000..527f92b51d --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/3cca11.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sin(vec<2, f16>) -> vec<2, f16> +fn sin_3cca11() { + var res: vec2 = sin(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_3cca11(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_3cca11(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_3cca11(); +} diff --git a/test/tint/builtins/gen/literal/sin/3cca11.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sin/3cca11.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2f44faab03 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/3cca11.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sin_3cca11() { + vector res = sin((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_3cca11(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_3cca11(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_3cca11(); + return; +} diff --git a/test/tint/builtins/gen/literal/sin/3cca11.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sin/3cca11.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..38960b621f --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/3cca11.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void sin_3cca11() { + vector res = sin((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_3cca11(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_3cca11(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_3cca11(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000025136111160(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/sin/3cca11.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sin/3cca11.wgsl.expected.glsl new file mode 100644 index 0000000000..3d2c148fdd --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/3cca11.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sin_3cca11() { + f16vec2 res = sin(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + sin_3cca11(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sin_3cca11() { + f16vec2 res = sin(f16vec2(0.0hf)); +} + +void fragment_main() { + sin_3cca11(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sin_3cca11() { + f16vec2 res = sin(f16vec2(0.0hf)); +} + +void compute_main() { + sin_3cca11(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sin/3cca11.wgsl.expected.msl b/test/tint/builtins/gen/literal/sin/3cca11.wgsl.expected.msl new file mode 100644 index 0000000000..0e631c7a6e --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/3cca11.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sin_3cca11() { + half2 res = sin(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sin_3cca11(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sin_3cca11(); + return; +} + +kernel void compute_main() { + sin_3cca11(); + return; +} + diff --git a/test/tint/builtins/gen/literal/sin/3cca11.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sin/3cca11.wgsl.expected.spvasm new file mode 100644 index 0000000000..f80895e250 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/3cca11.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sin_3cca11 "sin_3cca11" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %sin_3cca11 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Sin %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %sin_3cca11 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %sin_3cca11 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %sin_3cca11 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/sin/3cca11.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sin/3cca11.wgsl.expected.wgsl new file mode 100644 index 0000000000..31f967aeb6 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/3cca11.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn sin_3cca11() { + var res : vec2 = sin(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_3cca11(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_3cca11(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_3cca11(); +} diff --git a/test/tint/builtins/gen/literal/sin/5c0712.wgsl b/test/tint/builtins/gen/literal/sin/5c0712.wgsl new file mode 100644 index 0000000000..8a165443a1 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/5c0712.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sin(vec<4, f16>) -> vec<4, f16> +fn sin_5c0712() { + var res: vec4 = sin(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_5c0712(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_5c0712(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_5c0712(); +} diff --git a/test/tint/builtins/gen/literal/sin/5c0712.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sin/5c0712.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ffc0c91d1a --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/5c0712.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sin_5c0712() { + vector res = sin((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_5c0712(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_5c0712(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_5c0712(); + return; +} diff --git a/test/tint/builtins/gen/literal/sin/5c0712.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sin/5c0712.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..26e763ad5f --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/5c0712.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void sin_5c0712() { + vector res = sin((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_5c0712(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_5c0712(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_5c0712(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001FE3DAE1580(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/sin/5c0712.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sin/5c0712.wgsl.expected.glsl new file mode 100644 index 0000000000..c16ccdff21 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/5c0712.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sin_5c0712() { + f16vec4 res = sin(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + sin_5c0712(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sin_5c0712() { + f16vec4 res = sin(f16vec4(0.0hf)); +} + +void fragment_main() { + sin_5c0712(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sin_5c0712() { + f16vec4 res = sin(f16vec4(0.0hf)); +} + +void compute_main() { + sin_5c0712(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sin/5c0712.wgsl.expected.msl b/test/tint/builtins/gen/literal/sin/5c0712.wgsl.expected.msl new file mode 100644 index 0000000000..93932368b7 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/5c0712.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sin_5c0712() { + half4 res = sin(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sin_5c0712(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sin_5c0712(); + return; +} + +kernel void compute_main() { + sin_5c0712(); + return; +} + diff --git a/test/tint/builtins/gen/literal/sin/5c0712.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sin/5c0712.wgsl.expected.spvasm new file mode 100644 index 0000000000..5060ea847d --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/5c0712.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sin_5c0712 "sin_5c0712" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %sin_5c0712 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Sin %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %sin_5c0712 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %sin_5c0712 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %sin_5c0712 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/sin/5c0712.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sin/5c0712.wgsl.expected.wgsl new file mode 100644 index 0000000000..451cac035d --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/5c0712.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn sin_5c0712() { + var res : vec4 = sin(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_5c0712(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_5c0712(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_5c0712(); +} diff --git a/test/tint/builtins/gen/literal/sin/66a59f.wgsl b/test/tint/builtins/gen/literal/sin/66a59f.wgsl new file mode 100644 index 0000000000..9f69a70f52 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/66a59f.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sin(f16) -> f16 +fn sin_66a59f() { + var res: f16 = sin(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_66a59f(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_66a59f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_66a59f(); +} diff --git a/test/tint/builtins/gen/literal/sin/66a59f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sin/66a59f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..dbb0994a40 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/66a59f.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sin_66a59f() { + float16_t res = sin(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_66a59f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_66a59f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_66a59f(); + return; +} diff --git a/test/tint/builtins/gen/literal/sin/66a59f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sin/66a59f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f6b54ff13a --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/66a59f.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void sin_66a59f() { + float16_t res = sin(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_66a59f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_66a59f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_66a59f(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002CA5CAC0100(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002CA5CAC0100(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/sin/66a59f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sin/66a59f.wgsl.expected.glsl new file mode 100644 index 0000000000..dc6b376a82 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/66a59f.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sin_66a59f() { + float16_t res = sin(0.0hf); +} + +vec4 vertex_main() { + sin_66a59f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sin_66a59f() { + float16_t res = sin(0.0hf); +} + +void fragment_main() { + sin_66a59f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sin_66a59f() { + float16_t res = sin(0.0hf); +} + +void compute_main() { + sin_66a59f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sin/66a59f.wgsl.expected.msl b/test/tint/builtins/gen/literal/sin/66a59f.wgsl.expected.msl new file mode 100644 index 0000000000..8204eec080 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/66a59f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sin_66a59f() { + half res = sin(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sin_66a59f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sin_66a59f(); + return; +} + +kernel void compute_main() { + sin_66a59f(); + return; +} + diff --git a/test/tint/builtins/gen/literal/sin/66a59f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sin/66a59f.wgsl.expected.spvasm new file mode 100644 index 0000000000..19a2e294c9 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/66a59f.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sin_66a59f "sin_66a59f" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %sin_66a59f = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Sin %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %sin_66a59f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %sin_66a59f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sin_66a59f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/sin/66a59f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sin/66a59f.wgsl.expected.wgsl new file mode 100644 index 0000000000..afb239be2c --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/66a59f.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn sin_66a59f() { + var res : f16 = sin(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_66a59f(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_66a59f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_66a59f(); +} diff --git a/test/tint/builtins/gen/literal/sinh/0908c1.wgsl b/test/tint/builtins/gen/literal/sinh/0908c1.wgsl new file mode 100644 index 0000000000..dc47091224 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/0908c1.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sinh(vec<3, f16>) -> vec<3, f16> +fn sinh_0908c1() { + var res: vec3 = sinh(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_0908c1(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_0908c1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_0908c1(); +} diff --git a/test/tint/builtins/gen/literal/sinh/0908c1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sinh/0908c1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..797d893b31 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/0908c1.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sinh_0908c1() { + vector res = sinh((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_0908c1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_0908c1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_0908c1(); + return; +} diff --git a/test/tint/builtins/gen/literal/sinh/0908c1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sinh/0908c1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cac1c4b7b2 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/0908c1.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void sinh_0908c1() { + vector res = sinh((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_0908c1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_0908c1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_0908c1(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E72E75B6A0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/sinh/0908c1.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sinh/0908c1.wgsl.expected.glsl new file mode 100644 index 0000000000..6130c64bdf --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/0908c1.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sinh_0908c1() { + f16vec3 res = sinh(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + sinh_0908c1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sinh_0908c1() { + f16vec3 res = sinh(f16vec3(0.0hf)); +} + +void fragment_main() { + sinh_0908c1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sinh_0908c1() { + f16vec3 res = sinh(f16vec3(0.0hf)); +} + +void compute_main() { + sinh_0908c1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sinh/0908c1.wgsl.expected.msl b/test/tint/builtins/gen/literal/sinh/0908c1.wgsl.expected.msl new file mode 100644 index 0000000000..5da508a32b --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/0908c1.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sinh_0908c1() { + half3 res = sinh(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sinh_0908c1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sinh_0908c1(); + return; +} + +kernel void compute_main() { + sinh_0908c1(); + return; +} + diff --git a/test/tint/builtins/gen/literal/sinh/0908c1.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sinh/0908c1.wgsl.expected.spvasm new file mode 100644 index 0000000000..62c27636c0 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/0908c1.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sinh_0908c1 "sinh_0908c1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sinh_0908c1 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Sinh %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %sinh_0908c1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %sinh_0908c1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %sinh_0908c1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/sinh/0908c1.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sinh/0908c1.wgsl.expected.wgsl new file mode 100644 index 0000000000..f583b1084f --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/0908c1.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn sinh_0908c1() { + var res : vec3 = sinh(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_0908c1(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_0908c1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_0908c1(); +} diff --git a/test/tint/builtins/gen/literal/sinh/69cce2.wgsl b/test/tint/builtins/gen/literal/sinh/69cce2.wgsl new file mode 100644 index 0000000000..ad511365a4 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/69cce2.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sinh(f16) -> f16 +fn sinh_69cce2() { + var res: f16 = sinh(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_69cce2(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_69cce2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_69cce2(); +} diff --git a/test/tint/builtins/gen/literal/sinh/69cce2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sinh/69cce2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..277210691e --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/69cce2.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sinh_69cce2() { + float16_t res = sinh(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_69cce2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_69cce2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_69cce2(); + return; +} diff --git a/test/tint/builtins/gen/literal/sinh/69cce2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sinh/69cce2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4dca58e241 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/69cce2.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void sinh_69cce2() { + float16_t res = sinh(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_69cce2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_69cce2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_69cce2(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001EB249D0520(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001EB249D0520(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/sinh/69cce2.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sinh/69cce2.wgsl.expected.glsl new file mode 100644 index 0000000000..4b0c3e4301 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/69cce2.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sinh_69cce2() { + float16_t res = sinh(0.0hf); +} + +vec4 vertex_main() { + sinh_69cce2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sinh_69cce2() { + float16_t res = sinh(0.0hf); +} + +void fragment_main() { + sinh_69cce2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sinh_69cce2() { + float16_t res = sinh(0.0hf); +} + +void compute_main() { + sinh_69cce2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sinh/69cce2.wgsl.expected.msl b/test/tint/builtins/gen/literal/sinh/69cce2.wgsl.expected.msl new file mode 100644 index 0000000000..5fada226f8 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/69cce2.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sinh_69cce2() { + half res = sinh(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sinh_69cce2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sinh_69cce2(); + return; +} + +kernel void compute_main() { + sinh_69cce2(); + return; +} + diff --git a/test/tint/builtins/gen/literal/sinh/69cce2.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sinh/69cce2.wgsl.expected.spvasm new file mode 100644 index 0000000000..994f5e4ddb --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/69cce2.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sinh_69cce2 "sinh_69cce2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sinh_69cce2 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Sinh %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %sinh_69cce2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %sinh_69cce2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sinh_69cce2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/sinh/69cce2.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sinh/69cce2.wgsl.expected.wgsl new file mode 100644 index 0000000000..8defcbd6d8 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/69cce2.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn sinh_69cce2() { + var res : f16 = sinh(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_69cce2(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_69cce2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_69cce2(); +} diff --git a/test/tint/builtins/gen/literal/sinh/924f19.wgsl b/test/tint/builtins/gen/literal/sinh/924f19.wgsl new file mode 100644 index 0000000000..09ce2eefea --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/924f19.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sinh(vec<2, f16>) -> vec<2, f16> +fn sinh_924f19() { + var res: vec2 = sinh(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_924f19(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_924f19(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_924f19(); +} diff --git a/test/tint/builtins/gen/literal/sinh/924f19.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sinh/924f19.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e79ca20fb6 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/924f19.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sinh_924f19() { + vector res = sinh((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_924f19(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_924f19(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_924f19(); + return; +} diff --git a/test/tint/builtins/gen/literal/sinh/924f19.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sinh/924f19.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..357854dd3e --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/924f19.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void sinh_924f19() { + vector res = sinh((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_924f19(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_924f19(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_924f19(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000019A6900E9E0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/sinh/924f19.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sinh/924f19.wgsl.expected.glsl new file mode 100644 index 0000000000..844c7ecb17 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/924f19.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sinh_924f19() { + f16vec2 res = sinh(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + sinh_924f19(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sinh_924f19() { + f16vec2 res = sinh(f16vec2(0.0hf)); +} + +void fragment_main() { + sinh_924f19(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sinh_924f19() { + f16vec2 res = sinh(f16vec2(0.0hf)); +} + +void compute_main() { + sinh_924f19(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sinh/924f19.wgsl.expected.msl b/test/tint/builtins/gen/literal/sinh/924f19.wgsl.expected.msl new file mode 100644 index 0000000000..48d04aefd7 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/924f19.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sinh_924f19() { + half2 res = sinh(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sinh_924f19(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sinh_924f19(); + return; +} + +kernel void compute_main() { + sinh_924f19(); + return; +} + diff --git a/test/tint/builtins/gen/literal/sinh/924f19.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sinh/924f19.wgsl.expected.spvasm new file mode 100644 index 0000000000..5f2db5eca2 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/924f19.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sinh_924f19 "sinh_924f19" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sinh_924f19 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Sinh %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %sinh_924f19 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %sinh_924f19 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %sinh_924f19 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/sinh/924f19.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sinh/924f19.wgsl.expected.wgsl new file mode 100644 index 0000000000..d384cab96e --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/924f19.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn sinh_924f19() { + var res : vec2 = sinh(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_924f19(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_924f19(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_924f19(); +} diff --git a/test/tint/builtins/gen/literal/sinh/ba7e25.wgsl b/test/tint/builtins/gen/literal/sinh/ba7e25.wgsl new file mode 100644 index 0000000000..878d0b6855 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/ba7e25.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sinh(vec<4, f16>) -> vec<4, f16> +fn sinh_ba7e25() { + var res: vec4 = sinh(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_ba7e25(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_ba7e25(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_ba7e25(); +} diff --git a/test/tint/builtins/gen/literal/sinh/ba7e25.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sinh/ba7e25.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..87cbff08d4 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/ba7e25.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sinh_ba7e25() { + vector res = sinh((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_ba7e25(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_ba7e25(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_ba7e25(); + return; +} diff --git a/test/tint/builtins/gen/literal/sinh/ba7e25.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sinh/ba7e25.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1100cab8f7 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/ba7e25.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void sinh_ba7e25() { + vector res = sinh((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_ba7e25(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_ba7e25(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_ba7e25(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024997A21160(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/sinh/ba7e25.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sinh/ba7e25.wgsl.expected.glsl new file mode 100644 index 0000000000..61015c09a8 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/ba7e25.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sinh_ba7e25() { + f16vec4 res = sinh(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + sinh_ba7e25(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sinh_ba7e25() { + f16vec4 res = sinh(f16vec4(0.0hf)); +} + +void fragment_main() { + sinh_ba7e25(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sinh_ba7e25() { + f16vec4 res = sinh(f16vec4(0.0hf)); +} + +void compute_main() { + sinh_ba7e25(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sinh/ba7e25.wgsl.expected.msl b/test/tint/builtins/gen/literal/sinh/ba7e25.wgsl.expected.msl new file mode 100644 index 0000000000..9aef6b3f81 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/ba7e25.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sinh_ba7e25() { + half4 res = sinh(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sinh_ba7e25(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sinh_ba7e25(); + return; +} + +kernel void compute_main() { + sinh_ba7e25(); + return; +} + diff --git a/test/tint/builtins/gen/literal/sinh/ba7e25.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sinh/ba7e25.wgsl.expected.spvasm new file mode 100644 index 0000000000..3e9f2c01a9 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/ba7e25.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sinh_ba7e25 "sinh_ba7e25" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sinh_ba7e25 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Sinh %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %sinh_ba7e25 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %sinh_ba7e25 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %sinh_ba7e25 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/sinh/ba7e25.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sinh/ba7e25.wgsl.expected.wgsl new file mode 100644 index 0000000000..9587e3ea32 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/ba7e25.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn sinh_ba7e25() { + var res : vec4 = sinh(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_ba7e25(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_ba7e25(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_ba7e25(); +} diff --git a/test/tint/builtins/gen/literal/smoothstep/12c031.wgsl b/test/tint/builtins/gen/literal/smoothstep/12c031.wgsl new file mode 100644 index 0000000000..a6bdd56d88 --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/12c031.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn smoothstep(vec<2, f16>, vec<2, f16>, vec<2, f16>) -> vec<2, f16> +fn smoothstep_12c031() { + var res: vec2 = smoothstep(vec2(f16()), vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_12c031(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_12c031(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_12c031(); +} diff --git a/test/tint/builtins/gen/literal/smoothstep/12c031.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/smoothstep/12c031.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..836c5b9cfd --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/12c031.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void smoothstep_12c031() { + vector res = smoothstep((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_12c031(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_12c031(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_12c031(); + return; +} diff --git a/test/tint/builtins/gen/literal/smoothstep/12c031.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/smoothstep/12c031.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ab2bc4c6d8 --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/12c031.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void smoothstep_12c031() { + vector res = smoothstep((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_12c031(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_12c031(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_12c031(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000298CE8896B0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/smoothstep/12c031.wgsl.expected.glsl b/test/tint/builtins/gen/literal/smoothstep/12c031.wgsl.expected.glsl new file mode 100644 index 0000000000..64a110fb30 --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/12c031.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void smoothstep_12c031() { + f16vec2 res = smoothstep(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf)); +} + +vec4 vertex_main() { + smoothstep_12c031(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void smoothstep_12c031() { + f16vec2 res = smoothstep(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf)); +} + +void fragment_main() { + smoothstep_12c031(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void smoothstep_12c031() { + f16vec2 res = smoothstep(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf)); +} + +void compute_main() { + smoothstep_12c031(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/smoothstep/12c031.wgsl.expected.msl b/test/tint/builtins/gen/literal/smoothstep/12c031.wgsl.expected.msl new file mode 100644 index 0000000000..1f30e7c3fd --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/12c031.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void smoothstep_12c031() { + half2 res = smoothstep(half2(0.0h), half2(0.0h), half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + smoothstep_12c031(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + smoothstep_12c031(); + return; +} + +kernel void compute_main() { + smoothstep_12c031(); + return; +} + diff --git a/test/tint/builtins/gen/literal/smoothstep/12c031.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/smoothstep/12c031.wgsl.expected.spvasm new file mode 100644 index 0000000000..aaaee6ec8d --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/12c031.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %smoothstep_12c031 "smoothstep_12c031" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%smoothstep_12c031 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 SmoothStep %17 %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %smoothstep_12c031 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %smoothstep_12c031 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %smoothstep_12c031 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/smoothstep/12c031.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/smoothstep/12c031.wgsl.expected.wgsl new file mode 100644 index 0000000000..62ad2a7faa --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/12c031.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn smoothstep_12c031() { + var res : vec2 = smoothstep(vec2(f16()), vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_12c031(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_12c031(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_12c031(); +} diff --git a/test/tint/builtins/gen/literal/smoothstep/586e12.wgsl b/test/tint/builtins/gen/literal/smoothstep/586e12.wgsl new file mode 100644 index 0000000000..d9e1447032 --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/586e12.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn smoothstep(f16, f16, f16) -> f16 +fn smoothstep_586e12() { + var res: f16 = smoothstep(f16(), f16(), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_586e12(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_586e12(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_586e12(); +} diff --git a/test/tint/builtins/gen/literal/smoothstep/586e12.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/smoothstep/586e12.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0a0bb8a122 --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/586e12.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void smoothstep_586e12() { + float16_t res = smoothstep(float16_t(0.0h), float16_t(0.0h), float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_586e12(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_586e12(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_586e12(); + return; +} diff --git a/test/tint/builtins/gen/literal/smoothstep/586e12.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/smoothstep/586e12.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ac1f9151ef --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/586e12.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void smoothstep_586e12() { + float16_t res = smoothstep(float16_t(0.0h), float16_t(0.0h), float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_586e12(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_586e12(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_586e12(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000272E8A60100(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000272E8A60100(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/smoothstep/586e12.wgsl.expected.glsl b/test/tint/builtins/gen/literal/smoothstep/586e12.wgsl.expected.glsl new file mode 100644 index 0000000000..26afc28c2e --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/586e12.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void smoothstep_586e12() { + float16_t res = smoothstep(0.0hf, 0.0hf, 0.0hf); +} + +vec4 vertex_main() { + smoothstep_586e12(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void smoothstep_586e12() { + float16_t res = smoothstep(0.0hf, 0.0hf, 0.0hf); +} + +void fragment_main() { + smoothstep_586e12(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void smoothstep_586e12() { + float16_t res = smoothstep(0.0hf, 0.0hf, 0.0hf); +} + +void compute_main() { + smoothstep_586e12(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/smoothstep/586e12.wgsl.expected.msl b/test/tint/builtins/gen/literal/smoothstep/586e12.wgsl.expected.msl new file mode 100644 index 0000000000..a6a9fb3edb --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/586e12.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void smoothstep_586e12() { + half res = smoothstep(0.0h, 0.0h, 0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + smoothstep_586e12(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + smoothstep_586e12(); + return; +} + +kernel void compute_main() { + smoothstep_586e12(); + return; +} + diff --git a/test/tint/builtins/gen/literal/smoothstep/586e12.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/smoothstep/586e12.wgsl.expected.spvasm new file mode 100644 index 0000000000..38ef86f565 --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/586e12.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %smoothstep_586e12 "smoothstep_586e12" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%smoothstep_586e12 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 SmoothStep %16 %16 %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %smoothstep_586e12 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %smoothstep_586e12 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %smoothstep_586e12 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/smoothstep/586e12.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/smoothstep/586e12.wgsl.expected.wgsl new file mode 100644 index 0000000000..e6600ae495 --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/586e12.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn smoothstep_586e12() { + var res : f16 = smoothstep(f16(), f16(), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_586e12(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_586e12(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_586e12(); +} diff --git a/test/tint/builtins/gen/literal/smoothstep/6e7a74.wgsl b/test/tint/builtins/gen/literal/smoothstep/6e7a74.wgsl new file mode 100644 index 0000000000..4fdbd51a17 --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/6e7a74.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn smoothstep(vec<3, f16>, vec<3, f16>, vec<3, f16>) -> vec<3, f16> +fn smoothstep_6e7a74() { + var res: vec3 = smoothstep(vec3(f16()), vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_6e7a74(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_6e7a74(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_6e7a74(); +} diff --git a/test/tint/builtins/gen/literal/smoothstep/6e7a74.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/smoothstep/6e7a74.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f1869c2f0a --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/6e7a74.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void smoothstep_6e7a74() { + vector res = smoothstep((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_6e7a74(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_6e7a74(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_6e7a74(); + return; +} diff --git a/test/tint/builtins/gen/literal/smoothstep/6e7a74.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/smoothstep/6e7a74.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9837ccc3d3 --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/6e7a74.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void smoothstep_6e7a74() { + vector res = smoothstep((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_6e7a74(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_6e7a74(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_6e7a74(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000023CD6C4BC30(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/smoothstep/6e7a74.wgsl.expected.glsl b/test/tint/builtins/gen/literal/smoothstep/6e7a74.wgsl.expected.glsl new file mode 100644 index 0000000000..12129b7acb --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/6e7a74.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void smoothstep_6e7a74() { + f16vec3 res = smoothstep(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf)); +} + +vec4 vertex_main() { + smoothstep_6e7a74(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void smoothstep_6e7a74() { + f16vec3 res = smoothstep(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf)); +} + +void fragment_main() { + smoothstep_6e7a74(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void smoothstep_6e7a74() { + f16vec3 res = smoothstep(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf)); +} + +void compute_main() { + smoothstep_6e7a74(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/smoothstep/6e7a74.wgsl.expected.msl b/test/tint/builtins/gen/literal/smoothstep/6e7a74.wgsl.expected.msl new file mode 100644 index 0000000000..d90125c05d --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/6e7a74.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void smoothstep_6e7a74() { + half3 res = smoothstep(half3(0.0h), half3(0.0h), half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + smoothstep_6e7a74(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + smoothstep_6e7a74(); + return; +} + +kernel void compute_main() { + smoothstep_6e7a74(); + return; +} + diff --git a/test/tint/builtins/gen/literal/smoothstep/6e7a74.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/smoothstep/6e7a74.wgsl.expected.spvasm new file mode 100644 index 0000000000..21d9c28463 --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/6e7a74.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %smoothstep_6e7a74 "smoothstep_6e7a74" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%smoothstep_6e7a74 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 SmoothStep %17 %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %smoothstep_6e7a74 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %smoothstep_6e7a74 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %smoothstep_6e7a74 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/smoothstep/6e7a74.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/smoothstep/6e7a74.wgsl.expected.wgsl new file mode 100644 index 0000000000..1a7ea0defd --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/6e7a74.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn smoothstep_6e7a74() { + var res : vec3 = smoothstep(vec3(f16()), vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_6e7a74(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_6e7a74(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_6e7a74(); +} diff --git a/test/tint/builtins/gen/literal/smoothstep/c43ebd.wgsl b/test/tint/builtins/gen/literal/smoothstep/c43ebd.wgsl new file mode 100644 index 0000000000..e1de207f74 --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/c43ebd.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn smoothstep(vec<4, f16>, vec<4, f16>, vec<4, f16>) -> vec<4, f16> +fn smoothstep_c43ebd() { + var res: vec4 = smoothstep(vec4(f16()), vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_c43ebd(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_c43ebd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_c43ebd(); +} diff --git a/test/tint/builtins/gen/literal/smoothstep/c43ebd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/smoothstep/c43ebd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e25a8cd277 --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/c43ebd.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void smoothstep_c43ebd() { + vector res = smoothstep((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_c43ebd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_c43ebd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_c43ebd(); + return; +} diff --git a/test/tint/builtins/gen/literal/smoothstep/c43ebd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/smoothstep/c43ebd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..92388b8c9d --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/c43ebd.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void smoothstep_c43ebd() { + vector res = smoothstep((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_c43ebd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_c43ebd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_c43ebd(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000023328C496C0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/smoothstep/c43ebd.wgsl.expected.glsl b/test/tint/builtins/gen/literal/smoothstep/c43ebd.wgsl.expected.glsl new file mode 100644 index 0000000000..b67a5c869d --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/c43ebd.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void smoothstep_c43ebd() { + f16vec4 res = smoothstep(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf)); +} + +vec4 vertex_main() { + smoothstep_c43ebd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void smoothstep_c43ebd() { + f16vec4 res = smoothstep(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf)); +} + +void fragment_main() { + smoothstep_c43ebd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void smoothstep_c43ebd() { + f16vec4 res = smoothstep(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf)); +} + +void compute_main() { + smoothstep_c43ebd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/smoothstep/c43ebd.wgsl.expected.msl b/test/tint/builtins/gen/literal/smoothstep/c43ebd.wgsl.expected.msl new file mode 100644 index 0000000000..c7743d734e --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/c43ebd.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void smoothstep_c43ebd() { + half4 res = smoothstep(half4(0.0h), half4(0.0h), half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + smoothstep_c43ebd(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + smoothstep_c43ebd(); + return; +} + +kernel void compute_main() { + smoothstep_c43ebd(); + return; +} + diff --git a/test/tint/builtins/gen/literal/smoothstep/c43ebd.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/smoothstep/c43ebd.wgsl.expected.spvasm new file mode 100644 index 0000000000..9230951f9e --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/c43ebd.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %smoothstep_c43ebd "smoothstep_c43ebd" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%smoothstep_c43ebd = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 SmoothStep %17 %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %smoothstep_c43ebd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %smoothstep_c43ebd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %smoothstep_c43ebd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/smoothstep/c43ebd.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/smoothstep/c43ebd.wgsl.expected.wgsl new file mode 100644 index 0000000000..1b6b725f47 --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/c43ebd.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn smoothstep_c43ebd() { + var res : vec4 = smoothstep(vec4(f16()), vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_c43ebd(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_c43ebd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_c43ebd(); +} diff --git a/test/tint/builtins/gen/literal/sqrt/803d1c.wgsl b/test/tint/builtins/gen/literal/sqrt/803d1c.wgsl new file mode 100644 index 0000000000..019539d0a3 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/803d1c.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sqrt(vec<4, f16>) -> vec<4, f16> +fn sqrt_803d1c() { + var res: vec4 = sqrt(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_803d1c(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_803d1c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_803d1c(); +} diff --git a/test/tint/builtins/gen/literal/sqrt/803d1c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sqrt/803d1c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0b44b8957d --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/803d1c.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sqrt_803d1c() { + vector res = sqrt((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_803d1c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_803d1c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_803d1c(); + return; +} diff --git a/test/tint/builtins/gen/literal/sqrt/803d1c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sqrt/803d1c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..56a24535bb --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/803d1c.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void sqrt_803d1c() { + vector res = sqrt((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_803d1c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_803d1c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_803d1c(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002342D12DCF0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/sqrt/803d1c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sqrt/803d1c.wgsl.expected.glsl new file mode 100644 index 0000000000..2b0c4f5f72 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/803d1c.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sqrt_803d1c() { + f16vec4 res = sqrt(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + sqrt_803d1c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sqrt_803d1c() { + f16vec4 res = sqrt(f16vec4(0.0hf)); +} + +void fragment_main() { + sqrt_803d1c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sqrt_803d1c() { + f16vec4 res = sqrt(f16vec4(0.0hf)); +} + +void compute_main() { + sqrt_803d1c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sqrt/803d1c.wgsl.expected.msl b/test/tint/builtins/gen/literal/sqrt/803d1c.wgsl.expected.msl new file mode 100644 index 0000000000..c85c1aed5b --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/803d1c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sqrt_803d1c() { + half4 res = sqrt(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sqrt_803d1c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sqrt_803d1c(); + return; +} + +kernel void compute_main() { + sqrt_803d1c(); + return; +} + diff --git a/test/tint/builtins/gen/literal/sqrt/803d1c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sqrt/803d1c.wgsl.expected.spvasm new file mode 100644 index 0000000000..3204761691 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/803d1c.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sqrt_803d1c "sqrt_803d1c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sqrt_803d1c = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Sqrt %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %sqrt_803d1c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %sqrt_803d1c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %sqrt_803d1c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/sqrt/803d1c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sqrt/803d1c.wgsl.expected.wgsl new file mode 100644 index 0000000000..3361e6057e --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/803d1c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn sqrt_803d1c() { + var res : vec4 = sqrt(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_803d1c(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_803d1c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_803d1c(); +} diff --git a/test/tint/builtins/gen/literal/sqrt/895a0c.wgsl b/test/tint/builtins/gen/literal/sqrt/895a0c.wgsl new file mode 100644 index 0000000000..7bdb02fc19 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/895a0c.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sqrt(vec<3, f16>) -> vec<3, f16> +fn sqrt_895a0c() { + var res: vec3 = sqrt(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_895a0c(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_895a0c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_895a0c(); +} diff --git a/test/tint/builtins/gen/literal/sqrt/895a0c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sqrt/895a0c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3ce6e95780 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/895a0c.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sqrt_895a0c() { + vector res = sqrt((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_895a0c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_895a0c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_895a0c(); + return; +} diff --git a/test/tint/builtins/gen/literal/sqrt/895a0c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sqrt/895a0c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8d0d057b08 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/895a0c.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void sqrt_895a0c() { + vector res = sqrt((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_895a0c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_895a0c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_895a0c(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001FD1487D710(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/sqrt/895a0c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sqrt/895a0c.wgsl.expected.glsl new file mode 100644 index 0000000000..d0cedab89a --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/895a0c.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sqrt_895a0c() { + f16vec3 res = sqrt(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + sqrt_895a0c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sqrt_895a0c() { + f16vec3 res = sqrt(f16vec3(0.0hf)); +} + +void fragment_main() { + sqrt_895a0c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sqrt_895a0c() { + f16vec3 res = sqrt(f16vec3(0.0hf)); +} + +void compute_main() { + sqrt_895a0c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sqrt/895a0c.wgsl.expected.msl b/test/tint/builtins/gen/literal/sqrt/895a0c.wgsl.expected.msl new file mode 100644 index 0000000000..72be3e1f96 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/895a0c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sqrt_895a0c() { + half3 res = sqrt(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sqrt_895a0c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sqrt_895a0c(); + return; +} + +kernel void compute_main() { + sqrt_895a0c(); + return; +} + diff --git a/test/tint/builtins/gen/literal/sqrt/895a0c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sqrt/895a0c.wgsl.expected.spvasm new file mode 100644 index 0000000000..bcc0768f43 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/895a0c.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sqrt_895a0c "sqrt_895a0c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sqrt_895a0c = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Sqrt %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %sqrt_895a0c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %sqrt_895a0c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %sqrt_895a0c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/sqrt/895a0c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sqrt/895a0c.wgsl.expected.wgsl new file mode 100644 index 0000000000..44c3686023 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/895a0c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn sqrt_895a0c() { + var res : vec3 = sqrt(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_895a0c(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_895a0c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_895a0c(); +} diff --git a/test/tint/builtins/gen/literal/sqrt/d9ab4d.wgsl b/test/tint/builtins/gen/literal/sqrt/d9ab4d.wgsl new file mode 100644 index 0000000000..4158a6f7f8 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/d9ab4d.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sqrt(vec<2, f16>) -> vec<2, f16> +fn sqrt_d9ab4d() { + var res: vec2 = sqrt(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_d9ab4d(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_d9ab4d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_d9ab4d(); +} diff --git a/test/tint/builtins/gen/literal/sqrt/d9ab4d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sqrt/d9ab4d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..dc9426f224 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/d9ab4d.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sqrt_d9ab4d() { + vector res = sqrt((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_d9ab4d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_d9ab4d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_d9ab4d(); + return; +} diff --git a/test/tint/builtins/gen/literal/sqrt/d9ab4d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sqrt/d9ab4d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a2088d6477 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/d9ab4d.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void sqrt_d9ab4d() { + vector res = sqrt((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_d9ab4d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_d9ab4d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_d9ab4d(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000256F2C5EAF0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/sqrt/d9ab4d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sqrt/d9ab4d.wgsl.expected.glsl new file mode 100644 index 0000000000..8a12e8fd13 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/d9ab4d.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sqrt_d9ab4d() { + f16vec2 res = sqrt(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + sqrt_d9ab4d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sqrt_d9ab4d() { + f16vec2 res = sqrt(f16vec2(0.0hf)); +} + +void fragment_main() { + sqrt_d9ab4d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sqrt_d9ab4d() { + f16vec2 res = sqrt(f16vec2(0.0hf)); +} + +void compute_main() { + sqrt_d9ab4d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sqrt/d9ab4d.wgsl.expected.msl b/test/tint/builtins/gen/literal/sqrt/d9ab4d.wgsl.expected.msl new file mode 100644 index 0000000000..d64d5a1e45 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/d9ab4d.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sqrt_d9ab4d() { + half2 res = sqrt(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sqrt_d9ab4d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sqrt_d9ab4d(); + return; +} + +kernel void compute_main() { + sqrt_d9ab4d(); + return; +} + diff --git a/test/tint/builtins/gen/literal/sqrt/d9ab4d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sqrt/d9ab4d.wgsl.expected.spvasm new file mode 100644 index 0000000000..d18a25136a --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/d9ab4d.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sqrt_d9ab4d "sqrt_d9ab4d" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sqrt_d9ab4d = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Sqrt %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %sqrt_d9ab4d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %sqrt_d9ab4d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %sqrt_d9ab4d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/sqrt/d9ab4d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sqrt/d9ab4d.wgsl.expected.wgsl new file mode 100644 index 0000000000..ccda9f1474 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/d9ab4d.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn sqrt_d9ab4d() { + var res : vec2 = sqrt(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_d9ab4d(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_d9ab4d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_d9ab4d(); +} diff --git a/test/tint/builtins/gen/literal/sqrt/ec33e9.wgsl b/test/tint/builtins/gen/literal/sqrt/ec33e9.wgsl new file mode 100644 index 0000000000..4dc19b0efa --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/ec33e9.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sqrt(f16) -> f16 +fn sqrt_ec33e9() { + var res: f16 = sqrt(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_ec33e9(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_ec33e9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_ec33e9(); +} diff --git a/test/tint/builtins/gen/literal/sqrt/ec33e9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sqrt/ec33e9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c76014e52a --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/ec33e9.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sqrt_ec33e9() { + float16_t res = sqrt(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_ec33e9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_ec33e9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_ec33e9(); + return; +} diff --git a/test/tint/builtins/gen/literal/sqrt/ec33e9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sqrt/ec33e9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..71be999b61 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/ec33e9.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void sqrt_ec33e9() { + float16_t res = sqrt(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_ec33e9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_ec33e9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_ec33e9(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C2CF8D7D20(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C2CF8D7D20(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/sqrt/ec33e9.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sqrt/ec33e9.wgsl.expected.glsl new file mode 100644 index 0000000000..89b0d09846 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/ec33e9.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sqrt_ec33e9() { + float16_t res = sqrt(0.0hf); +} + +vec4 vertex_main() { + sqrt_ec33e9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sqrt_ec33e9() { + float16_t res = sqrt(0.0hf); +} + +void fragment_main() { + sqrt_ec33e9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sqrt_ec33e9() { + float16_t res = sqrt(0.0hf); +} + +void compute_main() { + sqrt_ec33e9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sqrt/ec33e9.wgsl.expected.msl b/test/tint/builtins/gen/literal/sqrt/ec33e9.wgsl.expected.msl new file mode 100644 index 0000000000..bfd3d49f8c --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/ec33e9.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sqrt_ec33e9() { + half res = sqrt(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sqrt_ec33e9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sqrt_ec33e9(); + return; +} + +kernel void compute_main() { + sqrt_ec33e9(); + return; +} + diff --git a/test/tint/builtins/gen/literal/sqrt/ec33e9.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sqrt/ec33e9.wgsl.expected.spvasm new file mode 100644 index 0000000000..a39a404a73 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/ec33e9.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sqrt_ec33e9 "sqrt_ec33e9" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sqrt_ec33e9 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Sqrt %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %sqrt_ec33e9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %sqrt_ec33e9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sqrt_ec33e9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/sqrt/ec33e9.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sqrt/ec33e9.wgsl.expected.wgsl new file mode 100644 index 0000000000..5145314430 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/ec33e9.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn sqrt_ec33e9() { + var res : f16 = sqrt(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_ec33e9(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_ec33e9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_ec33e9(); +} diff --git a/test/tint/builtins/gen/literal/step/07cb06.wgsl b/test/tint/builtins/gen/literal/step/07cb06.wgsl new file mode 100644 index 0000000000..2baa12b0e7 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/07cb06.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn step(vec<2, f16>, vec<2, f16>) -> vec<2, f16> +fn step_07cb06() { + var res: vec2 = step(vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_07cb06(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_07cb06(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_07cb06(); +} diff --git a/test/tint/builtins/gen/literal/step/07cb06.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/step/07cb06.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ae74c4e438 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/07cb06.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void step_07cb06() { + vector res = step((float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_07cb06(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_07cb06(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_07cb06(); + return; +} diff --git a/test/tint/builtins/gen/literal/step/07cb06.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/step/07cb06.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9be89573dd --- /dev/null +++ b/test/tint/builtins/gen/literal/step/07cb06.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void step_07cb06() { + vector res = step((float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_07cb06(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_07cb06(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_07cb06(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000190D7A566C0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/step/07cb06.wgsl.expected.glsl b/test/tint/builtins/gen/literal/step/07cb06.wgsl.expected.glsl new file mode 100644 index 0000000000..fd5c470e6d --- /dev/null +++ b/test/tint/builtins/gen/literal/step/07cb06.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void step_07cb06() { + f16vec2 res = step(f16vec2(0.0hf), f16vec2(0.0hf)); +} + +vec4 vertex_main() { + step_07cb06(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void step_07cb06() { + f16vec2 res = step(f16vec2(0.0hf), f16vec2(0.0hf)); +} + +void fragment_main() { + step_07cb06(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void step_07cb06() { + f16vec2 res = step(f16vec2(0.0hf), f16vec2(0.0hf)); +} + +void compute_main() { + step_07cb06(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/step/07cb06.wgsl.expected.msl b/test/tint/builtins/gen/literal/step/07cb06.wgsl.expected.msl new file mode 100644 index 0000000000..aa04803561 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/07cb06.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void step_07cb06() { + half2 res = step(half2(0.0h), half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + step_07cb06(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + step_07cb06(); + return; +} + +kernel void compute_main() { + step_07cb06(); + return; +} + diff --git a/test/tint/builtins/gen/literal/step/07cb06.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/step/07cb06.wgsl.expected.spvasm new file mode 100644 index 0000000000..d73eed8b2d --- /dev/null +++ b/test/tint/builtins/gen/literal/step/07cb06.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %step_07cb06 "step_07cb06" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%step_07cb06 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Step %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %step_07cb06 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %step_07cb06 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %step_07cb06 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/step/07cb06.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/step/07cb06.wgsl.expected.wgsl new file mode 100644 index 0000000000..4ebf853307 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/07cb06.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn step_07cb06() { + var res : vec2 = step(vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_07cb06(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_07cb06(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_07cb06(); +} diff --git a/test/tint/builtins/gen/literal/step/630d07.wgsl b/test/tint/builtins/gen/literal/step/630d07.wgsl new file mode 100644 index 0000000000..b789a99094 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/630d07.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn step(f16, f16) -> f16 +fn step_630d07() { + var res: f16 = step(f16(), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_630d07(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_630d07(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_630d07(); +} diff --git a/test/tint/builtins/gen/literal/step/630d07.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/step/630d07.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0839e00644 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/630d07.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void step_630d07() { + float16_t res = step(float16_t(0.0h), float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_630d07(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_630d07(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_630d07(); + return; +} diff --git a/test/tint/builtins/gen/literal/step/630d07.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/step/630d07.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..634d34b334 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/630d07.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void step_630d07() { + float16_t res = step(float16_t(0.0h), float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_630d07(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_630d07(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_630d07(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001EFB6F7D2D0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001EFB6F7D2D0(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/step/630d07.wgsl.expected.glsl b/test/tint/builtins/gen/literal/step/630d07.wgsl.expected.glsl new file mode 100644 index 0000000000..7ddbf1350e --- /dev/null +++ b/test/tint/builtins/gen/literal/step/630d07.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void step_630d07() { + float16_t res = step(0.0hf, 0.0hf); +} + +vec4 vertex_main() { + step_630d07(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void step_630d07() { + float16_t res = step(0.0hf, 0.0hf); +} + +void fragment_main() { + step_630d07(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void step_630d07() { + float16_t res = step(0.0hf, 0.0hf); +} + +void compute_main() { + step_630d07(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/step/630d07.wgsl.expected.msl b/test/tint/builtins/gen/literal/step/630d07.wgsl.expected.msl new file mode 100644 index 0000000000..ef616cf0da --- /dev/null +++ b/test/tint/builtins/gen/literal/step/630d07.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void step_630d07() { + half res = step(0.0h, 0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + step_630d07(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + step_630d07(); + return; +} + +kernel void compute_main() { + step_630d07(); + return; +} + diff --git a/test/tint/builtins/gen/literal/step/630d07.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/step/630d07.wgsl.expected.spvasm new file mode 100644 index 0000000000..5783a90f2e --- /dev/null +++ b/test/tint/builtins/gen/literal/step/630d07.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %step_630d07 "step_630d07" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%step_630d07 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Step %16 %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %step_630d07 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %step_630d07 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %step_630d07 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/step/630d07.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/step/630d07.wgsl.expected.wgsl new file mode 100644 index 0000000000..6a0527d1a9 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/630d07.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn step_630d07() { + var res : f16 = step(f16(), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_630d07(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_630d07(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_630d07(); +} diff --git a/test/tint/builtins/gen/literal/step/baa320.wgsl b/test/tint/builtins/gen/literal/step/baa320.wgsl new file mode 100644 index 0000000000..b2e66b0a5b --- /dev/null +++ b/test/tint/builtins/gen/literal/step/baa320.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn step(vec<4, f16>, vec<4, f16>) -> vec<4, f16> +fn step_baa320() { + var res: vec4 = step(vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_baa320(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_baa320(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_baa320(); +} diff --git a/test/tint/builtins/gen/literal/step/baa320.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/step/baa320.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4f5992e80d --- /dev/null +++ b/test/tint/builtins/gen/literal/step/baa320.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void step_baa320() { + vector res = step((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_baa320(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_baa320(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_baa320(); + return; +} diff --git a/test/tint/builtins/gen/literal/step/baa320.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/step/baa320.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a394391587 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/baa320.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void step_baa320() { + vector res = step((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_baa320(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_baa320(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_baa320(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000023DD42966C0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/step/baa320.wgsl.expected.glsl b/test/tint/builtins/gen/literal/step/baa320.wgsl.expected.glsl new file mode 100644 index 0000000000..37f82127e4 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/baa320.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void step_baa320() { + f16vec4 res = step(f16vec4(0.0hf), f16vec4(0.0hf)); +} + +vec4 vertex_main() { + step_baa320(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void step_baa320() { + f16vec4 res = step(f16vec4(0.0hf), f16vec4(0.0hf)); +} + +void fragment_main() { + step_baa320(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void step_baa320() { + f16vec4 res = step(f16vec4(0.0hf), f16vec4(0.0hf)); +} + +void compute_main() { + step_baa320(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/step/baa320.wgsl.expected.msl b/test/tint/builtins/gen/literal/step/baa320.wgsl.expected.msl new file mode 100644 index 0000000000..ea8bc33af8 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/baa320.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void step_baa320() { + half4 res = step(half4(0.0h), half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + step_baa320(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + step_baa320(); + return; +} + +kernel void compute_main() { + step_baa320(); + return; +} + diff --git a/test/tint/builtins/gen/literal/step/baa320.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/step/baa320.wgsl.expected.spvasm new file mode 100644 index 0000000000..492cd3f7f3 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/baa320.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %step_baa320 "step_baa320" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%step_baa320 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Step %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %step_baa320 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %step_baa320 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %step_baa320 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/step/baa320.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/step/baa320.wgsl.expected.wgsl new file mode 100644 index 0000000000..c500a65836 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/baa320.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn step_baa320() { + var res : vec4 = step(vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_baa320(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_baa320(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_baa320(); +} diff --git a/test/tint/builtins/gen/literal/step/cc6b61.wgsl b/test/tint/builtins/gen/literal/step/cc6b61.wgsl new file mode 100644 index 0000000000..77da1c965b --- /dev/null +++ b/test/tint/builtins/gen/literal/step/cc6b61.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn step(vec<3, f16>, vec<3, f16>) -> vec<3, f16> +fn step_cc6b61() { + var res: vec3 = step(vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_cc6b61(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_cc6b61(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_cc6b61(); +} diff --git a/test/tint/builtins/gen/literal/step/cc6b61.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/step/cc6b61.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d4a6c36c61 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/cc6b61.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void step_cc6b61() { + vector res = step((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_cc6b61(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_cc6b61(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_cc6b61(); + return; +} diff --git a/test/tint/builtins/gen/literal/step/cc6b61.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/step/cc6b61.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..00514c519a --- /dev/null +++ b/test/tint/builtins/gen/literal/step/cc6b61.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void step_cc6b61() { + vector res = step((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_cc6b61(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_cc6b61(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_cc6b61(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000015E30CB9FC0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/step/cc6b61.wgsl.expected.glsl b/test/tint/builtins/gen/literal/step/cc6b61.wgsl.expected.glsl new file mode 100644 index 0000000000..0cb5d43ab8 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/cc6b61.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void step_cc6b61() { + f16vec3 res = step(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +vec4 vertex_main() { + step_cc6b61(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void step_cc6b61() { + f16vec3 res = step(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +void fragment_main() { + step_cc6b61(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void step_cc6b61() { + f16vec3 res = step(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +void compute_main() { + step_cc6b61(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/step/cc6b61.wgsl.expected.msl b/test/tint/builtins/gen/literal/step/cc6b61.wgsl.expected.msl new file mode 100644 index 0000000000..4e657120d9 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/cc6b61.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void step_cc6b61() { + half3 res = step(half3(0.0h), half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + step_cc6b61(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + step_cc6b61(); + return; +} + +kernel void compute_main() { + step_cc6b61(); + return; +} + diff --git a/test/tint/builtins/gen/literal/step/cc6b61.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/step/cc6b61.wgsl.expected.spvasm new file mode 100644 index 0000000000..8e2e6b99ff --- /dev/null +++ b/test/tint/builtins/gen/literal/step/cc6b61.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %step_cc6b61 "step_cc6b61" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%step_cc6b61 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Step %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %step_cc6b61 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %step_cc6b61 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %step_cc6b61 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/step/cc6b61.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/step/cc6b61.wgsl.expected.wgsl new file mode 100644 index 0000000000..d1d9624c44 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/cc6b61.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn step_cc6b61() { + var res : vec3 = step(vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_cc6b61(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_cc6b61(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_cc6b61(); +} diff --git a/test/tint/builtins/gen/literal/tan/539e54.wgsl b/test/tint/builtins/gen/literal/tan/539e54.wgsl new file mode 100644 index 0000000000..912e7b9e94 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/539e54.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn tan(vec<4, f16>) -> vec<4, f16> +fn tan_539e54() { + var res: vec4 = tan(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_539e54(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_539e54(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_539e54(); +} diff --git a/test/tint/builtins/gen/literal/tan/539e54.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/tan/539e54.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..aa87efc428 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/539e54.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void tan_539e54() { + vector res = tan((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_539e54(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_539e54(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_539e54(); + return; +} diff --git a/test/tint/builtins/gen/literal/tan/539e54.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/tan/539e54.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ec31619c3a --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/539e54.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void tan_539e54() { + vector res = tan((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_539e54(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_539e54(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_539e54(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002A069448210(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/tan/539e54.wgsl.expected.glsl b/test/tint/builtins/gen/literal/tan/539e54.wgsl.expected.glsl new file mode 100644 index 0000000000..8c9412796b --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/539e54.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tan_539e54() { + f16vec4 res = tan(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + tan_539e54(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void tan_539e54() { + f16vec4 res = tan(f16vec4(0.0hf)); +} + +void fragment_main() { + tan_539e54(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tan_539e54() { + f16vec4 res = tan(f16vec4(0.0hf)); +} + +void compute_main() { + tan_539e54(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/tan/539e54.wgsl.expected.msl b/test/tint/builtins/gen/literal/tan/539e54.wgsl.expected.msl new file mode 100644 index 0000000000..268bfda431 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/539e54.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void tan_539e54() { + half4 res = tan(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tan_539e54(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tan_539e54(); + return; +} + +kernel void compute_main() { + tan_539e54(); + return; +} + diff --git a/test/tint/builtins/gen/literal/tan/539e54.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/tan/539e54.wgsl.expected.spvasm new file mode 100644 index 0000000000..12de658e73 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/539e54.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tan_539e54 "tan_539e54" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tan_539e54 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Tan %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %tan_539e54 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %tan_539e54 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %tan_539e54 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/tan/539e54.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/tan/539e54.wgsl.expected.wgsl new file mode 100644 index 0000000000..91e3dfd85e --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/539e54.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn tan_539e54() { + var res : vec4 = tan(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_539e54(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_539e54(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_539e54(); +} diff --git a/test/tint/builtins/gen/literal/tan/9f7c9c.wgsl b/test/tint/builtins/gen/literal/tan/9f7c9c.wgsl new file mode 100644 index 0000000000..1ff61569cc --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/9f7c9c.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn tan(vec<2, f16>) -> vec<2, f16> +fn tan_9f7c9c() { + var res: vec2 = tan(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_9f7c9c(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_9f7c9c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_9f7c9c(); +} diff --git a/test/tint/builtins/gen/literal/tan/9f7c9c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/tan/9f7c9c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..bac155593e --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/9f7c9c.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void tan_9f7c9c() { + vector res = tan((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_9f7c9c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_9f7c9c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_9f7c9c(); + return; +} diff --git a/test/tint/builtins/gen/literal/tan/9f7c9c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/tan/9f7c9c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..63c3d76f80 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/9f7c9c.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void tan_9f7c9c() { + vector res = tan((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_9f7c9c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_9f7c9c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_9f7c9c(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000211853A84A0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/tan/9f7c9c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/tan/9f7c9c.wgsl.expected.glsl new file mode 100644 index 0000000000..2b07fc4c5a --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/9f7c9c.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tan_9f7c9c() { + f16vec2 res = tan(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + tan_9f7c9c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void tan_9f7c9c() { + f16vec2 res = tan(f16vec2(0.0hf)); +} + +void fragment_main() { + tan_9f7c9c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tan_9f7c9c() { + f16vec2 res = tan(f16vec2(0.0hf)); +} + +void compute_main() { + tan_9f7c9c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/tan/9f7c9c.wgsl.expected.msl b/test/tint/builtins/gen/literal/tan/9f7c9c.wgsl.expected.msl new file mode 100644 index 0000000000..ff408adf59 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/9f7c9c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void tan_9f7c9c() { + half2 res = tan(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tan_9f7c9c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tan_9f7c9c(); + return; +} + +kernel void compute_main() { + tan_9f7c9c(); + return; +} + diff --git a/test/tint/builtins/gen/literal/tan/9f7c9c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/tan/9f7c9c.wgsl.expected.spvasm new file mode 100644 index 0000000000..658d6a6ba2 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/9f7c9c.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tan_9f7c9c "tan_9f7c9c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tan_9f7c9c = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Tan %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %tan_9f7c9c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %tan_9f7c9c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %tan_9f7c9c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/tan/9f7c9c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/tan/9f7c9c.wgsl.expected.wgsl new file mode 100644 index 0000000000..1287e05b87 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/9f7c9c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn tan_9f7c9c() { + var res : vec2 = tan(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_9f7c9c(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_9f7c9c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_9f7c9c(); +} diff --git a/test/tint/builtins/gen/literal/tan/d4d491.wgsl b/test/tint/builtins/gen/literal/tan/d4d491.wgsl new file mode 100644 index 0000000000..c76db2db78 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/d4d491.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn tan(f16) -> f16 +fn tan_d4d491() { + var res: f16 = tan(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_d4d491(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_d4d491(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_d4d491(); +} diff --git a/test/tint/builtins/gen/literal/tan/d4d491.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/tan/d4d491.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a4be323480 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/d4d491.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void tan_d4d491() { + float16_t res = tan(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_d4d491(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_d4d491(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_d4d491(); + return; +} diff --git a/test/tint/builtins/gen/literal/tan/d4d491.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/tan/d4d491.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..20570212c0 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/d4d491.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void tan_d4d491() { + float16_t res = tan(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_d4d491(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_d4d491(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_d4d491(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001FE0D3A0520(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001FE0D3A0520(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/tan/d4d491.wgsl.expected.glsl b/test/tint/builtins/gen/literal/tan/d4d491.wgsl.expected.glsl new file mode 100644 index 0000000000..e6a73c88b8 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/d4d491.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tan_d4d491() { + float16_t res = tan(0.0hf); +} + +vec4 vertex_main() { + tan_d4d491(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void tan_d4d491() { + float16_t res = tan(0.0hf); +} + +void fragment_main() { + tan_d4d491(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tan_d4d491() { + float16_t res = tan(0.0hf); +} + +void compute_main() { + tan_d4d491(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/tan/d4d491.wgsl.expected.msl b/test/tint/builtins/gen/literal/tan/d4d491.wgsl.expected.msl new file mode 100644 index 0000000000..3dc2e149eb --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/d4d491.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void tan_d4d491() { + half res = tan(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tan_d4d491(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tan_d4d491(); + return; +} + +kernel void compute_main() { + tan_d4d491(); + return; +} + diff --git a/test/tint/builtins/gen/literal/tan/d4d491.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/tan/d4d491.wgsl.expected.spvasm new file mode 100644 index 0000000000..661dd9a146 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/d4d491.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tan_d4d491 "tan_d4d491" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tan_d4d491 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Tan %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %tan_d4d491 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %tan_d4d491 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %tan_d4d491 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/tan/d4d491.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/tan/d4d491.wgsl.expected.wgsl new file mode 100644 index 0000000000..da8f919202 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/d4d491.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn tan_d4d491() { + var res : f16 = tan(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_d4d491(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_d4d491(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_d4d491(); +} diff --git a/test/tint/builtins/gen/literal/tan/db0456.wgsl b/test/tint/builtins/gen/literal/tan/db0456.wgsl new file mode 100644 index 0000000000..9d70504d61 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/db0456.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn tan(vec<3, f16>) -> vec<3, f16> +fn tan_db0456() { + var res: vec3 = tan(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_db0456(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_db0456(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_db0456(); +} diff --git a/test/tint/builtins/gen/literal/tan/db0456.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/tan/db0456.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2253d7178d --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/db0456.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void tan_db0456() { + vector res = tan((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_db0456(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_db0456(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_db0456(); + return; +} diff --git a/test/tint/builtins/gen/literal/tan/db0456.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/tan/db0456.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d84a308668 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/db0456.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void tan_db0456() { + vector res = tan((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_db0456(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_db0456(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_db0456(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001B50B7A7080(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/tan/db0456.wgsl.expected.glsl b/test/tint/builtins/gen/literal/tan/db0456.wgsl.expected.glsl new file mode 100644 index 0000000000..4812d1bcea --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/db0456.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tan_db0456() { + f16vec3 res = tan(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + tan_db0456(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void tan_db0456() { + f16vec3 res = tan(f16vec3(0.0hf)); +} + +void fragment_main() { + tan_db0456(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tan_db0456() { + f16vec3 res = tan(f16vec3(0.0hf)); +} + +void compute_main() { + tan_db0456(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/tan/db0456.wgsl.expected.msl b/test/tint/builtins/gen/literal/tan/db0456.wgsl.expected.msl new file mode 100644 index 0000000000..3d87665b6e --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/db0456.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void tan_db0456() { + half3 res = tan(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tan_db0456(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tan_db0456(); + return; +} + +kernel void compute_main() { + tan_db0456(); + return; +} + diff --git a/test/tint/builtins/gen/literal/tan/db0456.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/tan/db0456.wgsl.expected.spvasm new file mode 100644 index 0000000000..2f1c402d56 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/db0456.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tan_db0456 "tan_db0456" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tan_db0456 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Tan %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %tan_db0456 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %tan_db0456 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %tan_db0456 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/tan/db0456.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/tan/db0456.wgsl.expected.wgsl new file mode 100644 index 0000000000..dc68ad2922 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/db0456.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn tan_db0456() { + var res : vec3 = tan(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_db0456(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_db0456(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_db0456(); +} diff --git a/test/tint/builtins/gen/literal/tanh/06a4fe.wgsl b/test/tint/builtins/gen/literal/tanh/06a4fe.wgsl new file mode 100644 index 0000000000..a02fef4c6c --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/06a4fe.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn tanh(vec<3, f16>) -> vec<3, f16> +fn tanh_06a4fe() { + var res: vec3 = tanh(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_06a4fe(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_06a4fe(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_06a4fe(); +} diff --git a/test/tint/builtins/gen/literal/tanh/06a4fe.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/tanh/06a4fe.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fb193b2da9 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/06a4fe.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void tanh_06a4fe() { + vector res = tanh((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_06a4fe(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_06a4fe(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_06a4fe(); + return; +} diff --git a/test/tint/builtins/gen/literal/tanh/06a4fe.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/tanh/06a4fe.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..34fa18b40f --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/06a4fe.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void tanh_06a4fe() { + vector res = tanh((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_06a4fe(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_06a4fe(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_06a4fe(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000025833A77D70(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/tanh/06a4fe.wgsl.expected.glsl b/test/tint/builtins/gen/literal/tanh/06a4fe.wgsl.expected.glsl new file mode 100644 index 0000000000..0840a2cd06 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/06a4fe.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tanh_06a4fe() { + f16vec3 res = tanh(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + tanh_06a4fe(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void tanh_06a4fe() { + f16vec3 res = tanh(f16vec3(0.0hf)); +} + +void fragment_main() { + tanh_06a4fe(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tanh_06a4fe() { + f16vec3 res = tanh(f16vec3(0.0hf)); +} + +void compute_main() { + tanh_06a4fe(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/tanh/06a4fe.wgsl.expected.msl b/test/tint/builtins/gen/literal/tanh/06a4fe.wgsl.expected.msl new file mode 100644 index 0000000000..ae1bf02628 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/06a4fe.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void tanh_06a4fe() { + half3 res = tanh(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tanh_06a4fe(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tanh_06a4fe(); + return; +} + +kernel void compute_main() { + tanh_06a4fe(); + return; +} + diff --git a/test/tint/builtins/gen/literal/tanh/06a4fe.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/tanh/06a4fe.wgsl.expected.spvasm new file mode 100644 index 0000000000..b06c654726 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/06a4fe.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tanh_06a4fe "tanh_06a4fe" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tanh_06a4fe = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Tanh %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %tanh_06a4fe + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %tanh_06a4fe + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %tanh_06a4fe + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/tanh/06a4fe.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/tanh/06a4fe.wgsl.expected.wgsl new file mode 100644 index 0000000000..fde59a5219 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/06a4fe.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn tanh_06a4fe() { + var res : vec3 = tanh(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_06a4fe(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_06a4fe(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_06a4fe(); +} diff --git a/test/tint/builtins/gen/literal/tanh/5b19af.wgsl b/test/tint/builtins/gen/literal/tanh/5b19af.wgsl new file mode 100644 index 0000000000..b83daaed7a --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/5b19af.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn tanh(f16) -> f16 +fn tanh_5b19af() { + var res: f16 = tanh(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_5b19af(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_5b19af(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_5b19af(); +} diff --git a/test/tint/builtins/gen/literal/tanh/5b19af.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/tanh/5b19af.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9d2dee63f6 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/5b19af.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void tanh_5b19af() { + float16_t res = tanh(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_5b19af(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_5b19af(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_5b19af(); + return; +} diff --git a/test/tint/builtins/gen/literal/tanh/5b19af.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/tanh/5b19af.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..de2732f3a1 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/5b19af.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void tanh_5b19af() { + float16_t res = tanh(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_5b19af(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_5b19af(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_5b19af(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000016C55EB1160(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000016C55EB1160(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/tanh/5b19af.wgsl.expected.glsl b/test/tint/builtins/gen/literal/tanh/5b19af.wgsl.expected.glsl new file mode 100644 index 0000000000..b909cb973e --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/5b19af.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tanh_5b19af() { + float16_t res = tanh(0.0hf); +} + +vec4 vertex_main() { + tanh_5b19af(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void tanh_5b19af() { + float16_t res = tanh(0.0hf); +} + +void fragment_main() { + tanh_5b19af(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tanh_5b19af() { + float16_t res = tanh(0.0hf); +} + +void compute_main() { + tanh_5b19af(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/tanh/5b19af.wgsl.expected.msl b/test/tint/builtins/gen/literal/tanh/5b19af.wgsl.expected.msl new file mode 100644 index 0000000000..a0122945d1 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/5b19af.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void tanh_5b19af() { + half res = tanh(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tanh_5b19af(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tanh_5b19af(); + return; +} + +kernel void compute_main() { + tanh_5b19af(); + return; +} + diff --git a/test/tint/builtins/gen/literal/tanh/5b19af.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/tanh/5b19af.wgsl.expected.spvasm new file mode 100644 index 0000000000..db2580f69f --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/5b19af.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tanh_5b19af "tanh_5b19af" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tanh_5b19af = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Tanh %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %tanh_5b19af + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %tanh_5b19af + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %tanh_5b19af + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/tanh/5b19af.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/tanh/5b19af.wgsl.expected.wgsl new file mode 100644 index 0000000000..a2e42178b5 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/5b19af.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn tanh_5b19af() { + var res : f16 = tanh(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_5b19af(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_5b19af(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_5b19af(); +} diff --git a/test/tint/builtins/gen/literal/tanh/6d105a.wgsl b/test/tint/builtins/gen/literal/tanh/6d105a.wgsl new file mode 100644 index 0000000000..acd3e21433 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/6d105a.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn tanh(vec<2, f16>) -> vec<2, f16> +fn tanh_6d105a() { + var res: vec2 = tanh(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_6d105a(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_6d105a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_6d105a(); +} diff --git a/test/tint/builtins/gen/literal/tanh/6d105a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/tanh/6d105a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9a1b417fed --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/6d105a.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void tanh_6d105a() { + vector res = tanh((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_6d105a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_6d105a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_6d105a(); + return; +} diff --git a/test/tint/builtins/gen/literal/tanh/6d105a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/tanh/6d105a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fce0b8088c --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/6d105a.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void tanh_6d105a() { + vector res = tanh((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_6d105a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_6d105a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_6d105a(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000015291DA1160(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/tanh/6d105a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/tanh/6d105a.wgsl.expected.glsl new file mode 100644 index 0000000000..f5aa9d4254 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/6d105a.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tanh_6d105a() { + f16vec2 res = tanh(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + tanh_6d105a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void tanh_6d105a() { + f16vec2 res = tanh(f16vec2(0.0hf)); +} + +void fragment_main() { + tanh_6d105a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tanh_6d105a() { + f16vec2 res = tanh(f16vec2(0.0hf)); +} + +void compute_main() { + tanh_6d105a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/tanh/6d105a.wgsl.expected.msl b/test/tint/builtins/gen/literal/tanh/6d105a.wgsl.expected.msl new file mode 100644 index 0000000000..b9795af0a0 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/6d105a.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void tanh_6d105a() { + half2 res = tanh(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tanh_6d105a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tanh_6d105a(); + return; +} + +kernel void compute_main() { + tanh_6d105a(); + return; +} + diff --git a/test/tint/builtins/gen/literal/tanh/6d105a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/tanh/6d105a.wgsl.expected.spvasm new file mode 100644 index 0000000000..101dbc6ab6 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/6d105a.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tanh_6d105a "tanh_6d105a" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tanh_6d105a = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Tanh %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %tanh_6d105a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %tanh_6d105a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %tanh_6d105a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/tanh/6d105a.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/tanh/6d105a.wgsl.expected.wgsl new file mode 100644 index 0000000000..9b0b089628 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/6d105a.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn tanh_6d105a() { + var res : vec2 = tanh(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_6d105a(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_6d105a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_6d105a(); +} diff --git a/test/tint/builtins/gen/literal/tanh/e8efb3.wgsl b/test/tint/builtins/gen/literal/tanh/e8efb3.wgsl new file mode 100644 index 0000000000..c0579ccae6 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/e8efb3.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn tanh(vec<4, f16>) -> vec<4, f16> +fn tanh_e8efb3() { + var res: vec4 = tanh(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_e8efb3(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_e8efb3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_e8efb3(); +} diff --git a/test/tint/builtins/gen/literal/tanh/e8efb3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/tanh/e8efb3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..547e3c1fd9 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/e8efb3.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void tanh_e8efb3() { + vector res = tanh((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_e8efb3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_e8efb3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_e8efb3(); + return; +} diff --git a/test/tint/builtins/gen/literal/tanh/e8efb3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/tanh/e8efb3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cc5d017601 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/e8efb3.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void tanh_e8efb3() { + vector res = tanh((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_e8efb3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_e8efb3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_e8efb3(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E87C8DF490(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/tanh/e8efb3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/tanh/e8efb3.wgsl.expected.glsl new file mode 100644 index 0000000000..7d9bf9195d --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/e8efb3.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tanh_e8efb3() { + f16vec4 res = tanh(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + tanh_e8efb3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void tanh_e8efb3() { + f16vec4 res = tanh(f16vec4(0.0hf)); +} + +void fragment_main() { + tanh_e8efb3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tanh_e8efb3() { + f16vec4 res = tanh(f16vec4(0.0hf)); +} + +void compute_main() { + tanh_e8efb3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/tanh/e8efb3.wgsl.expected.msl b/test/tint/builtins/gen/literal/tanh/e8efb3.wgsl.expected.msl new file mode 100644 index 0000000000..7da14aace6 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/e8efb3.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void tanh_e8efb3() { + half4 res = tanh(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tanh_e8efb3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tanh_e8efb3(); + return; +} + +kernel void compute_main() { + tanh_e8efb3(); + return; +} + diff --git a/test/tint/builtins/gen/literal/tanh/e8efb3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/tanh/e8efb3.wgsl.expected.spvasm new file mode 100644 index 0000000000..4b18be4610 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/e8efb3.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tanh_e8efb3 "tanh_e8efb3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tanh_e8efb3 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Tanh %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %tanh_e8efb3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %tanh_e8efb3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %tanh_e8efb3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/tanh/e8efb3.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/tanh/e8efb3.wgsl.expected.wgsl new file mode 100644 index 0000000000..5cde1f82de --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/e8efb3.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn tanh_e8efb3() { + var res : vec4 = tanh(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_e8efb3(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_e8efb3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_e8efb3(); +} diff --git a/test/tint/builtins/gen/literal/transpose/06794e.wgsl b/test/tint/builtins/gen/literal/transpose/06794e.wgsl new file mode 100644 index 0000000000..a413e2b6a9 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/06794e.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn transpose(mat<3, 3, f16>) -> mat<3, 3, f16> +fn transpose_06794e() { + var res: mat3x3 = transpose(mat3x3(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_06794e(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_06794e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_06794e(); +} diff --git a/test/tint/builtins/gen/literal/transpose/06794e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/transpose/06794e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..134ef42e1b --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/06794e.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void transpose_06794e() { + matrix res = transpose(matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_06794e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_06794e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_06794e(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/06794e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/transpose/06794e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2e4508d412 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/06794e.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void transpose_06794e() { + matrix res = transpose(matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_06794e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_06794e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_06794e(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000204EECC7200(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/transpose/06794e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/transpose/06794e.wgsl.expected.glsl new file mode 100644 index 0000000000..045b7372d5 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/06794e.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_06794e() { + f16mat3 res = transpose(f16mat3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf))); +} + +vec4 vertex_main() { + transpose_06794e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void transpose_06794e() { + f16mat3 res = transpose(f16mat3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf))); +} + +void fragment_main() { + transpose_06794e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_06794e() { + f16mat3 res = transpose(f16mat3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf))); +} + +void compute_main() { + transpose_06794e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/06794e.wgsl.expected.msl b/test/tint/builtins/gen/literal/transpose/06794e.wgsl.expected.msl new file mode 100644 index 0000000000..e698039053 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/06794e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void transpose_06794e() { + half3x3 res = transpose(half3x3(half3(0.0h), half3(0.0h), half3(0.0h))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_06794e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_06794e(); + return; +} + +kernel void compute_main() { + transpose_06794e(); + return; +} + diff --git a/test/tint/builtins/gen/literal/transpose/06794e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/transpose/06794e.wgsl.expected.spvasm new file mode 100644 index 0000000000..26c14aa0ed --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/06794e.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_06794e "transpose_06794e" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat3v3half = OpTypeMatrix %v3half 3 + %17 = OpConstantNull %mat3v3half +%_ptr_Function_mat3v3half = OpTypePointer Function %mat3v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%transpose_06794e = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_mat3v3half Function %17 + %13 = OpTranspose %mat3v3half %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %transpose_06794e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %transpose_06794e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %transpose_06794e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/transpose/06794e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/transpose/06794e.wgsl.expected.wgsl new file mode 100644 index 0000000000..ac99ba20ee --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/06794e.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn transpose_06794e() { + var res : mat3x3 = transpose(mat3x3(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_06794e(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_06794e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_06794e(); +} diff --git a/test/tint/builtins/gen/literal/transpose/5edd96.wgsl b/test/tint/builtins/gen/literal/transpose/5edd96.wgsl new file mode 100644 index 0000000000..dd1c459332 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/5edd96.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn transpose(mat<4, 2, f16>) -> mat<2, 4, f16> +fn transpose_5edd96() { + var res: mat2x4 = transpose(mat4x2(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_5edd96(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_5edd96(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_5edd96(); +} diff --git a/test/tint/builtins/gen/literal/transpose/5edd96.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/transpose/5edd96.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1f253b9e80 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/5edd96.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void transpose_5edd96() { + matrix res = transpose(matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_5edd96(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_5edd96(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_5edd96(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/5edd96.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/transpose/5edd96.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4f8832fffe --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/5edd96.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void transpose_5edd96() { + matrix res = transpose(matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_5edd96(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_5edd96(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_5edd96(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000292A0E96D40(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/transpose/5edd96.wgsl.expected.glsl b/test/tint/builtins/gen/literal/transpose/5edd96.wgsl.expected.glsl new file mode 100644 index 0000000000..48b8ac197f --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/5edd96.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_5edd96() { + f16mat2x4 res = transpose(f16mat4x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf))); +} + +vec4 vertex_main() { + transpose_5edd96(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void transpose_5edd96() { + f16mat2x4 res = transpose(f16mat4x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf))); +} + +void fragment_main() { + transpose_5edd96(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_5edd96() { + f16mat2x4 res = transpose(f16mat4x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf))); +} + +void compute_main() { + transpose_5edd96(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/5edd96.wgsl.expected.msl b/test/tint/builtins/gen/literal/transpose/5edd96.wgsl.expected.msl new file mode 100644 index 0000000000..09cffcbd1f --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/5edd96.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void transpose_5edd96() { + half2x4 res = transpose(half4x2(half2(0.0h), half2(0.0h), half2(0.0h), half2(0.0h))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_5edd96(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_5edd96(); + return; +} + +kernel void compute_main() { + transpose_5edd96(); + return; +} + diff --git a/test/tint/builtins/gen/literal/transpose/5edd96.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/transpose/5edd96.wgsl.expected.spvasm new file mode 100644 index 0000000000..07e8594864 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/5edd96.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_5edd96 "transpose_5edd96" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat2v4half = OpTypeMatrix %v4half 2 + %v2half = OpTypeVector %half 2 + %mat4v2half = OpTypeMatrix %v2half 4 + %19 = OpConstantNull %mat4v2half +%_ptr_Function_mat2v4half = OpTypePointer Function %mat2v4half + %22 = OpConstantNull %mat2v4half + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%transpose_5edd96 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_mat2v4half Function %22 + %13 = OpTranspose %mat2v4half %19 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %transpose_5edd96 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %transpose_5edd96 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %transpose_5edd96 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/transpose/5edd96.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/transpose/5edd96.wgsl.expected.wgsl new file mode 100644 index 0000000000..aaf9fbf236 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/5edd96.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn transpose_5edd96() { + var res : mat2x4 = transpose(mat4x2(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_5edd96(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_5edd96(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_5edd96(); +} diff --git a/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl b/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl new file mode 100644 index 0000000000..47e4c776bf --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn transpose(mat<4, 3, f16>) -> mat<3, 4, f16> +fn transpose_5f36bf() { + var res: mat3x4 = transpose(mat4x3(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_5f36bf(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_5f36bf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_5f36bf(); +} diff --git a/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b5189243fd --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void transpose_5f36bf() { + matrix res = transpose(matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_5f36bf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_5f36bf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_5f36bf(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cc78b8f286 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void transpose_5f36bf() { + matrix res = transpose(matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_5f36bf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_5f36bf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_5f36bf(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000237E1607910(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl.expected.glsl b/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl.expected.glsl new file mode 100644 index 0000000000..bc4a794651 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_5f36bf() { + f16mat3x4 res = transpose(f16mat4x3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf))); +} + +vec4 vertex_main() { + transpose_5f36bf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void transpose_5f36bf() { + f16mat3x4 res = transpose(f16mat4x3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf))); +} + +void fragment_main() { + transpose_5f36bf(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_5f36bf() { + f16mat3x4 res = transpose(f16mat4x3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf))); +} + +void compute_main() { + transpose_5f36bf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl.expected.msl b/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl.expected.msl new file mode 100644 index 0000000000..d931f016ab --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void transpose_5f36bf() { + half3x4 res = transpose(half4x3(half3(0.0h), half3(0.0h), half3(0.0h), half3(0.0h))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_5f36bf(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_5f36bf(); + return; +} + +kernel void compute_main() { + transpose_5f36bf(); + return; +} + diff --git a/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl.expected.spvasm new file mode 100644 index 0000000000..c9e6ffa30f --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_5f36bf "transpose_5f36bf" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat3v4half = OpTypeMatrix %v4half 3 + %v3half = OpTypeVector %half 3 + %mat4v3half = OpTypeMatrix %v3half 4 + %19 = OpConstantNull %mat4v3half +%_ptr_Function_mat3v4half = OpTypePointer Function %mat3v4half + %22 = OpConstantNull %mat3v4half + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%transpose_5f36bf = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_mat3v4half Function %22 + %13 = OpTranspose %mat3v4half %19 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %transpose_5f36bf + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %transpose_5f36bf + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %transpose_5f36bf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl.expected.wgsl new file mode 100644 index 0000000000..878b15af9e --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn transpose_5f36bf() { + var res : mat3x4 = transpose(mat4x3(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_5f36bf(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_5f36bf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_5f36bf(); +} diff --git a/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl b/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl new file mode 100644 index 0000000000..5a59b3bb4d --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn transpose(mat<2, 2, f16>) -> mat<2, 2, f16> +fn transpose_7be8b2() { + var res: mat2x2 = transpose(mat2x2(f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_7be8b2(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_7be8b2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_7be8b2(); +} diff --git a/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e72e2d0fe8 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void transpose_7be8b2() { + matrix res = transpose(matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_7be8b2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_7be8b2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_7be8b2(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a45d63b85d --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void transpose_7be8b2() { + matrix res = transpose(matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_7be8b2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_7be8b2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_7be8b2(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001EDDB33C1F0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl.expected.glsl b/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl.expected.glsl new file mode 100644 index 0000000000..44cafb6a5e --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_7be8b2() { + f16mat2 res = transpose(f16mat2(f16vec2(0.0hf), f16vec2(0.0hf))); +} + +vec4 vertex_main() { + transpose_7be8b2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void transpose_7be8b2() { + f16mat2 res = transpose(f16mat2(f16vec2(0.0hf), f16vec2(0.0hf))); +} + +void fragment_main() { + transpose_7be8b2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_7be8b2() { + f16mat2 res = transpose(f16mat2(f16vec2(0.0hf), f16vec2(0.0hf))); +} + +void compute_main() { + transpose_7be8b2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl.expected.msl b/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl.expected.msl new file mode 100644 index 0000000000..435d12f6e2 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void transpose_7be8b2() { + half2x2 res = transpose(half2x2(half2(0.0h), half2(0.0h))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_7be8b2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_7be8b2(); + return; +} + +kernel void compute_main() { + transpose_7be8b2(); + return; +} + diff --git a/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl.expected.spvasm new file mode 100644 index 0000000000..7575dcadbc --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_7be8b2 "transpose_7be8b2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat2v2half = OpTypeMatrix %v2half 2 + %17 = OpConstantNull %mat2v2half +%_ptr_Function_mat2v2half = OpTypePointer Function %mat2v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%transpose_7be8b2 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_mat2v2half Function %17 + %13 = OpTranspose %mat2v2half %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %transpose_7be8b2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %transpose_7be8b2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %transpose_7be8b2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl.expected.wgsl new file mode 100644 index 0000000000..437f1cea53 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn transpose_7be8b2() { + var res : mat2x2 = transpose(mat2x2(f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_7be8b2(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_7be8b2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_7be8b2(); +} diff --git a/test/tint/builtins/gen/literal/transpose/844869.wgsl b/test/tint/builtins/gen/literal/transpose/844869.wgsl new file mode 100644 index 0000000000..870582ba6d --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/844869.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn transpose(mat<4, 4, f16>) -> mat<4, 4, f16> +fn transpose_844869() { + var res: mat4x4 = transpose(mat4x4(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_844869(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_844869(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_844869(); +} diff --git a/test/tint/builtins/gen/literal/transpose/844869.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/transpose/844869.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0ad869b997 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/844869.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void transpose_844869() { + matrix res = transpose(matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_844869(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_844869(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_844869(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/844869.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/transpose/844869.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ec91e0b30e --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/844869.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void transpose_844869() { + matrix res = transpose(matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_844869(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_844869(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_844869(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F000A07970(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/transpose/844869.wgsl.expected.glsl b/test/tint/builtins/gen/literal/transpose/844869.wgsl.expected.glsl new file mode 100644 index 0000000000..a244d661b7 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/844869.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_844869() { + f16mat4 res = transpose(f16mat4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf))); +} + +vec4 vertex_main() { + transpose_844869(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void transpose_844869() { + f16mat4 res = transpose(f16mat4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf))); +} + +void fragment_main() { + transpose_844869(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_844869() { + f16mat4 res = transpose(f16mat4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf))); +} + +void compute_main() { + transpose_844869(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/844869.wgsl.expected.msl b/test/tint/builtins/gen/literal/transpose/844869.wgsl.expected.msl new file mode 100644 index 0000000000..b02ce13d83 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/844869.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void transpose_844869() { + half4x4 res = transpose(half4x4(half4(0.0h), half4(0.0h), half4(0.0h), half4(0.0h))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_844869(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_844869(); + return; +} + +kernel void compute_main() { + transpose_844869(); + return; +} + diff --git a/test/tint/builtins/gen/literal/transpose/844869.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/transpose/844869.wgsl.expected.spvasm new file mode 100644 index 0000000000..830841978c --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/844869.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_844869 "transpose_844869" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat4v4half = OpTypeMatrix %v4half 4 + %17 = OpConstantNull %mat4v4half +%_ptr_Function_mat4v4half = OpTypePointer Function %mat4v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%transpose_844869 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_mat4v4half Function %17 + %13 = OpTranspose %mat4v4half %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %transpose_844869 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %transpose_844869 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %transpose_844869 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/transpose/844869.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/transpose/844869.wgsl.expected.wgsl new file mode 100644 index 0000000000..b917ed4147 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/844869.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn transpose_844869() { + var res : mat4x4 = transpose(mat4x4(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_844869(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_844869(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_844869(); +} diff --git a/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl b/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl new file mode 100644 index 0000000000..e7925471d1 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn transpose(mat<3, 4, f16>) -> mat<4, 3, f16> +fn transpose_8c06ce() { + var res: mat4x3 = transpose(mat3x4(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_8c06ce(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_8c06ce(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_8c06ce(); +} diff --git a/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..796214243a --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void transpose_8c06ce() { + matrix res = transpose(matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_8c06ce(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_8c06ce(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_8c06ce(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7a4521b139 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void transpose_8c06ce() { + matrix res = transpose(matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_8c06ce(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_8c06ce(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_8c06ce(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000028A648373A0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl.expected.glsl b/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl.expected.glsl new file mode 100644 index 0000000000..77ffe386f4 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_8c06ce() { + f16mat4x3 res = transpose(f16mat3x4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf))); +} + +vec4 vertex_main() { + transpose_8c06ce(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void transpose_8c06ce() { + f16mat4x3 res = transpose(f16mat3x4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf))); +} + +void fragment_main() { + transpose_8c06ce(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_8c06ce() { + f16mat4x3 res = transpose(f16mat3x4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf))); +} + +void compute_main() { + transpose_8c06ce(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl.expected.msl b/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl.expected.msl new file mode 100644 index 0000000000..dd48f0306d --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void transpose_8c06ce() { + half4x3 res = transpose(half3x4(half4(0.0h), half4(0.0h), half4(0.0h))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_8c06ce(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_8c06ce(); + return; +} + +kernel void compute_main() { + transpose_8c06ce(); + return; +} + diff --git a/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl.expected.spvasm new file mode 100644 index 0000000000..04c004eb28 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_8c06ce "transpose_8c06ce" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat4v3half = OpTypeMatrix %v3half 4 + %v4half = OpTypeVector %half 4 + %mat3v4half = OpTypeMatrix %v4half 3 + %19 = OpConstantNull %mat3v4half +%_ptr_Function_mat4v3half = OpTypePointer Function %mat4v3half + %22 = OpConstantNull %mat4v3half + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%transpose_8c06ce = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_mat4v3half Function %22 + %13 = OpTranspose %mat4v3half %19 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %transpose_8c06ce + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %transpose_8c06ce + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %transpose_8c06ce + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl.expected.wgsl new file mode 100644 index 0000000000..09d0c25f34 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn transpose_8c06ce() { + var res : mat4x3 = transpose(mat3x4(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_8c06ce(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_8c06ce(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_8c06ce(); +} diff --git a/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl b/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl new file mode 100644 index 0000000000..7be77d2682 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn transpose(mat<3, 2, f16>) -> mat<2, 3, f16> +fn transpose_b9ad1f() { + var res: mat2x3 = transpose(mat3x2(f16(), f16(), f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_b9ad1f(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_b9ad1f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_b9ad1f(); +} diff --git a/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..97e3dcb1bb --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void transpose_b9ad1f() { + matrix res = transpose(matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_b9ad1f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_b9ad1f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_b9ad1f(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..dd484fcc03 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void transpose_b9ad1f() { + matrix res = transpose(matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_b9ad1f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_b9ad1f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_b9ad1f(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E12EBEEBC0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl.expected.glsl new file mode 100644 index 0000000000..f549a0dadd --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_b9ad1f() { + f16mat2x3 res = transpose(f16mat3x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf))); +} + +vec4 vertex_main() { + transpose_b9ad1f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void transpose_b9ad1f() { + f16mat2x3 res = transpose(f16mat3x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf))); +} + +void fragment_main() { + transpose_b9ad1f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_b9ad1f() { + f16mat2x3 res = transpose(f16mat3x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf))); +} + +void compute_main() { + transpose_b9ad1f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl.expected.msl b/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl.expected.msl new file mode 100644 index 0000000000..6fc6f1d751 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void transpose_b9ad1f() { + half2x3 res = transpose(half3x2(half2(0.0h), half2(0.0h), half2(0.0h))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_b9ad1f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_b9ad1f(); + return; +} + +kernel void compute_main() { + transpose_b9ad1f(); + return; +} + diff --git a/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl.expected.spvasm new file mode 100644 index 0000000000..c3ed30e12b --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_b9ad1f "transpose_b9ad1f" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat2v3half = OpTypeMatrix %v3half 2 + %v2half = OpTypeVector %half 2 + %mat3v2half = OpTypeMatrix %v2half 3 + %19 = OpConstantNull %mat3v2half +%_ptr_Function_mat2v3half = OpTypePointer Function %mat2v3half + %22 = OpConstantNull %mat2v3half + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%transpose_b9ad1f = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_mat2v3half Function %22 + %13 = OpTranspose %mat2v3half %19 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %transpose_b9ad1f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %transpose_b9ad1f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %transpose_b9ad1f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl.expected.wgsl new file mode 100644 index 0000000000..49ee3fa258 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn transpose_b9ad1f() { + var res : mat2x3 = transpose(mat3x2(f16(), f16(), f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_b9ad1f(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_b9ad1f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_b9ad1f(); +} diff --git a/test/tint/builtins/gen/literal/transpose/d6faec.wgsl b/test/tint/builtins/gen/literal/transpose/d6faec.wgsl new file mode 100644 index 0000000000..4375de3909 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/d6faec.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn transpose(mat<2, 3, f16>) -> mat<3, 2, f16> +fn transpose_d6faec() { + var res: mat3x2 = transpose(mat2x3(f16(), f16(), f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_d6faec(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_d6faec(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_d6faec(); +} diff --git a/test/tint/builtins/gen/literal/transpose/d6faec.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/transpose/d6faec.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4ab9a4aac9 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/d6faec.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void transpose_d6faec() { + matrix res = transpose(matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_d6faec(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_d6faec(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_d6faec(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/d6faec.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/transpose/d6faec.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0fdbfb1fad --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/d6faec.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void transpose_d6faec() { + matrix res = transpose(matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_d6faec(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_d6faec(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_d6faec(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002356649E890(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/transpose/d6faec.wgsl.expected.glsl b/test/tint/builtins/gen/literal/transpose/d6faec.wgsl.expected.glsl new file mode 100644 index 0000000000..c7f7f4ba39 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/d6faec.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_d6faec() { + f16mat3x2 res = transpose(f16mat2x3(f16vec3(0.0hf), f16vec3(0.0hf))); +} + +vec4 vertex_main() { + transpose_d6faec(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void transpose_d6faec() { + f16mat3x2 res = transpose(f16mat2x3(f16vec3(0.0hf), f16vec3(0.0hf))); +} + +void fragment_main() { + transpose_d6faec(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_d6faec() { + f16mat3x2 res = transpose(f16mat2x3(f16vec3(0.0hf), f16vec3(0.0hf))); +} + +void compute_main() { + transpose_d6faec(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/d6faec.wgsl.expected.msl b/test/tint/builtins/gen/literal/transpose/d6faec.wgsl.expected.msl new file mode 100644 index 0000000000..b4629d50e6 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/d6faec.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void transpose_d6faec() { + half3x2 res = transpose(half2x3(half3(0.0h), half3(0.0h))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_d6faec(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_d6faec(); + return; +} + +kernel void compute_main() { + transpose_d6faec(); + return; +} + diff --git a/test/tint/builtins/gen/literal/transpose/d6faec.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/transpose/d6faec.wgsl.expected.spvasm new file mode 100644 index 0000000000..a9f192ca01 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/d6faec.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_d6faec "transpose_d6faec" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat3v2half = OpTypeMatrix %v2half 3 + %v3half = OpTypeVector %half 3 + %mat2v3half = OpTypeMatrix %v3half 2 + %19 = OpConstantNull %mat2v3half +%_ptr_Function_mat3v2half = OpTypePointer Function %mat3v2half + %22 = OpConstantNull %mat3v2half + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%transpose_d6faec = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_mat3v2half Function %22 + %13 = OpTranspose %mat3v2half %19 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %transpose_d6faec + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %transpose_d6faec + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %transpose_d6faec + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/transpose/d6faec.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/transpose/d6faec.wgsl.expected.wgsl new file mode 100644 index 0000000000..5e269447d4 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/d6faec.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn transpose_d6faec() { + var res : mat3x2 = transpose(mat2x3(f16(), f16(), f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_d6faec(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_d6faec(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_d6faec(); +} diff --git a/test/tint/builtins/gen/literal/transpose/faeb05.wgsl b/test/tint/builtins/gen/literal/transpose/faeb05.wgsl new file mode 100644 index 0000000000..706d3bd2d2 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/faeb05.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn transpose(mat<2, 4, f16>) -> mat<4, 2, f16> +fn transpose_faeb05() { + var res: mat4x2 = transpose(mat2x4(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_faeb05(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_faeb05(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_faeb05(); +} diff --git a/test/tint/builtins/gen/literal/transpose/faeb05.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/transpose/faeb05.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2a44dc6b17 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/faeb05.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void transpose_faeb05() { + matrix res = transpose(matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_faeb05(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_faeb05(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_faeb05(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/faeb05.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/transpose/faeb05.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..16ac417e6b --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/faeb05.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void transpose_faeb05() { + matrix res = transpose(matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_faeb05(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_faeb05(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_faeb05(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000019548DF3C90(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/transpose/faeb05.wgsl.expected.glsl b/test/tint/builtins/gen/literal/transpose/faeb05.wgsl.expected.glsl new file mode 100644 index 0000000000..720b3fdd3d --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/faeb05.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_faeb05() { + f16mat4x2 res = transpose(f16mat2x4(f16vec4(0.0hf), f16vec4(0.0hf))); +} + +vec4 vertex_main() { + transpose_faeb05(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void transpose_faeb05() { + f16mat4x2 res = transpose(f16mat2x4(f16vec4(0.0hf), f16vec4(0.0hf))); +} + +void fragment_main() { + transpose_faeb05(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_faeb05() { + f16mat4x2 res = transpose(f16mat2x4(f16vec4(0.0hf), f16vec4(0.0hf))); +} + +void compute_main() { + transpose_faeb05(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/faeb05.wgsl.expected.msl b/test/tint/builtins/gen/literal/transpose/faeb05.wgsl.expected.msl new file mode 100644 index 0000000000..ec6e27d6b4 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/faeb05.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void transpose_faeb05() { + half4x2 res = transpose(half2x4(half4(0.0h), half4(0.0h))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_faeb05(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_faeb05(); + return; +} + +kernel void compute_main() { + transpose_faeb05(); + return; +} + diff --git a/test/tint/builtins/gen/literal/transpose/faeb05.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/transpose/faeb05.wgsl.expected.spvasm new file mode 100644 index 0000000000..eff9828ad1 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/faeb05.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_faeb05 "transpose_faeb05" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat4v2half = OpTypeMatrix %v2half 4 + %v4half = OpTypeVector %half 4 + %mat2v4half = OpTypeMatrix %v4half 2 + %19 = OpConstantNull %mat2v4half +%_ptr_Function_mat4v2half = OpTypePointer Function %mat4v2half + %22 = OpConstantNull %mat4v2half + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%transpose_faeb05 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_mat4v2half Function %22 + %13 = OpTranspose %mat4v2half %19 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %transpose_faeb05 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %transpose_faeb05 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %transpose_faeb05 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/transpose/faeb05.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/transpose/faeb05.wgsl.expected.wgsl new file mode 100644 index 0000000000..795686f1d2 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/faeb05.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn transpose_faeb05() { + var res : mat4x2 = transpose(mat2x4(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_faeb05(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_faeb05(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_faeb05(); +} diff --git a/test/tint/builtins/gen/literal/trunc/103ab8.wgsl b/test/tint/builtins/gen/literal/trunc/103ab8.wgsl new file mode 100644 index 0000000000..687471966b --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/103ab8.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn trunc(vec<3, f16>) -> vec<3, f16> +fn trunc_103ab8() { + var res: vec3 = trunc(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_103ab8(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_103ab8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_103ab8(); +} diff --git a/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..dd3ebec191 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void trunc_103ab8() { + vector res = trunc((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_103ab8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_103ab8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_103ab8(); + return; +} diff --git a/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e27ff8b79a --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void trunc_103ab8() { + vector res = trunc((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_103ab8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_103ab8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_103ab8(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022CEF83F530(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.glsl b/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.glsl new file mode 100644 index 0000000000..da7798a5dd --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void trunc_103ab8() { + f16vec3 res = trunc(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + trunc_103ab8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void trunc_103ab8() { + f16vec3 res = trunc(f16vec3(0.0hf)); +} + +void fragment_main() { + trunc_103ab8(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void trunc_103ab8() { + f16vec3 res = trunc(f16vec3(0.0hf)); +} + +void compute_main() { + trunc_103ab8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.msl b/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.msl new file mode 100644 index 0000000000..11217431f5 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void trunc_103ab8() { + half3 res = trunc(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + trunc_103ab8(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + trunc_103ab8(); + return; +} + +kernel void compute_main() { + trunc_103ab8(); + return; +} + diff --git a/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.spvasm new file mode 100644 index 0000000000..e1a21cf9b9 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %trunc_103ab8 "trunc_103ab8" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%trunc_103ab8 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Trunc %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %trunc_103ab8 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %trunc_103ab8 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %trunc_103ab8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.wgsl new file mode 100644 index 0000000000..9422358d36 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn trunc_103ab8() { + var res : vec3 = trunc(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_103ab8(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_103ab8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_103ab8(); +} diff --git a/test/tint/builtins/gen/literal/trunc/a56109.wgsl b/test/tint/builtins/gen/literal/trunc/a56109.wgsl new file mode 100644 index 0000000000..ef8b02ba12 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/a56109.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn trunc(vec<2, f16>) -> vec<2, f16> +fn trunc_a56109() { + var res: vec2 = trunc(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_a56109(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_a56109(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_a56109(); +} diff --git a/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0cc0eb22df --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void trunc_a56109() { + vector res = trunc((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_a56109(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_a56109(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_a56109(); + return; +} diff --git a/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..003cc1e2ae --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void trunc_a56109() { + vector res = trunc((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_a56109(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_a56109(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_a56109(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000295C5ED1620(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.glsl b/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.glsl new file mode 100644 index 0000000000..d403886e8e --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void trunc_a56109() { + f16vec2 res = trunc(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + trunc_a56109(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void trunc_a56109() { + f16vec2 res = trunc(f16vec2(0.0hf)); +} + +void fragment_main() { + trunc_a56109(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void trunc_a56109() { + f16vec2 res = trunc(f16vec2(0.0hf)); +} + +void compute_main() { + trunc_a56109(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.msl b/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.msl new file mode 100644 index 0000000000..19d67d9bcf --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void trunc_a56109() { + half2 res = trunc(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + trunc_a56109(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + trunc_a56109(); + return; +} + +kernel void compute_main() { + trunc_a56109(); + return; +} + diff --git a/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.spvasm new file mode 100644 index 0000000000..5899e0ff86 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %trunc_a56109 "trunc_a56109" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%trunc_a56109 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Trunc %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %trunc_a56109 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %trunc_a56109 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %trunc_a56109 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.wgsl new file mode 100644 index 0000000000..174127ef63 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn trunc_a56109() { + var res : vec2 = trunc(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_a56109(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_a56109(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_a56109(); +} diff --git a/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl b/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl new file mode 100644 index 0000000000..0dccaa6c0b --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn trunc(f16) -> f16 +fn trunc_cc2b0d() { + var res: f16 = trunc(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_cc2b0d(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_cc2b0d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_cc2b0d(); +} diff --git a/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b268816347 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void trunc_cc2b0d() { + float16_t res = trunc(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_cc2b0d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_cc2b0d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_cc2b0d(); + return; +} diff --git a/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..afe8dc6b72 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void trunc_cc2b0d() { + float16_t res = trunc(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_cc2b0d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_cc2b0d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_cc2b0d(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000176C0197D30(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000176C0197D30(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.glsl new file mode 100644 index 0000000000..257a5710b3 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void trunc_cc2b0d() { + float16_t res = trunc(0.0hf); +} + +vec4 vertex_main() { + trunc_cc2b0d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void trunc_cc2b0d() { + float16_t res = trunc(0.0hf); +} + +void fragment_main() { + trunc_cc2b0d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void trunc_cc2b0d() { + float16_t res = trunc(0.0hf); +} + +void compute_main() { + trunc_cc2b0d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.msl b/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.msl new file mode 100644 index 0000000000..b2c50aaa8e --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void trunc_cc2b0d() { + half res = trunc(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + trunc_cc2b0d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + trunc_cc2b0d(); + return; +} + +kernel void compute_main() { + trunc_cc2b0d(); + return; +} + diff --git a/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.spvasm new file mode 100644 index 0000000000..49a49a2092 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %trunc_cc2b0d "trunc_cc2b0d" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%trunc_cc2b0d = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Trunc %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %trunc_cc2b0d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %trunc_cc2b0d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %trunc_cc2b0d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.wgsl new file mode 100644 index 0000000000..a20cd36e1c --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn trunc_cc2b0d() { + var res : f16 = trunc(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_cc2b0d(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_cc2b0d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_cc2b0d(); +} diff --git a/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl b/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl new file mode 100644 index 0000000000..bae66bee52 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn trunc(vec<4, f16>) -> vec<4, f16> +fn trunc_ce7c17() { + var res: vec4 = trunc(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_ce7c17(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_ce7c17(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_ce7c17(); +} diff --git a/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..83e63a116f --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void trunc_ce7c17() { + vector res = trunc((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_ce7c17(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_ce7c17(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_ce7c17(); + return; +} diff --git a/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..08aa6d3b94 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void trunc_ce7c17() { + vector res = trunc((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_ce7c17(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_ce7c17(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_ce7c17(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000235C1E68810(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.glsl b/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.glsl new file mode 100644 index 0000000000..1ab86a51ad --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void trunc_ce7c17() { + f16vec4 res = trunc(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + trunc_ce7c17(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void trunc_ce7c17() { + f16vec4 res = trunc(f16vec4(0.0hf)); +} + +void fragment_main() { + trunc_ce7c17(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void trunc_ce7c17() { + f16vec4 res = trunc(f16vec4(0.0hf)); +} + +void compute_main() { + trunc_ce7c17(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.msl b/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.msl new file mode 100644 index 0000000000..bbb5f1e3e2 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void trunc_ce7c17() { + half4 res = trunc(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + trunc_ce7c17(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + trunc_ce7c17(); + return; +} + +kernel void compute_main() { + trunc_ce7c17(); + return; +} + diff --git a/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.spvasm new file mode 100644 index 0000000000..2eecaa2e26 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %trunc_ce7c17 "trunc_ce7c17" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%trunc_ce7c17 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Trunc %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %trunc_ce7c17 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %trunc_ce7c17 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %trunc_ce7c17 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.wgsl new file mode 100644 index 0000000000..0004a8c4a3 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn trunc_ce7c17() { + var res : vec4 = trunc(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_ce7c17(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_ce7c17(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_ce7c17(); +} diff --git a/test/tint/builtins/gen/var/abs/421ca3.wgsl b/test/tint/builtins/gen/var/abs/421ca3.wgsl new file mode 100644 index 0000000000..c5557d3864 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/421ca3.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn abs(vec<3, f16>) -> vec<3, f16> +fn abs_421ca3() { + var arg_0 = vec3(f16()); + var res: vec3 = abs(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_421ca3(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_421ca3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_421ca3(); +} diff --git a/test/tint/builtins/gen/var/abs/421ca3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/abs/421ca3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cd5239b78d --- /dev/null +++ b/test/tint/builtins/gen/var/abs/421ca3.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void abs_421ca3() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_421ca3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_421ca3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_421ca3(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/421ca3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/abs/421ca3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5e90e2dffd --- /dev/null +++ b/test/tint/builtins/gen/var/abs/421ca3.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void abs_421ca3() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_421ca3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_421ca3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_421ca3(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002C922E88770(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002C922E88770(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/abs/421ca3.wgsl.expected.glsl b/test/tint/builtins/gen/var/abs/421ca3.wgsl.expected.glsl new file mode 100644 index 0000000000..8ddae5f59f --- /dev/null +++ b/test/tint/builtins/gen/var/abs/421ca3.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void abs_421ca3() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = abs(arg_0); +} + +vec4 vertex_main() { + abs_421ca3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void abs_421ca3() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = abs(arg_0); +} + +void fragment_main() { + abs_421ca3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void abs_421ca3() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = abs(arg_0); +} + +void compute_main() { + abs_421ca3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/421ca3.wgsl.expected.msl b/test/tint/builtins/gen/var/abs/421ca3.wgsl.expected.msl new file mode 100644 index 0000000000..e40c3ac86a --- /dev/null +++ b/test/tint/builtins/gen/var/abs/421ca3.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void abs_421ca3() { + half3 arg_0 = half3(0.0h); + half3 res = fabs(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_421ca3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_421ca3(); + return; +} + +kernel void compute_main() { + abs_421ca3(); + return; +} + diff --git a/test/tint/builtins/gen/var/abs/421ca3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/abs/421ca3.wgsl.expected.spvasm new file mode 100644 index 0000000000..1f1be0aec4 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/421ca3.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_421ca3 "abs_421ca3" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %abs_421ca3 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 FAbs %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %abs_421ca3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %abs_421ca3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %abs_421ca3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/abs/421ca3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/abs/421ca3.wgsl.expected.wgsl new file mode 100644 index 0000000000..7d15e4aebc --- /dev/null +++ b/test/tint/builtins/gen/var/abs/421ca3.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn abs_421ca3() { + var arg_0 = vec3(f16()); + var res : vec3 = abs(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_421ca3(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_421ca3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_421ca3(); +} diff --git a/test/tint/builtins/gen/var/abs/538d29.wgsl b/test/tint/builtins/gen/var/abs/538d29.wgsl new file mode 100644 index 0000000000..333532f40d --- /dev/null +++ b/test/tint/builtins/gen/var/abs/538d29.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn abs(vec<4, f16>) -> vec<4, f16> +fn abs_538d29() { + var arg_0 = vec4(f16()); + var res: vec4 = abs(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_538d29(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_538d29(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_538d29(); +} diff --git a/test/tint/builtins/gen/var/abs/538d29.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/abs/538d29.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..99a98603c7 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/538d29.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void abs_538d29() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_538d29(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_538d29(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_538d29(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/538d29.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/abs/538d29.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1f4e9ce445 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/538d29.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void abs_538d29() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_538d29(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_538d29(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_538d29(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001B8FDD307F0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001B8FDD307F0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/abs/538d29.wgsl.expected.glsl b/test/tint/builtins/gen/var/abs/538d29.wgsl.expected.glsl new file mode 100644 index 0000000000..10d37e7f97 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/538d29.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void abs_538d29() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = abs(arg_0); +} + +vec4 vertex_main() { + abs_538d29(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void abs_538d29() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = abs(arg_0); +} + +void fragment_main() { + abs_538d29(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void abs_538d29() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = abs(arg_0); +} + +void compute_main() { + abs_538d29(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/538d29.wgsl.expected.msl b/test/tint/builtins/gen/var/abs/538d29.wgsl.expected.msl new file mode 100644 index 0000000000..3c8d74a014 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/538d29.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void abs_538d29() { + half4 arg_0 = half4(0.0h); + half4 res = fabs(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_538d29(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_538d29(); + return; +} + +kernel void compute_main() { + abs_538d29(); + return; +} + diff --git a/test/tint/builtins/gen/var/abs/538d29.wgsl.expected.spvasm b/test/tint/builtins/gen/var/abs/538d29.wgsl.expected.spvasm new file mode 100644 index 0000000000..777bcc2e4f --- /dev/null +++ b/test/tint/builtins/gen/var/abs/538d29.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_538d29 "abs_538d29" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %abs_538d29 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 FAbs %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %abs_538d29 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %abs_538d29 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %abs_538d29 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/abs/538d29.wgsl.expected.wgsl b/test/tint/builtins/gen/var/abs/538d29.wgsl.expected.wgsl new file mode 100644 index 0000000000..e7749f15e9 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/538d29.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn abs_538d29() { + var arg_0 = vec4(f16()); + var res : vec4 = abs(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_538d29(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_538d29(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_538d29(); +} diff --git a/test/tint/builtins/gen/var/abs/5ae4fe.wgsl b/test/tint/builtins/gen/var/abs/5ae4fe.wgsl new file mode 100644 index 0000000000..19384bc9b6 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/5ae4fe.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn abs(vec<2, f16>) -> vec<2, f16> +fn abs_5ae4fe() { + var arg_0 = vec2(f16()); + var res: vec2 = abs(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_5ae4fe(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_5ae4fe(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_5ae4fe(); +} diff --git a/test/tint/builtins/gen/var/abs/5ae4fe.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/abs/5ae4fe.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..eb119af9b1 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/5ae4fe.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void abs_5ae4fe() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_5ae4fe(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_5ae4fe(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_5ae4fe(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/5ae4fe.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/abs/5ae4fe.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..dc15e74690 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/5ae4fe.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void abs_5ae4fe() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_5ae4fe(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_5ae4fe(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_5ae4fe(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000183992C05E0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000183992C05E0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/abs/5ae4fe.wgsl.expected.glsl b/test/tint/builtins/gen/var/abs/5ae4fe.wgsl.expected.glsl new file mode 100644 index 0000000000..38a613d9a9 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/5ae4fe.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void abs_5ae4fe() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = abs(arg_0); +} + +vec4 vertex_main() { + abs_5ae4fe(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void abs_5ae4fe() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = abs(arg_0); +} + +void fragment_main() { + abs_5ae4fe(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void abs_5ae4fe() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = abs(arg_0); +} + +void compute_main() { + abs_5ae4fe(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/5ae4fe.wgsl.expected.msl b/test/tint/builtins/gen/var/abs/5ae4fe.wgsl.expected.msl new file mode 100644 index 0000000000..2a223eb9ec --- /dev/null +++ b/test/tint/builtins/gen/var/abs/5ae4fe.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void abs_5ae4fe() { + half2 arg_0 = half2(0.0h); + half2 res = fabs(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_5ae4fe(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_5ae4fe(); + return; +} + +kernel void compute_main() { + abs_5ae4fe(); + return; +} + diff --git a/test/tint/builtins/gen/var/abs/5ae4fe.wgsl.expected.spvasm b/test/tint/builtins/gen/var/abs/5ae4fe.wgsl.expected.spvasm new file mode 100644 index 0000000000..451a9324b3 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/5ae4fe.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_5ae4fe "abs_5ae4fe" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %abs_5ae4fe = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 FAbs %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %abs_5ae4fe + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %abs_5ae4fe + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %abs_5ae4fe + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/abs/5ae4fe.wgsl.expected.wgsl b/test/tint/builtins/gen/var/abs/5ae4fe.wgsl.expected.wgsl new file mode 100644 index 0000000000..fe5cd69d41 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/5ae4fe.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn abs_5ae4fe() { + var arg_0 = vec2(f16()); + var res : vec2 = abs(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_5ae4fe(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_5ae4fe(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_5ae4fe(); +} diff --git a/test/tint/builtins/gen/var/abs/fd247f.wgsl b/test/tint/builtins/gen/var/abs/fd247f.wgsl new file mode 100644 index 0000000000..a347b41699 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/fd247f.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn abs(f16) -> f16 +fn abs_fd247f() { + var arg_0 = f16(); + var res: f16 = abs(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_fd247f(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_fd247f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_fd247f(); +} diff --git a/test/tint/builtins/gen/var/abs/fd247f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/abs/fd247f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..94ac0c575d --- /dev/null +++ b/test/tint/builtins/gen/var/abs/fd247f.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void abs_fd247f() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_fd247f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_fd247f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_fd247f(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/fd247f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/abs/fd247f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..891b948f02 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/fd247f.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void abs_fd247f() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_fd247f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_fd247f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_fd247f(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002C33CE4C600(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002C33CE4C600(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/abs/fd247f.wgsl.expected.glsl b/test/tint/builtins/gen/var/abs/fd247f.wgsl.expected.glsl new file mode 100644 index 0000000000..704f3ef46a --- /dev/null +++ b/test/tint/builtins/gen/var/abs/fd247f.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void abs_fd247f() { + float16_t arg_0 = 0.0hf; + float16_t res = abs(arg_0); +} + +vec4 vertex_main() { + abs_fd247f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void abs_fd247f() { + float16_t arg_0 = 0.0hf; + float16_t res = abs(arg_0); +} + +void fragment_main() { + abs_fd247f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void abs_fd247f() { + float16_t arg_0 = 0.0hf; + float16_t res = abs(arg_0); +} + +void compute_main() { + abs_fd247f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/fd247f.wgsl.expected.msl b/test/tint/builtins/gen/var/abs/fd247f.wgsl.expected.msl new file mode 100644 index 0000000000..0090547046 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/fd247f.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void abs_fd247f() { + half arg_0 = 0.0h; + half res = fabs(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_fd247f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_fd247f(); + return; +} + +kernel void compute_main() { + abs_fd247f(); + return; +} + diff --git a/test/tint/builtins/gen/var/abs/fd247f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/abs/fd247f.wgsl.expected.spvasm new file mode 100644 index 0000000000..7594c69b3a --- /dev/null +++ b/test/tint/builtins/gen/var/abs/fd247f.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_fd247f "abs_fd247f" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %abs_fd247f = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 FAbs %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %abs_fd247f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %abs_fd247f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %abs_fd247f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/abs/fd247f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/abs/fd247f.wgsl.expected.wgsl new file mode 100644 index 0000000000..99d265c381 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/fd247f.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn abs_fd247f() { + var arg_0 = f16(); + var res : f16 = abs(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_fd247f(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_fd247f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_fd247f(); +} diff --git a/test/tint/builtins/gen/var/acos/004aff.wgsl b/test/tint/builtins/gen/var/acos/004aff.wgsl new file mode 100644 index 0000000000..a414dbc891 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/004aff.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn acos(vec<2, f16>) -> vec<2, f16> +fn acos_004aff() { + var arg_0 = vec2(f16()); + var res: vec2 = acos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_004aff(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_004aff(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_004aff(); +} diff --git a/test/tint/builtins/gen/var/acos/004aff.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/acos/004aff.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..46a0caf756 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/004aff.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void acos_004aff() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = acos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_004aff(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_004aff(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_004aff(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/004aff.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/acos/004aff.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6332759029 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/004aff.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void acos_004aff() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = acos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_004aff(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_004aff(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_004aff(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000014A098A05E0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000014A098A05E0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/acos/004aff.wgsl.expected.glsl b/test/tint/builtins/gen/var/acos/004aff.wgsl.expected.glsl new file mode 100644 index 0000000000..1b33ea1962 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/004aff.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void acos_004aff() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = acos(arg_0); +} + +vec4 vertex_main() { + acos_004aff(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void acos_004aff() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = acos(arg_0); +} + +void fragment_main() { + acos_004aff(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void acos_004aff() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = acos(arg_0); +} + +void compute_main() { + acos_004aff(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/004aff.wgsl.expected.msl b/test/tint/builtins/gen/var/acos/004aff.wgsl.expected.msl new file mode 100644 index 0000000000..c5a6e7637b --- /dev/null +++ b/test/tint/builtins/gen/var/acos/004aff.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void acos_004aff() { + half2 arg_0 = half2(0.0h); + half2 res = acos(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acos_004aff(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acos_004aff(); + return; +} + +kernel void compute_main() { + acos_004aff(); + return; +} + diff --git a/test/tint/builtins/gen/var/acos/004aff.wgsl.expected.spvasm b/test/tint/builtins/gen/var/acos/004aff.wgsl.expected.spvasm new file mode 100644 index 0000000000..b654c2f795 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/004aff.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %acos_004aff "acos_004aff" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%acos_004aff = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Acos %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %acos_004aff + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %acos_004aff + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %acos_004aff + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/acos/004aff.wgsl.expected.wgsl b/test/tint/builtins/gen/var/acos/004aff.wgsl.expected.wgsl new file mode 100644 index 0000000000..9f2035be4a --- /dev/null +++ b/test/tint/builtins/gen/var/acos/004aff.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn acos_004aff() { + var arg_0 = vec2(f16()); + var res : vec2 = acos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_004aff(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_004aff(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_004aff(); +} diff --git a/test/tint/builtins/gen/var/acos/203628.wgsl b/test/tint/builtins/gen/var/acos/203628.wgsl new file mode 100644 index 0000000000..6ec10ba5f2 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/203628.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn acos(vec<4, f16>) -> vec<4, f16> +fn acos_203628() { + var arg_0 = vec4(f16()); + var res: vec4 = acos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_203628(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_203628(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_203628(); +} diff --git a/test/tint/builtins/gen/var/acos/203628.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/acos/203628.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b2c8911e27 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/203628.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void acos_203628() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = acos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_203628(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_203628(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_203628(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/203628.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/acos/203628.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..388e412757 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/203628.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void acos_203628() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = acos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_203628(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_203628(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_203628(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000227066CF430(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000227066CF430(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/acos/203628.wgsl.expected.glsl b/test/tint/builtins/gen/var/acos/203628.wgsl.expected.glsl new file mode 100644 index 0000000000..fa94d0f58c --- /dev/null +++ b/test/tint/builtins/gen/var/acos/203628.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void acos_203628() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = acos(arg_0); +} + +vec4 vertex_main() { + acos_203628(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void acos_203628() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = acos(arg_0); +} + +void fragment_main() { + acos_203628(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void acos_203628() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = acos(arg_0); +} + +void compute_main() { + acos_203628(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/203628.wgsl.expected.msl b/test/tint/builtins/gen/var/acos/203628.wgsl.expected.msl new file mode 100644 index 0000000000..9f35174fd5 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/203628.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void acos_203628() { + half4 arg_0 = half4(0.0h); + half4 res = acos(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acos_203628(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acos_203628(); + return; +} + +kernel void compute_main() { + acos_203628(); + return; +} + diff --git a/test/tint/builtins/gen/var/acos/203628.wgsl.expected.spvasm b/test/tint/builtins/gen/var/acos/203628.wgsl.expected.spvasm new file mode 100644 index 0000000000..3069e9aa25 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/203628.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %acos_203628 "acos_203628" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%acos_203628 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Acos %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %acos_203628 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %acos_203628 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %acos_203628 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/acos/203628.wgsl.expected.wgsl b/test/tint/builtins/gen/var/acos/203628.wgsl.expected.wgsl new file mode 100644 index 0000000000..78fc613d50 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/203628.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn acos_203628() { + var arg_0 = vec4(f16()); + var res : vec4 = acos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_203628(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_203628(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_203628(); +} diff --git a/test/tint/builtins/gen/var/acos/303e3d.wgsl b/test/tint/builtins/gen/var/acos/303e3d.wgsl new file mode 100644 index 0000000000..39290afec5 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/303e3d.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn acos(f16) -> f16 +fn acos_303e3d() { + var arg_0 = f16(); + var res: f16 = acos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_303e3d(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_303e3d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_303e3d(); +} diff --git a/test/tint/builtins/gen/var/acos/303e3d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/acos/303e3d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..dd39161e8e --- /dev/null +++ b/test/tint/builtins/gen/var/acos/303e3d.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void acos_303e3d() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = acos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_303e3d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_303e3d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_303e3d(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/303e3d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/acos/303e3d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..48013a182b --- /dev/null +++ b/test/tint/builtins/gen/var/acos/303e3d.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void acos_303e3d() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = acos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_303e3d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_303e3d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_303e3d(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C6C153CEA0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C6C153CEA0(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/acos/303e3d.wgsl.expected.glsl b/test/tint/builtins/gen/var/acos/303e3d.wgsl.expected.glsl new file mode 100644 index 0000000000..5a6a3e3b17 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/303e3d.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void acos_303e3d() { + float16_t arg_0 = 0.0hf; + float16_t res = acos(arg_0); +} + +vec4 vertex_main() { + acos_303e3d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void acos_303e3d() { + float16_t arg_0 = 0.0hf; + float16_t res = acos(arg_0); +} + +void fragment_main() { + acos_303e3d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void acos_303e3d() { + float16_t arg_0 = 0.0hf; + float16_t res = acos(arg_0); +} + +void compute_main() { + acos_303e3d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/303e3d.wgsl.expected.msl b/test/tint/builtins/gen/var/acos/303e3d.wgsl.expected.msl new file mode 100644 index 0000000000..05c4e64b42 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/303e3d.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void acos_303e3d() { + half arg_0 = 0.0h; + half res = acos(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acos_303e3d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acos_303e3d(); + return; +} + +kernel void compute_main() { + acos_303e3d(); + return; +} + diff --git a/test/tint/builtins/gen/var/acos/303e3d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/acos/303e3d.wgsl.expected.spvasm new file mode 100644 index 0000000000..b915e0d28d --- /dev/null +++ b/test/tint/builtins/gen/var/acos/303e3d.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %acos_303e3d "acos_303e3d" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%acos_303e3d = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Acos %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %acos_303e3d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %acos_303e3d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %acos_303e3d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/acos/303e3d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/acos/303e3d.wgsl.expected.wgsl new file mode 100644 index 0000000000..e91cf5b527 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/303e3d.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn acos_303e3d() { + var arg_0 = f16(); + var res : f16 = acos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_303e3d(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_303e3d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_303e3d(); +} diff --git a/test/tint/builtins/gen/var/acos/f47057.wgsl b/test/tint/builtins/gen/var/acos/f47057.wgsl new file mode 100644 index 0000000000..b1b2fe7dc2 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/f47057.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn acos(vec<3, f16>) -> vec<3, f16> +fn acos_f47057() { + var arg_0 = vec3(f16()); + var res: vec3 = acos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_f47057(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_f47057(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_f47057(); +} diff --git a/test/tint/builtins/gen/var/acos/f47057.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/acos/f47057.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8f0fa43bad --- /dev/null +++ b/test/tint/builtins/gen/var/acos/f47057.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void acos_f47057() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = acos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_f47057(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_f47057(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_f47057(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/f47057.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/acos/f47057.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9b3376d6cd --- /dev/null +++ b/test/tint/builtins/gen/var/acos/f47057.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void acos_f47057() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = acos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_f47057(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_f47057(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_f47057(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000287C9AECA00(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000287C9AECA00(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/acos/f47057.wgsl.expected.glsl b/test/tint/builtins/gen/var/acos/f47057.wgsl.expected.glsl new file mode 100644 index 0000000000..67209db4c6 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/f47057.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void acos_f47057() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = acos(arg_0); +} + +vec4 vertex_main() { + acos_f47057(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void acos_f47057() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = acos(arg_0); +} + +void fragment_main() { + acos_f47057(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void acos_f47057() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = acos(arg_0); +} + +void compute_main() { + acos_f47057(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/f47057.wgsl.expected.msl b/test/tint/builtins/gen/var/acos/f47057.wgsl.expected.msl new file mode 100644 index 0000000000..376ae7ee68 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/f47057.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void acos_f47057() { + half3 arg_0 = half3(0.0h); + half3 res = acos(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acos_f47057(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acos_f47057(); + return; +} + +kernel void compute_main() { + acos_f47057(); + return; +} + diff --git a/test/tint/builtins/gen/var/acos/f47057.wgsl.expected.spvasm b/test/tint/builtins/gen/var/acos/f47057.wgsl.expected.spvasm new file mode 100644 index 0000000000..dcfdc44df6 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/f47057.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %acos_f47057 "acos_f47057" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%acos_f47057 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Acos %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %acos_f47057 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %acos_f47057 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %acos_f47057 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/acos/f47057.wgsl.expected.wgsl b/test/tint/builtins/gen/var/acos/f47057.wgsl.expected.wgsl new file mode 100644 index 0000000000..5b55578aa1 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/f47057.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn acos_f47057() { + var arg_0 = vec3(f16()); + var res : vec3 = acos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_f47057(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_f47057(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_f47057(); +} diff --git a/test/tint/builtins/gen/var/acosh/5f49d8.wgsl b/test/tint/builtins/gen/var/acosh/5f49d8.wgsl new file mode 100644 index 0000000000..d421a819a2 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/5f49d8.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn acosh(vec<2, f16>) -> vec<2, f16> +fn acosh_5f49d8() { + var arg_0 = vec2(f16()); + var res: vec2 = acosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_5f49d8(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_5f49d8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_5f49d8(); +} diff --git a/test/tint/builtins/gen/var/acosh/5f49d8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/acosh/5f49d8.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d2768e742e --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/5f49d8.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +vector tint_acosh(vector x) { + return log((x + sqrt(((x * x) - float16_t(1.0h))))); +} + +void acosh_5f49d8() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = tint_acosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_5f49d8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_5f49d8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_5f49d8(); + return; +} diff --git a/test/tint/builtins/gen/var/acosh/5f49d8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/acosh/5f49d8.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bfa965b2cd --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/5f49d8.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +vector tint_acosh(vector x) { + return log((x + sqrt(((x * x) - float16_t(1.0h))))); +} + +void acosh_5f49d8() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = tint_acosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_5f49d8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_5f49d8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_5f49d8(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002311F9F6BD0(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/acosh/5f49d8.wgsl.expected.glsl b/test/tint/builtins/gen/var/acosh/5f49d8.wgsl.expected.glsl new file mode 100644 index 0000000000..033e902092 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/5f49d8.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec2 tint_acosh(f16vec2 x) { + return mix(acosh(x), f16vec2(0.0hf), lessThan(x, f16vec2(1.0hf))); +} + +void acosh_5f49d8() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = tint_acosh(arg_0); +} + +vec4 vertex_main() { + acosh_5f49d8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec2 tint_acosh(f16vec2 x) { + return mix(acosh(x), f16vec2(0.0hf), lessThan(x, f16vec2(1.0hf))); +} + +void acosh_5f49d8() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = tint_acosh(arg_0); +} + +void fragment_main() { + acosh_5f49d8(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec2 tint_acosh(f16vec2 x) { + return mix(acosh(x), f16vec2(0.0hf), lessThan(x, f16vec2(1.0hf))); +} + +void acosh_5f49d8() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = tint_acosh(arg_0); +} + +void compute_main() { + acosh_5f49d8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/acosh/5f49d8.wgsl.expected.msl b/test/tint/builtins/gen/var/acosh/5f49d8.wgsl.expected.msl new file mode 100644 index 0000000000..b6ed0f0939 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/5f49d8.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +half2 tint_acosh(half2 x) { + return select(acosh(x), half2(0.0h), (x < half2(1.0h))); +} + +void acosh_5f49d8() { + half2 arg_0 = half2(0.0h); + half2 res = tint_acosh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acosh_5f49d8(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acosh_5f49d8(); + return; +} + +kernel void compute_main() { + acosh_5f49d8(); + return; +} + diff --git a/test/tint/builtins/gen/var/acosh/5f49d8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/acosh/5f49d8.wgsl.expected.spvasm new file mode 100644 index 0000000000..bb409ff113 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/5f49d8.wgsl.expected.spvasm @@ -0,0 +1,91 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_acosh "tint_acosh" + OpName %x "x" + OpName %acosh_5f49d8 "acosh_5f49d8" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %9 = OpTypeFunction %v2half %v2half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %17 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_0 + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %21 = OpConstantNull %v2half + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_Function_v2half = OpTypePointer Function %v2half + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tint_acosh = OpFunction %v2half None %9 + %x = OpFunctionParameter %v2half + %14 = OpLabel + %18 = OpFOrdLessThan %v2bool %x %17 + %22 = OpExtInst %v2half %23 Acosh %x + %15 = OpSelect %v2half %18 %21 %22 + OpReturnValue %15 + OpFunctionEnd +%acosh_5f49d8 = OpFunction %void None %24 + %27 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %21 + %res = OpVariable %_ptr_Function_v2half Function %21 + OpStore %arg_0 %21 + %31 = OpLoad %v2half %arg_0 + %30 = OpFunctionCall %v2half %tint_acosh %31 + OpStore %res %30 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %acosh_5f49d8 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %24 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %24 + %42 = OpLabel + %43 = OpFunctionCall %void %acosh_5f49d8 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %24 + %45 = OpLabel + %46 = OpFunctionCall %void %acosh_5f49d8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/acosh/5f49d8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/acosh/5f49d8.wgsl.expected.wgsl new file mode 100644 index 0000000000..027ad7249e --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/5f49d8.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn acosh_5f49d8() { + var arg_0 = vec2(f16()); + var res : vec2 = acosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_5f49d8(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_5f49d8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_5f49d8(); +} diff --git a/test/tint/builtins/gen/var/acosh/a37dfe.wgsl b/test/tint/builtins/gen/var/acosh/a37dfe.wgsl new file mode 100644 index 0000000000..805b9faeac --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/a37dfe.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn acosh(f16) -> f16 +fn acosh_a37dfe() { + var arg_0 = f16(); + var res: f16 = acosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_a37dfe(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_a37dfe(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_a37dfe(); +} diff --git a/test/tint/builtins/gen/var/acosh/a37dfe.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/acosh/a37dfe.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..632b73091a --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/a37dfe.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +float16_t tint_acosh(float16_t x) { + return log((x + sqrt(((x * x) - float16_t(1.0h))))); +} + +void acosh_a37dfe() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = tint_acosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_a37dfe(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_a37dfe(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_a37dfe(); + return; +} diff --git a/test/tint/builtins/gen/var/acosh/a37dfe.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/acosh/a37dfe.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ca1ca1308b --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/a37dfe.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +float16_t tint_acosh(float16_t x) { + return log((x + sqrt(((x * x) - float16_t(1.0h))))); +} + +void acosh_a37dfe() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = tint_acosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_a37dfe(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_a37dfe(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_a37dfe(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D63F571640(1,1-9): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/builtins/gen/var/acosh/a37dfe.wgsl.expected.glsl b/test/tint/builtins/gen/var/acosh/a37dfe.wgsl.expected.glsl new file mode 100644 index 0000000000..be2d5fea3a --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/a37dfe.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +float16_t tint_acosh(float16_t x) { + return ((x < 1.0hf) ? 0.0hf : acosh(x)); +} + +void acosh_a37dfe() { + float16_t arg_0 = 0.0hf; + float16_t res = tint_acosh(arg_0); +} + +vec4 vertex_main() { + acosh_a37dfe(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +float16_t tint_acosh(float16_t x) { + return ((x < 1.0hf) ? 0.0hf : acosh(x)); +} + +void acosh_a37dfe() { + float16_t arg_0 = 0.0hf; + float16_t res = tint_acosh(arg_0); +} + +void fragment_main() { + acosh_a37dfe(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +float16_t tint_acosh(float16_t x) { + return ((x < 1.0hf) ? 0.0hf : acosh(x)); +} + +void acosh_a37dfe() { + float16_t arg_0 = 0.0hf; + float16_t res = tint_acosh(arg_0); +} + +void compute_main() { + acosh_a37dfe(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/acosh/a37dfe.wgsl.expected.msl b/test/tint/builtins/gen/var/acosh/a37dfe.wgsl.expected.msl new file mode 100644 index 0000000000..77aed14e97 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/a37dfe.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +half tint_acosh(half x) { + return select(acosh(x), 0.0h, (x < 1.0h)); +} + +void acosh_a37dfe() { + half arg_0 = 0.0h; + half res = tint_acosh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acosh_a37dfe(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acosh_a37dfe(); + return; +} + +kernel void compute_main() { + acosh_a37dfe(); + return; +} + diff --git a/test/tint/builtins/gen/var/acosh/a37dfe.wgsl.expected.spvasm b/test/tint/builtins/gen/var/acosh/a37dfe.wgsl.expected.spvasm new file mode 100644 index 0000000000..1eede38652 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/a37dfe.wgsl.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_acosh "tint_acosh" + OpName %x "x" + OpName %acosh_a37dfe "acosh_a37dfe" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %half = OpTypeFloat 16 + %9 = OpTypeFunction %half %half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %bool = OpTypeBool + %18 = OpConstantNull %half + %void = OpTypeVoid + %21 = OpTypeFunction %void +%_ptr_Function_half = OpTypePointer Function %half + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tint_acosh = OpFunction %half None %9 + %x = OpFunctionParameter %half + %13 = OpLabel + %16 = OpFOrdLessThan %bool %x %half_0x1p_0 + %19 = OpExtInst %half %20 Acosh %x + %14 = OpSelect %half %16 %18 %19 + OpReturnValue %14 + OpFunctionEnd +%acosh_a37dfe = OpFunction %void None %21 + %24 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %18 + %res = OpVariable %_ptr_Function_half Function %18 + OpStore %arg_0 %18 + %28 = OpLoad %half %arg_0 + %27 = OpFunctionCall %half %tint_acosh %28 + OpStore %res %27 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %acosh_a37dfe + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %21 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %21 + %39 = OpLabel + %40 = OpFunctionCall %void %acosh_a37dfe + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %21 + %42 = OpLabel + %43 = OpFunctionCall %void %acosh_a37dfe + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/acosh/a37dfe.wgsl.expected.wgsl b/test/tint/builtins/gen/var/acosh/a37dfe.wgsl.expected.wgsl new file mode 100644 index 0000000000..c5a84365b9 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/a37dfe.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn acosh_a37dfe() { + var arg_0 = f16(); + var res : f16 = acosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_a37dfe(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_a37dfe(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_a37dfe(); +} diff --git a/test/tint/builtins/gen/var/acosh/de60d8.wgsl b/test/tint/builtins/gen/var/acosh/de60d8.wgsl new file mode 100644 index 0000000000..06b3c4aeea --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/de60d8.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn acosh(vec<4, f16>) -> vec<4, f16> +fn acosh_de60d8() { + var arg_0 = vec4(f16()); + var res: vec4 = acosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_de60d8(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_de60d8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_de60d8(); +} diff --git a/test/tint/builtins/gen/var/acosh/de60d8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/acosh/de60d8.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..beda5f45dc --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/de60d8.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +vector tint_acosh(vector x) { + return log((x + sqrt(((x * x) - float16_t(1.0h))))); +} + +void acosh_de60d8() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = tint_acosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_de60d8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_de60d8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_de60d8(); + return; +} diff --git a/test/tint/builtins/gen/var/acosh/de60d8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/acosh/de60d8.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f2776f040e --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/de60d8.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +vector tint_acosh(vector x) { + return log((x + sqrt(((x * x) - float16_t(1.0h))))); +} + +void acosh_de60d8() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = tint_acosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_de60d8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_de60d8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_de60d8(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021E640184D0(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/acosh/de60d8.wgsl.expected.glsl b/test/tint/builtins/gen/var/acosh/de60d8.wgsl.expected.glsl new file mode 100644 index 0000000000..b63ecb78b7 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/de60d8.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec4 tint_acosh(f16vec4 x) { + return mix(acosh(x), f16vec4(0.0hf), lessThan(x, f16vec4(1.0hf))); +} + +void acosh_de60d8() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = tint_acosh(arg_0); +} + +vec4 vertex_main() { + acosh_de60d8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec4 tint_acosh(f16vec4 x) { + return mix(acosh(x), f16vec4(0.0hf), lessThan(x, f16vec4(1.0hf))); +} + +void acosh_de60d8() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = tint_acosh(arg_0); +} + +void fragment_main() { + acosh_de60d8(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec4 tint_acosh(f16vec4 x) { + return mix(acosh(x), f16vec4(0.0hf), lessThan(x, f16vec4(1.0hf))); +} + +void acosh_de60d8() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = tint_acosh(arg_0); +} + +void compute_main() { + acosh_de60d8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/acosh/de60d8.wgsl.expected.msl b/test/tint/builtins/gen/var/acosh/de60d8.wgsl.expected.msl new file mode 100644 index 0000000000..0514328be3 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/de60d8.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +half4 tint_acosh(half4 x) { + return select(acosh(x), half4(0.0h), (x < half4(1.0h))); +} + +void acosh_de60d8() { + half4 arg_0 = half4(0.0h); + half4 res = tint_acosh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acosh_de60d8(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acosh_de60d8(); + return; +} + +kernel void compute_main() { + acosh_de60d8(); + return; +} + diff --git a/test/tint/builtins/gen/var/acosh/de60d8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/acosh/de60d8.wgsl.expected.spvasm new file mode 100644 index 0000000000..10eef9fe20 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/de60d8.wgsl.expected.spvasm @@ -0,0 +1,91 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_acosh "tint_acosh" + OpName %x "x" + OpName %acosh_de60d8 "acosh_de60d8" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %9 = OpTypeFunction %v4half %v4half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %17 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %21 = OpConstantNull %v4half + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_Function_v4half = OpTypePointer Function %v4half + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tint_acosh = OpFunction %v4half None %9 + %x = OpFunctionParameter %v4half + %14 = OpLabel + %18 = OpFOrdLessThan %v4bool %x %17 + %22 = OpExtInst %v4half %23 Acosh %x + %15 = OpSelect %v4half %18 %21 %22 + OpReturnValue %15 + OpFunctionEnd +%acosh_de60d8 = OpFunction %void None %24 + %27 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %21 + %res = OpVariable %_ptr_Function_v4half Function %21 + OpStore %arg_0 %21 + %31 = OpLoad %v4half %arg_0 + %30 = OpFunctionCall %v4half %tint_acosh %31 + OpStore %res %30 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %acosh_de60d8 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %24 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %24 + %42 = OpLabel + %43 = OpFunctionCall %void %acosh_de60d8 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %24 + %45 = OpLabel + %46 = OpFunctionCall %void %acosh_de60d8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/acosh/de60d8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/acosh/de60d8.wgsl.expected.wgsl new file mode 100644 index 0000000000..d8a3b14733 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/de60d8.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn acosh_de60d8() { + var arg_0 = vec4(f16()); + var res : vec4 = acosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_de60d8(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_de60d8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_de60d8(); +} diff --git a/test/tint/builtins/gen/var/acosh/f56574.wgsl b/test/tint/builtins/gen/var/acosh/f56574.wgsl new file mode 100644 index 0000000000..b6e484af58 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/f56574.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn acosh(vec<3, f16>) -> vec<3, f16> +fn acosh_f56574() { + var arg_0 = vec3(f16()); + var res: vec3 = acosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_f56574(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_f56574(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_f56574(); +} diff --git a/test/tint/builtins/gen/var/acosh/f56574.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/acosh/f56574.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b89a6f9730 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/f56574.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +vector tint_acosh(vector x) { + return log((x + sqrt(((x * x) - float16_t(1.0h))))); +} + +void acosh_f56574() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = tint_acosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_f56574(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_f56574(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_f56574(); + return; +} diff --git a/test/tint/builtins/gen/var/acosh/f56574.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/acosh/f56574.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a5310948c5 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/f56574.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +vector tint_acosh(vector x) { + return log((x + sqrt(((x * x) - float16_t(1.0h))))); +} + +void acosh_f56574() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = tint_acosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_f56574(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_f56574(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_f56574(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000027554446BD0(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/acosh/f56574.wgsl.expected.glsl b/test/tint/builtins/gen/var/acosh/f56574.wgsl.expected.glsl new file mode 100644 index 0000000000..a5e2a4db81 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/f56574.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec3 tint_acosh(f16vec3 x) { + return mix(acosh(x), f16vec3(0.0hf), lessThan(x, f16vec3(1.0hf))); +} + +void acosh_f56574() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = tint_acosh(arg_0); +} + +vec4 vertex_main() { + acosh_f56574(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec3 tint_acosh(f16vec3 x) { + return mix(acosh(x), f16vec3(0.0hf), lessThan(x, f16vec3(1.0hf))); +} + +void acosh_f56574() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = tint_acosh(arg_0); +} + +void fragment_main() { + acosh_f56574(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec3 tint_acosh(f16vec3 x) { + return mix(acosh(x), f16vec3(0.0hf), lessThan(x, f16vec3(1.0hf))); +} + +void acosh_f56574() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = tint_acosh(arg_0); +} + +void compute_main() { + acosh_f56574(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/acosh/f56574.wgsl.expected.msl b/test/tint/builtins/gen/var/acosh/f56574.wgsl.expected.msl new file mode 100644 index 0000000000..7499b88191 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/f56574.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +half3 tint_acosh(half3 x) { + return select(acosh(x), half3(0.0h), (x < half3(1.0h))); +} + +void acosh_f56574() { + half3 arg_0 = half3(0.0h); + half3 res = tint_acosh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acosh_f56574(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acosh_f56574(); + return; +} + +kernel void compute_main() { + acosh_f56574(); + return; +} + diff --git a/test/tint/builtins/gen/var/acosh/f56574.wgsl.expected.spvasm b/test/tint/builtins/gen/var/acosh/f56574.wgsl.expected.spvasm new file mode 100644 index 0000000000..d818740162 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/f56574.wgsl.expected.spvasm @@ -0,0 +1,91 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_acosh "tint_acosh" + OpName %x "x" + OpName %acosh_f56574 "acosh_f56574" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %9 = OpTypeFunction %v3half %v3half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %17 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %21 = OpConstantNull %v3half + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_Function_v3half = OpTypePointer Function %v3half + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tint_acosh = OpFunction %v3half None %9 + %x = OpFunctionParameter %v3half + %14 = OpLabel + %18 = OpFOrdLessThan %v3bool %x %17 + %22 = OpExtInst %v3half %23 Acosh %x + %15 = OpSelect %v3half %18 %21 %22 + OpReturnValue %15 + OpFunctionEnd +%acosh_f56574 = OpFunction %void None %24 + %27 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %21 + %res = OpVariable %_ptr_Function_v3half Function %21 + OpStore %arg_0 %21 + %31 = OpLoad %v3half %arg_0 + %30 = OpFunctionCall %v3half %tint_acosh %31 + OpStore %res %30 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %acosh_f56574 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %24 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %24 + %42 = OpLabel + %43 = OpFunctionCall %void %acosh_f56574 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %24 + %45 = OpLabel + %46 = OpFunctionCall %void %acosh_f56574 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/acosh/f56574.wgsl.expected.wgsl b/test/tint/builtins/gen/var/acosh/f56574.wgsl.expected.wgsl new file mode 100644 index 0000000000..8cbc4f671c --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/f56574.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn acosh_f56574() { + var arg_0 = vec3(f16()); + var res : vec3 = acosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_f56574(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_f56574(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_f56574(); +} diff --git a/test/tint/builtins/gen/var/arrayLength/8421b9.wgsl b/test/tint/builtins/gen/var/arrayLength/8421b9.wgsl new file mode 100644 index 0000000000..0a049481b3 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/8421b9.wgsl @@ -0,0 +1,49 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; +struct SB_RO { + arg_0: array, +}; +@group(0) @binding(1) var sb_ro : SB_RO; + +// fn arrayLength(ptr, read>) -> u32 +fn arrayLength_8421b9() { + var res: u32 = arrayLength(&sb_ro.arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + arrayLength_8421b9(); + return vec4(); +} + +@fragment +fn fragment_main() { + arrayLength_8421b9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + arrayLength_8421b9(); +} diff --git a/test/tint/builtins/gen/var/arrayLength/8421b9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/arrayLength/8421b9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..58ecc49e88 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/8421b9.wgsl.expected.dxc.hlsl @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/var/arrayLength/8421b9.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/var/arrayLength/8421b9.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RO { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RO { +^^^^^^ + +gen/var/arrayLength/8421b9.wgsl:28:42 note: see declaration of variable +@group(0) @binding(1) var sb_ro : SB_RO; + ^^^^^ + diff --git a/test/tint/builtins/gen/var/arrayLength/8421b9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/arrayLength/8421b9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..58ecc49e88 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/8421b9.wgsl.expected.fxc.hlsl @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/var/arrayLength/8421b9.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/var/arrayLength/8421b9.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RO { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RO { +^^^^^^ + +gen/var/arrayLength/8421b9.wgsl:28:42 note: see declaration of variable +@group(0) @binding(1) var sb_ro : SB_RO; + ^^^^^ + diff --git a/test/tint/builtins/gen/var/arrayLength/8421b9.wgsl.expected.glsl b/test/tint/builtins/gen/var/arrayLength/8421b9.wgsl.expected.glsl new file mode 100644 index 0000000000..58ecc49e88 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/8421b9.wgsl.expected.glsl @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/var/arrayLength/8421b9.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/var/arrayLength/8421b9.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RO { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RO { +^^^^^^ + +gen/var/arrayLength/8421b9.wgsl:28:42 note: see declaration of variable +@group(0) @binding(1) var sb_ro : SB_RO; + ^^^^^ + diff --git a/test/tint/builtins/gen/var/arrayLength/8421b9.wgsl.expected.msl b/test/tint/builtins/gen/var/arrayLength/8421b9.wgsl.expected.msl new file mode 100644 index 0000000000..58ecc49e88 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/8421b9.wgsl.expected.msl @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/var/arrayLength/8421b9.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/var/arrayLength/8421b9.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RO { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RO { +^^^^^^ + +gen/var/arrayLength/8421b9.wgsl:28:42 note: see declaration of variable +@group(0) @binding(1) var sb_ro : SB_RO; + ^^^^^ + diff --git a/test/tint/builtins/gen/var/arrayLength/8421b9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/arrayLength/8421b9.wgsl.expected.spvasm new file mode 100644 index 0000000000..58ecc49e88 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/8421b9.wgsl.expected.spvasm @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/var/arrayLength/8421b9.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/var/arrayLength/8421b9.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RO { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RO { +^^^^^^ + +gen/var/arrayLength/8421b9.wgsl:28:42 note: see declaration of variable +@group(0) @binding(1) var sb_ro : SB_RO; + ^^^^^ + diff --git a/test/tint/builtins/gen/var/arrayLength/8421b9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/arrayLength/8421b9.wgsl.expected.wgsl new file mode 100644 index 0000000000..58ecc49e88 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/8421b9.wgsl.expected.wgsl @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/var/arrayLength/8421b9.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/var/arrayLength/8421b9.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RO { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RO { +^^^^^^ + +gen/var/arrayLength/8421b9.wgsl:28:42 note: see declaration of variable +@group(0) @binding(1) var sb_ro : SB_RO; + ^^^^^ + diff --git a/test/tint/builtins/gen/var/arrayLength/cbd6b5.wgsl b/test/tint/builtins/gen/var/arrayLength/cbd6b5.wgsl new file mode 100644 index 0000000000..e457a8a489 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/cbd6b5.wgsl @@ -0,0 +1,49 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; +struct SB_RW { + arg_0: array, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn arrayLength(ptr, read_write>) -> u32 +fn arrayLength_cbd6b5() { + var res: u32 = arrayLength(&sb_rw.arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + arrayLength_cbd6b5(); + return vec4(); +} + +@fragment +fn fragment_main() { + arrayLength_cbd6b5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + arrayLength_cbd6b5(); +} diff --git a/test/tint/builtins/gen/var/arrayLength/cbd6b5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/arrayLength/cbd6b5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..07baca0c0d --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/cbd6b5.wgsl.expected.dxc.hlsl @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/var/arrayLength/cbd6b5.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/var/arrayLength/cbd6b5.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RW { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RW { +^^^^^^ + +gen/var/arrayLength/cbd6b5.wgsl:28:48 note: see declaration of variable +@group(0) @binding(0) var sb_rw : SB_RW; + ^^^^^ + diff --git a/test/tint/builtins/gen/var/arrayLength/cbd6b5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/arrayLength/cbd6b5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..07baca0c0d --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/cbd6b5.wgsl.expected.fxc.hlsl @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/var/arrayLength/cbd6b5.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/var/arrayLength/cbd6b5.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RW { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RW { +^^^^^^ + +gen/var/arrayLength/cbd6b5.wgsl:28:48 note: see declaration of variable +@group(0) @binding(0) var sb_rw : SB_RW; + ^^^^^ + diff --git a/test/tint/builtins/gen/var/arrayLength/cbd6b5.wgsl.expected.glsl b/test/tint/builtins/gen/var/arrayLength/cbd6b5.wgsl.expected.glsl new file mode 100644 index 0000000000..07baca0c0d --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/cbd6b5.wgsl.expected.glsl @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/var/arrayLength/cbd6b5.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/var/arrayLength/cbd6b5.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RW { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RW { +^^^^^^ + +gen/var/arrayLength/cbd6b5.wgsl:28:48 note: see declaration of variable +@group(0) @binding(0) var sb_rw : SB_RW; + ^^^^^ + diff --git a/test/tint/builtins/gen/var/arrayLength/cbd6b5.wgsl.expected.msl b/test/tint/builtins/gen/var/arrayLength/cbd6b5.wgsl.expected.msl new file mode 100644 index 0000000000..07baca0c0d --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/cbd6b5.wgsl.expected.msl @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/var/arrayLength/cbd6b5.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/var/arrayLength/cbd6b5.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RW { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RW { +^^^^^^ + +gen/var/arrayLength/cbd6b5.wgsl:28:48 note: see declaration of variable +@group(0) @binding(0) var sb_rw : SB_RW; + ^^^^^ + diff --git a/test/tint/builtins/gen/var/arrayLength/cbd6b5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/arrayLength/cbd6b5.wgsl.expected.spvasm new file mode 100644 index 0000000000..07baca0c0d --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/cbd6b5.wgsl.expected.spvasm @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/var/arrayLength/cbd6b5.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/var/arrayLength/cbd6b5.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RW { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RW { +^^^^^^ + +gen/var/arrayLength/cbd6b5.wgsl:28:48 note: see declaration of variable +@group(0) @binding(0) var sb_rw : SB_RW; + ^^^^^ + diff --git a/test/tint/builtins/gen/var/arrayLength/cbd6b5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/arrayLength/cbd6b5.wgsl.expected.wgsl new file mode 100644 index 0000000000..07baca0c0d --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/cbd6b5.wgsl.expected.wgsl @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/var/arrayLength/cbd6b5.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/var/arrayLength/cbd6b5.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RW { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RW { +^^^^^^ + +gen/var/arrayLength/cbd6b5.wgsl:28:48 note: see declaration of variable +@group(0) @binding(0) var sb_rw : SB_RW; + ^^^^^ + diff --git a/test/tint/builtins/gen/var/asin/11dfda.wgsl b/test/tint/builtins/gen/var/asin/11dfda.wgsl new file mode 100644 index 0000000000..c9b250607d --- /dev/null +++ b/test/tint/builtins/gen/var/asin/11dfda.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn asin(f16) -> f16 +fn asin_11dfda() { + var arg_0 = f16(); + var res: f16 = asin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_11dfda(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_11dfda(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_11dfda(); +} diff --git a/test/tint/builtins/gen/var/asin/11dfda.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/asin/11dfda.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..10ac617a2f --- /dev/null +++ b/test/tint/builtins/gen/var/asin/11dfda.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void asin_11dfda() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = asin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_11dfda(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_11dfda(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_11dfda(); + return; +} diff --git a/test/tint/builtins/gen/var/asin/11dfda.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/asin/11dfda.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..806254cdc3 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/11dfda.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void asin_11dfda() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = asin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_11dfda(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_11dfda(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_11dfda(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D54DD58900(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D54DD58900(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/asin/11dfda.wgsl.expected.glsl b/test/tint/builtins/gen/var/asin/11dfda.wgsl.expected.glsl new file mode 100644 index 0000000000..948c08d4ad --- /dev/null +++ b/test/tint/builtins/gen/var/asin/11dfda.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asin_11dfda() { + float16_t arg_0 = 0.0hf; + float16_t res = asin(arg_0); +} + +vec4 vertex_main() { + asin_11dfda(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void asin_11dfda() { + float16_t arg_0 = 0.0hf; + float16_t res = asin(arg_0); +} + +void fragment_main() { + asin_11dfda(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asin_11dfda() { + float16_t arg_0 = 0.0hf; + float16_t res = asin(arg_0); +} + +void compute_main() { + asin_11dfda(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/asin/11dfda.wgsl.expected.msl b/test/tint/builtins/gen/var/asin/11dfda.wgsl.expected.msl new file mode 100644 index 0000000000..f59c879943 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/11dfda.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void asin_11dfda() { + half arg_0 = 0.0h; + half res = asin(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asin_11dfda(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asin_11dfda(); + return; +} + +kernel void compute_main() { + asin_11dfda(); + return; +} + diff --git a/test/tint/builtins/gen/var/asin/11dfda.wgsl.expected.spvasm b/test/tint/builtins/gen/var/asin/11dfda.wgsl.expected.spvasm new file mode 100644 index 0000000000..2e6097a9a1 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/11dfda.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asin_11dfda "asin_11dfda" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%asin_11dfda = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Asin %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %asin_11dfda + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %asin_11dfda + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %asin_11dfda + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/asin/11dfda.wgsl.expected.wgsl b/test/tint/builtins/gen/var/asin/11dfda.wgsl.expected.wgsl new file mode 100644 index 0000000000..abe2463306 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/11dfda.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn asin_11dfda() { + var arg_0 = f16(); + var res : f16 = asin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_11dfda(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_11dfda(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_11dfda(); +} diff --git a/test/tint/builtins/gen/var/asin/2d8e29.wgsl b/test/tint/builtins/gen/var/asin/2d8e29.wgsl new file mode 100644 index 0000000000..fdf613e9a5 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/2d8e29.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn asin(vec<3, f16>) -> vec<3, f16> +fn asin_2d8e29() { + var arg_0 = vec3(f16()); + var res: vec3 = asin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_2d8e29(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_2d8e29(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_2d8e29(); +} diff --git a/test/tint/builtins/gen/var/asin/2d8e29.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/asin/2d8e29.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4c22612734 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/2d8e29.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void asin_2d8e29() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = asin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_2d8e29(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_2d8e29(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_2d8e29(); + return; +} diff --git a/test/tint/builtins/gen/var/asin/2d8e29.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/asin/2d8e29.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c95a38dc01 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/2d8e29.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void asin_2d8e29() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = asin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_2d8e29(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_2d8e29(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_2d8e29(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000243E5218C90(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000243E5218C90(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/asin/2d8e29.wgsl.expected.glsl b/test/tint/builtins/gen/var/asin/2d8e29.wgsl.expected.glsl new file mode 100644 index 0000000000..e5c01aeb73 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/2d8e29.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asin_2d8e29() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = asin(arg_0); +} + +vec4 vertex_main() { + asin_2d8e29(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void asin_2d8e29() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = asin(arg_0); +} + +void fragment_main() { + asin_2d8e29(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asin_2d8e29() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = asin(arg_0); +} + +void compute_main() { + asin_2d8e29(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/asin/2d8e29.wgsl.expected.msl b/test/tint/builtins/gen/var/asin/2d8e29.wgsl.expected.msl new file mode 100644 index 0000000000..efafdf5cb7 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/2d8e29.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void asin_2d8e29() { + half3 arg_0 = half3(0.0h); + half3 res = asin(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asin_2d8e29(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asin_2d8e29(); + return; +} + +kernel void compute_main() { + asin_2d8e29(); + return; +} + diff --git a/test/tint/builtins/gen/var/asin/2d8e29.wgsl.expected.spvasm b/test/tint/builtins/gen/var/asin/2d8e29.wgsl.expected.spvasm new file mode 100644 index 0000000000..292429ed07 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/2d8e29.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asin_2d8e29 "asin_2d8e29" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%asin_2d8e29 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Asin %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %asin_2d8e29 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %asin_2d8e29 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %asin_2d8e29 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/asin/2d8e29.wgsl.expected.wgsl b/test/tint/builtins/gen/var/asin/2d8e29.wgsl.expected.wgsl new file mode 100644 index 0000000000..c93cae1f51 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/2d8e29.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn asin_2d8e29() { + var arg_0 = vec3(f16()); + var res : vec3 = asin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_2d8e29(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_2d8e29(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_2d8e29(); +} diff --git a/test/tint/builtins/gen/var/asin/3cfbd4.wgsl b/test/tint/builtins/gen/var/asin/3cfbd4.wgsl new file mode 100644 index 0000000000..022f69af8e --- /dev/null +++ b/test/tint/builtins/gen/var/asin/3cfbd4.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn asin(vec<4, f16>) -> vec<4, f16> +fn asin_3cfbd4() { + var arg_0 = vec4(f16()); + var res: vec4 = asin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_3cfbd4(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_3cfbd4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_3cfbd4(); +} diff --git a/test/tint/builtins/gen/var/asin/3cfbd4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/asin/3cfbd4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a35655859b --- /dev/null +++ b/test/tint/builtins/gen/var/asin/3cfbd4.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void asin_3cfbd4() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = asin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_3cfbd4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_3cfbd4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_3cfbd4(); + return; +} diff --git a/test/tint/builtins/gen/var/asin/3cfbd4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/asin/3cfbd4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..16015bbb6b --- /dev/null +++ b/test/tint/builtins/gen/var/asin/3cfbd4.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void asin_3cfbd4() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = asin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_3cfbd4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_3cfbd4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_3cfbd4(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000019720581EE0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000019720581EE0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/asin/3cfbd4.wgsl.expected.glsl b/test/tint/builtins/gen/var/asin/3cfbd4.wgsl.expected.glsl new file mode 100644 index 0000000000..35f9bd9cea --- /dev/null +++ b/test/tint/builtins/gen/var/asin/3cfbd4.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asin_3cfbd4() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = asin(arg_0); +} + +vec4 vertex_main() { + asin_3cfbd4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void asin_3cfbd4() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = asin(arg_0); +} + +void fragment_main() { + asin_3cfbd4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asin_3cfbd4() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = asin(arg_0); +} + +void compute_main() { + asin_3cfbd4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/asin/3cfbd4.wgsl.expected.msl b/test/tint/builtins/gen/var/asin/3cfbd4.wgsl.expected.msl new file mode 100644 index 0000000000..394f485044 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/3cfbd4.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void asin_3cfbd4() { + half4 arg_0 = half4(0.0h); + half4 res = asin(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asin_3cfbd4(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asin_3cfbd4(); + return; +} + +kernel void compute_main() { + asin_3cfbd4(); + return; +} + diff --git a/test/tint/builtins/gen/var/asin/3cfbd4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/asin/3cfbd4.wgsl.expected.spvasm new file mode 100644 index 0000000000..35e557c51a --- /dev/null +++ b/test/tint/builtins/gen/var/asin/3cfbd4.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asin_3cfbd4 "asin_3cfbd4" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%asin_3cfbd4 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Asin %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %asin_3cfbd4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %asin_3cfbd4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %asin_3cfbd4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/asin/3cfbd4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/asin/3cfbd4.wgsl.expected.wgsl new file mode 100644 index 0000000000..91e42c6252 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/3cfbd4.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn asin_3cfbd4() { + var arg_0 = vec4(f16()); + var res : vec4 = asin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_3cfbd4(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_3cfbd4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_3cfbd4(); +} diff --git a/test/tint/builtins/gen/var/asin/b4aced.wgsl b/test/tint/builtins/gen/var/asin/b4aced.wgsl new file mode 100644 index 0000000000..f69143a4e7 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/b4aced.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn asin(vec<2, f16>) -> vec<2, f16> +fn asin_b4aced() { + var arg_0 = vec2(f16()); + var res: vec2 = asin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_b4aced(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_b4aced(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_b4aced(); +} diff --git a/test/tint/builtins/gen/var/asin/b4aced.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/asin/b4aced.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4d0043aaf2 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/b4aced.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void asin_b4aced() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = asin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_b4aced(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_b4aced(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_b4aced(); + return; +} diff --git a/test/tint/builtins/gen/var/asin/b4aced.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/asin/b4aced.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..729a746438 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/b4aced.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void asin_b4aced() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = asin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_b4aced(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_b4aced(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_b4aced(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000274BBD1CA00(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000274BBD1CA00(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/asin/b4aced.wgsl.expected.glsl b/test/tint/builtins/gen/var/asin/b4aced.wgsl.expected.glsl new file mode 100644 index 0000000000..65fdee3486 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/b4aced.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asin_b4aced() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = asin(arg_0); +} + +vec4 vertex_main() { + asin_b4aced(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void asin_b4aced() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = asin(arg_0); +} + +void fragment_main() { + asin_b4aced(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asin_b4aced() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = asin(arg_0); +} + +void compute_main() { + asin_b4aced(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/asin/b4aced.wgsl.expected.msl b/test/tint/builtins/gen/var/asin/b4aced.wgsl.expected.msl new file mode 100644 index 0000000000..c2bab896df --- /dev/null +++ b/test/tint/builtins/gen/var/asin/b4aced.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void asin_b4aced() { + half2 arg_0 = half2(0.0h); + half2 res = asin(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asin_b4aced(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asin_b4aced(); + return; +} + +kernel void compute_main() { + asin_b4aced(); + return; +} + diff --git a/test/tint/builtins/gen/var/asin/b4aced.wgsl.expected.spvasm b/test/tint/builtins/gen/var/asin/b4aced.wgsl.expected.spvasm new file mode 100644 index 0000000000..b11a78292a --- /dev/null +++ b/test/tint/builtins/gen/var/asin/b4aced.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asin_b4aced "asin_b4aced" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%asin_b4aced = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Asin %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %asin_b4aced + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %asin_b4aced + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %asin_b4aced + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/asin/b4aced.wgsl.expected.wgsl b/test/tint/builtins/gen/var/asin/b4aced.wgsl.expected.wgsl new file mode 100644 index 0000000000..056003b5d9 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/b4aced.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn asin_b4aced() { + var arg_0 = vec2(f16()); + var res : vec2 = asin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_b4aced(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_b4aced(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_b4aced(); +} diff --git a/test/tint/builtins/gen/var/asinh/468a48.wgsl b/test/tint/builtins/gen/var/asinh/468a48.wgsl new file mode 100644 index 0000000000..6a2992f3c6 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/468a48.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn asinh(f16) -> f16 +fn asinh_468a48() { + var arg_0 = f16(); + var res: f16 = asinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_468a48(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_468a48(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_468a48(); +} diff --git a/test/tint/builtins/gen/var/asinh/468a48.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/asinh/468a48.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..bdeb8b8e75 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/468a48.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +float16_t tint_sinh(float16_t x) { + return log((x + sqrt(((x * x) + float16_t(1.0h))))); +} + +void asinh_468a48() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = tint_sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_468a48(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_468a48(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_468a48(); + return; +} diff --git a/test/tint/builtins/gen/var/asinh/468a48.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/asinh/468a48.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..dcbf45070a --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/468a48.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +float16_t tint_sinh(float16_t x) { + return log((x + sqrt(((x * x) + float16_t(1.0h))))); +} + +void asinh_468a48() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = tint_sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_468a48(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_468a48(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_468a48(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002776ED11E20(1,1-9): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/builtins/gen/var/asinh/468a48.wgsl.expected.glsl b/test/tint/builtins/gen/var/asinh/468a48.wgsl.expected.glsl new file mode 100644 index 0000000000..70eee10d64 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/468a48.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asinh_468a48() { + float16_t arg_0 = 0.0hf; + float16_t res = asinh(arg_0); +} + +vec4 vertex_main() { + asinh_468a48(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void asinh_468a48() { + float16_t arg_0 = 0.0hf; + float16_t res = asinh(arg_0); +} + +void fragment_main() { + asinh_468a48(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asinh_468a48() { + float16_t arg_0 = 0.0hf; + float16_t res = asinh(arg_0); +} + +void compute_main() { + asinh_468a48(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/asinh/468a48.wgsl.expected.msl b/test/tint/builtins/gen/var/asinh/468a48.wgsl.expected.msl new file mode 100644 index 0000000000..22a59d4014 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/468a48.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void asinh_468a48() { + half arg_0 = 0.0h; + half res = asinh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asinh_468a48(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asinh_468a48(); + return; +} + +kernel void compute_main() { + asinh_468a48(); + return; +} + diff --git a/test/tint/builtins/gen/var/asinh/468a48.wgsl.expected.spvasm b/test/tint/builtins/gen/var/asinh/468a48.wgsl.expected.spvasm new file mode 100644 index 0000000000..93c8f5ac26 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/468a48.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asinh_468a48 "asinh_468a48" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%asinh_468a48 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Asinh %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %asinh_468a48 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %asinh_468a48 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %asinh_468a48 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/asinh/468a48.wgsl.expected.wgsl b/test/tint/builtins/gen/var/asinh/468a48.wgsl.expected.wgsl new file mode 100644 index 0000000000..b8b458cd20 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/468a48.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn asinh_468a48() { + var arg_0 = f16(); + var res : f16 = asinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_468a48(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_468a48(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_468a48(); +} diff --git a/test/tint/builtins/gen/var/asinh/95ab2b.wgsl b/test/tint/builtins/gen/var/asinh/95ab2b.wgsl new file mode 100644 index 0000000000..1c734788da --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/95ab2b.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn asinh(vec<4, f16>) -> vec<4, f16> +fn asinh_95ab2b() { + var arg_0 = vec4(f16()); + var res: vec4 = asinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_95ab2b(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_95ab2b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_95ab2b(); +} diff --git a/test/tint/builtins/gen/var/asinh/95ab2b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/asinh/95ab2b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..bbbe9f7650 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/95ab2b.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +vector tint_sinh(vector x) { + return log((x + sqrt(((x * x) + float16_t(1.0h))))); +} + +void asinh_95ab2b() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = tint_sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_95ab2b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_95ab2b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_95ab2b(); + return; +} diff --git a/test/tint/builtins/gen/var/asinh/95ab2b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/asinh/95ab2b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..60b07b0416 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/95ab2b.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +vector tint_sinh(vector x) { + return log((x + sqrt(((x * x) + float16_t(1.0h))))); +} + +void asinh_95ab2b() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = tint_sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_95ab2b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_95ab2b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_95ab2b(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002E3B2D56BD0(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/asinh/95ab2b.wgsl.expected.glsl b/test/tint/builtins/gen/var/asinh/95ab2b.wgsl.expected.glsl new file mode 100644 index 0000000000..ec6f916dc7 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/95ab2b.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asinh_95ab2b() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = asinh(arg_0); +} + +vec4 vertex_main() { + asinh_95ab2b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void asinh_95ab2b() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = asinh(arg_0); +} + +void fragment_main() { + asinh_95ab2b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asinh_95ab2b() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = asinh(arg_0); +} + +void compute_main() { + asinh_95ab2b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/asinh/95ab2b.wgsl.expected.msl b/test/tint/builtins/gen/var/asinh/95ab2b.wgsl.expected.msl new file mode 100644 index 0000000000..ab992468c6 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/95ab2b.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void asinh_95ab2b() { + half4 arg_0 = half4(0.0h); + half4 res = asinh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asinh_95ab2b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asinh_95ab2b(); + return; +} + +kernel void compute_main() { + asinh_95ab2b(); + return; +} + diff --git a/test/tint/builtins/gen/var/asinh/95ab2b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/asinh/95ab2b.wgsl.expected.spvasm new file mode 100644 index 0000000000..cbaf25c23a --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/95ab2b.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asinh_95ab2b "asinh_95ab2b" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%asinh_95ab2b = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Asinh %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %asinh_95ab2b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %asinh_95ab2b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %asinh_95ab2b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/asinh/95ab2b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/asinh/95ab2b.wgsl.expected.wgsl new file mode 100644 index 0000000000..882f15d022 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/95ab2b.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn asinh_95ab2b() { + var arg_0 = vec4(f16()); + var res : vec4 = asinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_95ab2b(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_95ab2b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_95ab2b(); +} diff --git a/test/tint/builtins/gen/var/asinh/ad8f8b.wgsl b/test/tint/builtins/gen/var/asinh/ad8f8b.wgsl new file mode 100644 index 0000000000..6cc709d6f5 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/ad8f8b.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn asinh(vec<2, f16>) -> vec<2, f16> +fn asinh_ad8f8b() { + var arg_0 = vec2(f16()); + var res: vec2 = asinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_ad8f8b(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_ad8f8b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_ad8f8b(); +} diff --git a/test/tint/builtins/gen/var/asinh/ad8f8b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/asinh/ad8f8b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..68d01e676e --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/ad8f8b.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +vector tint_sinh(vector x) { + return log((x + sqrt(((x * x) + float16_t(1.0h))))); +} + +void asinh_ad8f8b() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = tint_sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_ad8f8b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_ad8f8b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_ad8f8b(); + return; +} diff --git a/test/tint/builtins/gen/var/asinh/ad8f8b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/asinh/ad8f8b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2bec5b56fb --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/ad8f8b.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +vector tint_sinh(vector x) { + return log((x + sqrt(((x * x) + float16_t(1.0h))))); +} + +void asinh_ad8f8b() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = tint_sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_ad8f8b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_ad8f8b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_ad8f8b(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C8AF6F1580(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/asinh/ad8f8b.wgsl.expected.glsl b/test/tint/builtins/gen/var/asinh/ad8f8b.wgsl.expected.glsl new file mode 100644 index 0000000000..2f66aaaab4 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/ad8f8b.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asinh_ad8f8b() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = asinh(arg_0); +} + +vec4 vertex_main() { + asinh_ad8f8b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void asinh_ad8f8b() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = asinh(arg_0); +} + +void fragment_main() { + asinh_ad8f8b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asinh_ad8f8b() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = asinh(arg_0); +} + +void compute_main() { + asinh_ad8f8b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/asinh/ad8f8b.wgsl.expected.msl b/test/tint/builtins/gen/var/asinh/ad8f8b.wgsl.expected.msl new file mode 100644 index 0000000000..4a6745f14c --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/ad8f8b.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void asinh_ad8f8b() { + half2 arg_0 = half2(0.0h); + half2 res = asinh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asinh_ad8f8b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asinh_ad8f8b(); + return; +} + +kernel void compute_main() { + asinh_ad8f8b(); + return; +} + diff --git a/test/tint/builtins/gen/var/asinh/ad8f8b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/asinh/ad8f8b.wgsl.expected.spvasm new file mode 100644 index 0000000000..b41573f020 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/ad8f8b.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asinh_ad8f8b "asinh_ad8f8b" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%asinh_ad8f8b = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Asinh %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %asinh_ad8f8b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %asinh_ad8f8b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %asinh_ad8f8b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/asinh/ad8f8b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/asinh/ad8f8b.wgsl.expected.wgsl new file mode 100644 index 0000000000..2a96fe6b11 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/ad8f8b.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn asinh_ad8f8b() { + var arg_0 = vec2(f16()); + var res : vec2 = asinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_ad8f8b(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_ad8f8b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_ad8f8b(); +} diff --git a/test/tint/builtins/gen/var/asinh/fb5e8c.wgsl b/test/tint/builtins/gen/var/asinh/fb5e8c.wgsl new file mode 100644 index 0000000000..648ab732fb --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/fb5e8c.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn asinh(vec<3, f16>) -> vec<3, f16> +fn asinh_fb5e8c() { + var arg_0 = vec3(f16()); + var res: vec3 = asinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_fb5e8c(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_fb5e8c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_fb5e8c(); +} diff --git a/test/tint/builtins/gen/var/asinh/fb5e8c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/asinh/fb5e8c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2e127aa9e2 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/fb5e8c.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +vector tint_sinh(vector x) { + return log((x + sqrt(((x * x) + float16_t(1.0h))))); +} + +void asinh_fb5e8c() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = tint_sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_fb5e8c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_fb5e8c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_fb5e8c(); + return; +} diff --git a/test/tint/builtins/gen/var/asinh/fb5e8c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/asinh/fb5e8c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..75a4736351 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/fb5e8c.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +vector tint_sinh(vector x) { + return log((x + sqrt(((x * x) + float16_t(1.0h))))); +} + +void asinh_fb5e8c() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = tint_sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_fb5e8c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_fb5e8c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_fb5e8c(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001B966509E00(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/asinh/fb5e8c.wgsl.expected.glsl b/test/tint/builtins/gen/var/asinh/fb5e8c.wgsl.expected.glsl new file mode 100644 index 0000000000..bb5859f703 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/fb5e8c.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asinh_fb5e8c() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = asinh(arg_0); +} + +vec4 vertex_main() { + asinh_fb5e8c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void asinh_fb5e8c() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = asinh(arg_0); +} + +void fragment_main() { + asinh_fb5e8c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asinh_fb5e8c() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = asinh(arg_0); +} + +void compute_main() { + asinh_fb5e8c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/asinh/fb5e8c.wgsl.expected.msl b/test/tint/builtins/gen/var/asinh/fb5e8c.wgsl.expected.msl new file mode 100644 index 0000000000..344f7c5eb7 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/fb5e8c.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void asinh_fb5e8c() { + half3 arg_0 = half3(0.0h); + half3 res = asinh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asinh_fb5e8c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asinh_fb5e8c(); + return; +} + +kernel void compute_main() { + asinh_fb5e8c(); + return; +} + diff --git a/test/tint/builtins/gen/var/asinh/fb5e8c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/asinh/fb5e8c.wgsl.expected.spvasm new file mode 100644 index 0000000000..63c34df8d9 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/fb5e8c.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asinh_fb5e8c "asinh_fb5e8c" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%asinh_fb5e8c = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Asinh %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %asinh_fb5e8c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %asinh_fb5e8c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %asinh_fb5e8c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/asinh/fb5e8c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/asinh/fb5e8c.wgsl.expected.wgsl new file mode 100644 index 0000000000..c228108c10 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/fb5e8c.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn asinh_fb5e8c() { + var arg_0 = vec3(f16()); + var res : vec3 = asinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_fb5e8c(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_fb5e8c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_fb5e8c(); +} diff --git a/test/tint/builtins/gen/var/atan/19faea.wgsl b/test/tint/builtins/gen/var/atan/19faea.wgsl new file mode 100644 index 0000000000..14c20e9ca8 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/19faea.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atan(vec<4, f16>) -> vec<4, f16> +fn atan_19faea() { + var arg_0 = vec4(f16()); + var res: vec4 = atan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_19faea(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_19faea(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_19faea(); +} diff --git a/test/tint/builtins/gen/var/atan/19faea.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atan/19faea.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..557db5849a --- /dev/null +++ b/test/tint/builtins/gen/var/atan/19faea.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void atan_19faea() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = atan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_19faea(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_19faea(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_19faea(); + return; +} diff --git a/test/tint/builtins/gen/var/atan/19faea.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atan/19faea.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..04ac231b6b --- /dev/null +++ b/test/tint/builtins/gen/var/atan/19faea.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void atan_19faea() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = atan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_19faea(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_19faea(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_19faea(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F5B44507F0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F5B44507F0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/atan/19faea.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan/19faea.wgsl.expected.glsl new file mode 100644 index 0000000000..46811fcf2d --- /dev/null +++ b/test/tint/builtins/gen/var/atan/19faea.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan_19faea() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = atan(arg_0); +} + +vec4 vertex_main() { + atan_19faea(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void atan_19faea() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = atan(arg_0); +} + +void fragment_main() { + atan_19faea(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan_19faea() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = atan(arg_0); +} + +void compute_main() { + atan_19faea(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atan/19faea.wgsl.expected.msl b/test/tint/builtins/gen/var/atan/19faea.wgsl.expected.msl new file mode 100644 index 0000000000..f8d735b3dd --- /dev/null +++ b/test/tint/builtins/gen/var/atan/19faea.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void atan_19faea() { + half4 arg_0 = half4(0.0h); + half4 res = atan(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan_19faea(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan_19faea(); + return; +} + +kernel void compute_main() { + atan_19faea(); + return; +} + diff --git a/test/tint/builtins/gen/var/atan/19faea.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan/19faea.wgsl.expected.spvasm new file mode 100644 index 0000000000..2daa3f6b0b --- /dev/null +++ b/test/tint/builtins/gen/var/atan/19faea.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan_19faea "atan_19faea" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan_19faea = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Atan %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %atan_19faea + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %atan_19faea + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %atan_19faea + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atan/19faea.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan/19faea.wgsl.expected.wgsl new file mode 100644 index 0000000000..d93bec72a5 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/19faea.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn atan_19faea() { + var arg_0 = vec4(f16()); + var res : vec4 = atan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_19faea(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_19faea(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_19faea(); +} diff --git a/test/tint/builtins/gen/var/atan/1e1764.wgsl b/test/tint/builtins/gen/var/atan/1e1764.wgsl new file mode 100644 index 0000000000..2f5d3b90dc --- /dev/null +++ b/test/tint/builtins/gen/var/atan/1e1764.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atan(vec<2, f16>) -> vec<2, f16> +fn atan_1e1764() { + var arg_0 = vec2(f16()); + var res: vec2 = atan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_1e1764(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_1e1764(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_1e1764(); +} diff --git a/test/tint/builtins/gen/var/atan/1e1764.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atan/1e1764.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6cb0a491fb --- /dev/null +++ b/test/tint/builtins/gen/var/atan/1e1764.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void atan_1e1764() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = atan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_1e1764(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_1e1764(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_1e1764(); + return; +} diff --git a/test/tint/builtins/gen/var/atan/1e1764.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atan/1e1764.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b1775ffff7 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/1e1764.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void atan_1e1764() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = atan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_1e1764(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_1e1764(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_1e1764(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000015CC8119100(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000015CC8119100(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/atan/1e1764.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan/1e1764.wgsl.expected.glsl new file mode 100644 index 0000000000..8c16874da2 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/1e1764.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan_1e1764() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = atan(arg_0); +} + +vec4 vertex_main() { + atan_1e1764(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void atan_1e1764() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = atan(arg_0); +} + +void fragment_main() { + atan_1e1764(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan_1e1764() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = atan(arg_0); +} + +void compute_main() { + atan_1e1764(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atan/1e1764.wgsl.expected.msl b/test/tint/builtins/gen/var/atan/1e1764.wgsl.expected.msl new file mode 100644 index 0000000000..f7651c4178 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/1e1764.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void atan_1e1764() { + half2 arg_0 = half2(0.0h); + half2 res = atan(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan_1e1764(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan_1e1764(); + return; +} + +kernel void compute_main() { + atan_1e1764(); + return; +} + diff --git a/test/tint/builtins/gen/var/atan/1e1764.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan/1e1764.wgsl.expected.spvasm new file mode 100644 index 0000000000..0a1b7de1c7 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/1e1764.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan_1e1764 "atan_1e1764" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan_1e1764 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Atan %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %atan_1e1764 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %atan_1e1764 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %atan_1e1764 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atan/1e1764.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan/1e1764.wgsl.expected.wgsl new file mode 100644 index 0000000000..86ba26788d --- /dev/null +++ b/test/tint/builtins/gen/var/atan/1e1764.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn atan_1e1764() { + var arg_0 = vec2(f16()); + var res : vec2 = atan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_1e1764(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_1e1764(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_1e1764(); +} diff --git a/test/tint/builtins/gen/var/atan/a5f421.wgsl b/test/tint/builtins/gen/var/atan/a5f421.wgsl new file mode 100644 index 0000000000..c76fe4ceee --- /dev/null +++ b/test/tint/builtins/gen/var/atan/a5f421.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atan(vec<3, f16>) -> vec<3, f16> +fn atan_a5f421() { + var arg_0 = vec3(f16()); + var res: vec3 = atan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_a5f421(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_a5f421(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_a5f421(); +} diff --git a/test/tint/builtins/gen/var/atan/a5f421.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atan/a5f421.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..aca9149beb --- /dev/null +++ b/test/tint/builtins/gen/var/atan/a5f421.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void atan_a5f421() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = atan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_a5f421(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_a5f421(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_a5f421(); + return; +} diff --git a/test/tint/builtins/gen/var/atan/a5f421.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atan/a5f421.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7eeb5025f7 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/a5f421.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void atan_a5f421() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = atan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_a5f421(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_a5f421(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_a5f421(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E218212B50(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E218212B50(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/atan/a5f421.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan/a5f421.wgsl.expected.glsl new file mode 100644 index 0000000000..e4a545a61a --- /dev/null +++ b/test/tint/builtins/gen/var/atan/a5f421.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan_a5f421() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = atan(arg_0); +} + +vec4 vertex_main() { + atan_a5f421(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void atan_a5f421() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = atan(arg_0); +} + +void fragment_main() { + atan_a5f421(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan_a5f421() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = atan(arg_0); +} + +void compute_main() { + atan_a5f421(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atan/a5f421.wgsl.expected.msl b/test/tint/builtins/gen/var/atan/a5f421.wgsl.expected.msl new file mode 100644 index 0000000000..800084d68e --- /dev/null +++ b/test/tint/builtins/gen/var/atan/a5f421.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void atan_a5f421() { + half3 arg_0 = half3(0.0h); + half3 res = atan(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan_a5f421(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan_a5f421(); + return; +} + +kernel void compute_main() { + atan_a5f421(); + return; +} + diff --git a/test/tint/builtins/gen/var/atan/a5f421.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan/a5f421.wgsl.expected.spvasm new file mode 100644 index 0000000000..c41d678766 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/a5f421.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan_a5f421 "atan_a5f421" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan_a5f421 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Atan %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %atan_a5f421 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %atan_a5f421 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %atan_a5f421 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atan/a5f421.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan/a5f421.wgsl.expected.wgsl new file mode 100644 index 0000000000..48d261a315 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/a5f421.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn atan_a5f421() { + var arg_0 = vec3(f16()); + var res : vec3 = atan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_a5f421(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_a5f421(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_a5f421(); +} diff --git a/test/tint/builtins/gen/var/atan/a7ba61.wgsl b/test/tint/builtins/gen/var/atan/a7ba61.wgsl new file mode 100644 index 0000000000..a19eafc469 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/a7ba61.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atan(f16) -> f16 +fn atan_a7ba61() { + var arg_0 = f16(); + var res: f16 = atan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_a7ba61(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_a7ba61(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_a7ba61(); +} diff --git a/test/tint/builtins/gen/var/atan/a7ba61.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atan/a7ba61.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2697f3e783 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/a7ba61.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void atan_a7ba61() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = atan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_a7ba61(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_a7ba61(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_a7ba61(); + return; +} diff --git a/test/tint/builtins/gen/var/atan/a7ba61.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atan/a7ba61.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1fae88d969 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/a7ba61.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void atan_a7ba61() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = atan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_a7ba61(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_a7ba61(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_a7ba61(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000193197C2E20(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000193197C2E20(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/atan/a7ba61.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan/a7ba61.wgsl.expected.glsl new file mode 100644 index 0000000000..4f7d41f548 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/a7ba61.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan_a7ba61() { + float16_t arg_0 = 0.0hf; + float16_t res = atan(arg_0); +} + +vec4 vertex_main() { + atan_a7ba61(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void atan_a7ba61() { + float16_t arg_0 = 0.0hf; + float16_t res = atan(arg_0); +} + +void fragment_main() { + atan_a7ba61(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan_a7ba61() { + float16_t arg_0 = 0.0hf; + float16_t res = atan(arg_0); +} + +void compute_main() { + atan_a7ba61(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atan/a7ba61.wgsl.expected.msl b/test/tint/builtins/gen/var/atan/a7ba61.wgsl.expected.msl new file mode 100644 index 0000000000..33674c9fd0 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/a7ba61.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void atan_a7ba61() { + half arg_0 = 0.0h; + half res = atan(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan_a7ba61(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan_a7ba61(); + return; +} + +kernel void compute_main() { + atan_a7ba61(); + return; +} + diff --git a/test/tint/builtins/gen/var/atan/a7ba61.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan/a7ba61.wgsl.expected.spvasm new file mode 100644 index 0000000000..2442909f4e --- /dev/null +++ b/test/tint/builtins/gen/var/atan/a7ba61.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan_a7ba61 "atan_a7ba61" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan_a7ba61 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Atan %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %atan_a7ba61 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %atan_a7ba61 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %atan_a7ba61 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atan/a7ba61.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan/a7ba61.wgsl.expected.wgsl new file mode 100644 index 0000000000..2237e13955 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/a7ba61.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn atan_a7ba61() { + var arg_0 = f16(); + var res : f16 = atan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_a7ba61(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_a7ba61(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_a7ba61(); +} diff --git a/test/tint/builtins/gen/var/atan2/21dfea.wgsl b/test/tint/builtins/gen/var/atan2/21dfea.wgsl new file mode 100644 index 0000000000..f45981bc42 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/21dfea.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atan2(vec<3, f16>, vec<3, f16>) -> vec<3, f16> +fn atan2_21dfea() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var res: vec3 = atan2(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_21dfea(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_21dfea(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_21dfea(); +} diff --git a/test/tint/builtins/gen/var/atan2/21dfea.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atan2/21dfea.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..811f791bec --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/21dfea.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void atan2_21dfea() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector res = atan2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_21dfea(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_21dfea(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_21dfea(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/21dfea.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atan2/21dfea.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7952947429 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/21dfea.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void atan2_21dfea() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector res = atan2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_21dfea(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_21dfea(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_21dfea(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000155102818A0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000155102818A0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000155102818A0(4,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/atan2/21dfea.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan2/21dfea.wgsl.expected.glsl new file mode 100644 index 0000000000..e10e1d9bbf --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/21dfea.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan2_21dfea() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 res = atan(arg_0, arg_1); +} + +vec4 vertex_main() { + atan2_21dfea(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void atan2_21dfea() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 res = atan(arg_0, arg_1); +} + +void fragment_main() { + atan2_21dfea(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan2_21dfea() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 res = atan(arg_0, arg_1); +} + +void compute_main() { + atan2_21dfea(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/21dfea.wgsl.expected.msl b/test/tint/builtins/gen/var/atan2/21dfea.wgsl.expected.msl new file mode 100644 index 0000000000..2ed4954aaf --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/21dfea.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void atan2_21dfea() { + half3 arg_0 = half3(0.0h); + half3 arg_1 = half3(0.0h); + half3 res = atan2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan2_21dfea(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan2_21dfea(); + return; +} + +kernel void compute_main() { + atan2_21dfea(); + return; +} + diff --git a/test/tint/builtins/gen/var/atan2/21dfea.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan2/21dfea.wgsl.expected.spvasm new file mode 100644 index 0000000000..22b64b3ebc --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/21dfea.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan2_21dfea "atan2_21dfea" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan2_21dfea = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %arg_1 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v3half %arg_0 + %22 = OpLoad %v3half %arg_1 + %19 = OpExtInst %v3half %20 Atan2 %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %atan2_21dfea + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %atan2_21dfea + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %atan2_21dfea + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atan2/21dfea.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan2/21dfea.wgsl.expected.wgsl new file mode 100644 index 0000000000..e4c6b6b893 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/21dfea.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn atan2_21dfea() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var res : vec3 = atan2(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_21dfea(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_21dfea(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_21dfea(); +} diff --git a/test/tint/builtins/gen/var/atan2/93febc.wgsl b/test/tint/builtins/gen/var/atan2/93febc.wgsl new file mode 100644 index 0000000000..a09bf18e21 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/93febc.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atan2(vec<2, f16>, vec<2, f16>) -> vec<2, f16> +fn atan2_93febc() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var res: vec2 = atan2(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_93febc(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_93febc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_93febc(); +} diff --git a/test/tint/builtins/gen/var/atan2/93febc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atan2/93febc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..780ec69979 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/93febc.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void atan2_93febc() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + vector res = atan2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_93febc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_93febc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_93febc(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/93febc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atan2/93febc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cdf19482f9 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/93febc.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void atan2_93febc() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + vector res = atan2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_93febc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_93febc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_93febc(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001B1F88A7150(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001B1F88A7150(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001B1F88A7150(4,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/atan2/93febc.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan2/93febc.wgsl.expected.glsl new file mode 100644 index 0000000000..2184e82e82 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/93febc.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan2_93febc() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 res = atan(arg_0, arg_1); +} + +vec4 vertex_main() { + atan2_93febc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void atan2_93febc() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 res = atan(arg_0, arg_1); +} + +void fragment_main() { + atan2_93febc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan2_93febc() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 res = atan(arg_0, arg_1); +} + +void compute_main() { + atan2_93febc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/93febc.wgsl.expected.msl b/test/tint/builtins/gen/var/atan2/93febc.wgsl.expected.msl new file mode 100644 index 0000000000..27e327db2e --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/93febc.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void atan2_93febc() { + half2 arg_0 = half2(0.0h); + half2 arg_1 = half2(0.0h); + half2 res = atan2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan2_93febc(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan2_93febc(); + return; +} + +kernel void compute_main() { + atan2_93febc(); + return; +} + diff --git a/test/tint/builtins/gen/var/atan2/93febc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan2/93febc.wgsl.expected.spvasm new file mode 100644 index 0000000000..bdcbc06b41 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/93febc.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan2_93febc "atan2_93febc" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan2_93febc = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %arg_1 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v2half %arg_0 + %22 = OpLoad %v2half %arg_1 + %19 = OpExtInst %v2half %20 Atan2 %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %atan2_93febc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %atan2_93febc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %atan2_93febc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atan2/93febc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan2/93febc.wgsl.expected.wgsl new file mode 100644 index 0000000000..487d27110c --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/93febc.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn atan2_93febc() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var res : vec2 = atan2(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_93febc(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_93febc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_93febc(); +} diff --git a/test/tint/builtins/gen/var/atan2/ca698e.wgsl b/test/tint/builtins/gen/var/atan2/ca698e.wgsl new file mode 100644 index 0000000000..e1c18bc74a --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/ca698e.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atan2(f16, f16) -> f16 +fn atan2_ca698e() { + var arg_0 = f16(); + var arg_1 = f16(); + var res: f16 = atan2(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_ca698e(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_ca698e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_ca698e(); +} diff --git a/test/tint/builtins/gen/var/atan2/ca698e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atan2/ca698e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0d5b1d999e --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/ca698e.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void atan2_ca698e() { + float16_t arg_0 = float16_t(0.0h); + float16_t arg_1 = float16_t(0.0h); + float16_t res = atan2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_ca698e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_ca698e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_ca698e(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/ca698e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atan2/ca698e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..044e1b8c88 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/ca698e.wgsl.expected.fxc.hlsl @@ -0,0 +1,38 @@ +SKIP: FAILED + +void atan2_ca698e() { + float16_t arg_0 = float16_t(0.0h); + float16_t arg_1 = float16_t(0.0h); + float16_t res = atan2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_ca698e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_ca698e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_ca698e(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000284FEEEF860(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000284FEEEF860(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/atan2/ca698e.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan2/ca698e.wgsl.expected.glsl new file mode 100644 index 0000000000..3db5c43a7a --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/ca698e.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan2_ca698e() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t res = atan(arg_0, arg_1); +} + +vec4 vertex_main() { + atan2_ca698e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void atan2_ca698e() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t res = atan(arg_0, arg_1); +} + +void fragment_main() { + atan2_ca698e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan2_ca698e() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t res = atan(arg_0, arg_1); +} + +void compute_main() { + atan2_ca698e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/ca698e.wgsl.expected.msl b/test/tint/builtins/gen/var/atan2/ca698e.wgsl.expected.msl new file mode 100644 index 0000000000..575cd00cb4 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/ca698e.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void atan2_ca698e() { + half arg_0 = 0.0h; + half arg_1 = 0.0h; + half res = atan2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan2_ca698e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan2_ca698e(); + return; +} + +kernel void compute_main() { + atan2_ca698e(); + return; +} + diff --git a/test/tint/builtins/gen/var/atan2/ca698e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan2/ca698e.wgsl.expected.spvasm new file mode 100644 index 0000000000..01adb51acf --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/ca698e.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan2_ca698e "atan2_ca698e" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan2_ca698e = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %arg_1 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + %20 = OpLoad %half %arg_0 + %21 = OpLoad %half %arg_1 + %18 = OpExtInst %half %19 Atan2 %20 %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %atan2_ca698e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %atan2_ca698e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %atan2_ca698e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atan2/ca698e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan2/ca698e.wgsl.expected.wgsl new file mode 100644 index 0000000000..1097b260d6 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/ca698e.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn atan2_ca698e() { + var arg_0 = f16(); + var arg_1 = f16(); + var res : f16 = atan2(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_ca698e(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_ca698e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_ca698e(); +} diff --git a/test/tint/builtins/gen/var/atan2/d983ab.wgsl b/test/tint/builtins/gen/var/atan2/d983ab.wgsl new file mode 100644 index 0000000000..2d87cea9f0 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/d983ab.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atan2(vec<4, f16>, vec<4, f16>) -> vec<4, f16> +fn atan2_d983ab() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var res: vec4 = atan2(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_d983ab(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_d983ab(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_d983ab(); +} diff --git a/test/tint/builtins/gen/var/atan2/d983ab.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atan2/d983ab.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1e09843ae4 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/d983ab.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void atan2_d983ab() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + vector res = atan2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_d983ab(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_d983ab(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_d983ab(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/d983ab.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atan2/d983ab.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..926647d579 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/d983ab.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void atan2_d983ab() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + vector res = atan2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_d983ab(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_d983ab(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_d983ab(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000023A1AB1D2D0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000023A1AB1D2D0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000023A1AB1D2D0(4,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/atan2/d983ab.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan2/d983ab.wgsl.expected.glsl new file mode 100644 index 0000000000..294b5375c4 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/d983ab.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan2_d983ab() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 res = atan(arg_0, arg_1); +} + +vec4 vertex_main() { + atan2_d983ab(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void atan2_d983ab() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 res = atan(arg_0, arg_1); +} + +void fragment_main() { + atan2_d983ab(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan2_d983ab() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 res = atan(arg_0, arg_1); +} + +void compute_main() { + atan2_d983ab(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/d983ab.wgsl.expected.msl b/test/tint/builtins/gen/var/atan2/d983ab.wgsl.expected.msl new file mode 100644 index 0000000000..1f3cdbc58c --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/d983ab.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void atan2_d983ab() { + half4 arg_0 = half4(0.0h); + half4 arg_1 = half4(0.0h); + half4 res = atan2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan2_d983ab(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan2_d983ab(); + return; +} + +kernel void compute_main() { + atan2_d983ab(); + return; +} + diff --git a/test/tint/builtins/gen/var/atan2/d983ab.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan2/d983ab.wgsl.expected.spvasm new file mode 100644 index 0000000000..a8b43d8044 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/d983ab.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan2_d983ab "atan2_d983ab" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan2_d983ab = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %arg_1 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v4half %arg_0 + %22 = OpLoad %v4half %arg_1 + %19 = OpExtInst %v4half %20 Atan2 %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %atan2_d983ab + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %atan2_d983ab + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %atan2_d983ab + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atan2/d983ab.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan2/d983ab.wgsl.expected.wgsl new file mode 100644 index 0000000000..8d7f9377e8 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/d983ab.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn atan2_d983ab() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var res : vec4 = atan2(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_d983ab(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_d983ab(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_d983ab(); +} diff --git a/test/tint/builtins/gen/var/atanh/5bf88d.wgsl b/test/tint/builtins/gen/var/atanh/5bf88d.wgsl new file mode 100644 index 0000000000..9ad6f3fe48 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/5bf88d.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atanh(vec<2, f16>) -> vec<2, f16> +fn atanh_5bf88d() { + var arg_0 = vec2(f16()); + var res: vec2 = atanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_5bf88d(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_5bf88d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_5bf88d(); +} diff --git a/test/tint/builtins/gen/var/atanh/5bf88d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atanh/5bf88d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..50adf29658 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/5bf88d.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +vector tint_atanh(vector x) { + return (log(((float16_t(1.0h) + x) / (float16_t(1.0h) - x))) * float16_t(0.5h)); +} + +void atanh_5bf88d() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = tint_atanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_5bf88d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_5bf88d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_5bf88d(); + return; +} diff --git a/test/tint/builtins/gen/var/atanh/5bf88d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atanh/5bf88d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c08dcf65f3 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/5bf88d.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +vector tint_atanh(vector x) { + return (log(((float16_t(1.0h) + x) / (float16_t(1.0h) - x))) * float16_t(0.5h)); +} + +void atanh_5bf88d() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = tint_atanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_5bf88d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_5bf88d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_5bf88d(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000223A4C149E0(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/atanh/5bf88d.wgsl.expected.glsl b/test/tint/builtins/gen/var/atanh/5bf88d.wgsl.expected.glsl new file mode 100644 index 0000000000..d8e42b98e6 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/5bf88d.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec2 tint_atanh(f16vec2 x) { + return mix(atanh(x), f16vec2(0.0hf), greaterThanEqual(x, f16vec2(1.0hf))); +} + +void atanh_5bf88d() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = tint_atanh(arg_0); +} + +vec4 vertex_main() { + atanh_5bf88d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec2 tint_atanh(f16vec2 x) { + return mix(atanh(x), f16vec2(0.0hf), greaterThanEqual(x, f16vec2(1.0hf))); +} + +void atanh_5bf88d() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = tint_atanh(arg_0); +} + +void fragment_main() { + atanh_5bf88d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec2 tint_atanh(f16vec2 x) { + return mix(atanh(x), f16vec2(0.0hf), greaterThanEqual(x, f16vec2(1.0hf))); +} + +void atanh_5bf88d() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = tint_atanh(arg_0); +} + +void compute_main() { + atanh_5bf88d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atanh/5bf88d.wgsl.expected.msl b/test/tint/builtins/gen/var/atanh/5bf88d.wgsl.expected.msl new file mode 100644 index 0000000000..633f841000 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/5bf88d.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +half2 tint_atanh(half2 x) { + return select(atanh(x), half2(0.0h), (x >= half2(1.0h))); +} + +void atanh_5bf88d() { + half2 arg_0 = half2(0.0h); + half2 res = tint_atanh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atanh_5bf88d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atanh_5bf88d(); + return; +} + +kernel void compute_main() { + atanh_5bf88d(); + return; +} + diff --git a/test/tint/builtins/gen/var/atanh/5bf88d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atanh/5bf88d.wgsl.expected.spvasm new file mode 100644 index 0000000000..55870bc65c --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/5bf88d.wgsl.expected.spvasm @@ -0,0 +1,91 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_atanh "tint_atanh" + OpName %x "x" + OpName %atanh_5bf88d "atanh_5bf88d" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %9 = OpTypeFunction %v2half %v2half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %17 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_0 + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %21 = OpConstantNull %v2half + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_Function_v2half = OpTypePointer Function %v2half + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tint_atanh = OpFunction %v2half None %9 + %x = OpFunctionParameter %v2half + %14 = OpLabel + %18 = OpFOrdGreaterThanEqual %v2bool %x %17 + %22 = OpExtInst %v2half %23 Atanh %x + %15 = OpSelect %v2half %18 %21 %22 + OpReturnValue %15 + OpFunctionEnd +%atanh_5bf88d = OpFunction %void None %24 + %27 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %21 + %res = OpVariable %_ptr_Function_v2half Function %21 + OpStore %arg_0 %21 + %31 = OpLoad %v2half %arg_0 + %30 = OpFunctionCall %v2half %tint_atanh %31 + OpStore %res %30 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %atanh_5bf88d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %24 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %24 + %42 = OpLabel + %43 = OpFunctionCall %void %atanh_5bf88d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %24 + %45 = OpLabel + %46 = OpFunctionCall %void %atanh_5bf88d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atanh/5bf88d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atanh/5bf88d.wgsl.expected.wgsl new file mode 100644 index 0000000000..3d38ee5257 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/5bf88d.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn atanh_5bf88d() { + var arg_0 = vec2(f16()); + var res : vec2 = atanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_5bf88d(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_5bf88d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_5bf88d(); +} diff --git a/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl b/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl new file mode 100644 index 0000000000..bbe88cba03 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atanh(f16) -> f16 +fn atanh_d2d8cd() { + var arg_0 = f16(); + var res: f16 = atanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_d2d8cd(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_d2d8cd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_d2d8cd(); +} diff --git a/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..bf8166ad75 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +float16_t tint_atanh(float16_t x) { + return (log(((float16_t(1.0h) + x) / (float16_t(1.0h) - x))) * float16_t(0.5h)); +} + +void atanh_d2d8cd() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = tint_atanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_d2d8cd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_d2d8cd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_d2d8cd(); + return; +} diff --git a/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b725226906 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +float16_t tint_atanh(float16_t x) { + return (log(((float16_t(1.0h) + x) / (float16_t(1.0h) - x))) * float16_t(0.5h)); +} + +void atanh_d2d8cd() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = tint_atanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_d2d8cd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_d2d8cd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_d2d8cd(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000275850EA270(1,1-9): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl.expected.glsl b/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl.expected.glsl new file mode 100644 index 0000000000..d829f337c4 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +float16_t tint_atanh(float16_t x) { + return ((x >= 1.0hf) ? 0.0hf : atanh(x)); +} + +void atanh_d2d8cd() { + float16_t arg_0 = 0.0hf; + float16_t res = tint_atanh(arg_0); +} + +vec4 vertex_main() { + atanh_d2d8cd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +float16_t tint_atanh(float16_t x) { + return ((x >= 1.0hf) ? 0.0hf : atanh(x)); +} + +void atanh_d2d8cd() { + float16_t arg_0 = 0.0hf; + float16_t res = tint_atanh(arg_0); +} + +void fragment_main() { + atanh_d2d8cd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +float16_t tint_atanh(float16_t x) { + return ((x >= 1.0hf) ? 0.0hf : atanh(x)); +} + +void atanh_d2d8cd() { + float16_t arg_0 = 0.0hf; + float16_t res = tint_atanh(arg_0); +} + +void compute_main() { + atanh_d2d8cd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl.expected.msl b/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl.expected.msl new file mode 100644 index 0000000000..d76fbdd82e --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +half tint_atanh(half x) { + return select(atanh(x), 0.0h, (x >= 1.0h)); +} + +void atanh_d2d8cd() { + half arg_0 = 0.0h; + half res = tint_atanh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atanh_d2d8cd(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atanh_d2d8cd(); + return; +} + +kernel void compute_main() { + atanh_d2d8cd(); + return; +} + diff --git a/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl.expected.spvasm new file mode 100644 index 0000000000..343b75f623 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_atanh "tint_atanh" + OpName %x "x" + OpName %atanh_d2d8cd "atanh_d2d8cd" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %half = OpTypeFloat 16 + %9 = OpTypeFunction %half %half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %bool = OpTypeBool + %18 = OpConstantNull %half + %void = OpTypeVoid + %21 = OpTypeFunction %void +%_ptr_Function_half = OpTypePointer Function %half + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tint_atanh = OpFunction %half None %9 + %x = OpFunctionParameter %half + %13 = OpLabel + %16 = OpFOrdGreaterThanEqual %bool %x %half_0x1p_0 + %19 = OpExtInst %half %20 Atanh %x + %14 = OpSelect %half %16 %18 %19 + OpReturnValue %14 + OpFunctionEnd +%atanh_d2d8cd = OpFunction %void None %21 + %24 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %18 + %res = OpVariable %_ptr_Function_half Function %18 + OpStore %arg_0 %18 + %28 = OpLoad %half %arg_0 + %27 = OpFunctionCall %half %tint_atanh %28 + OpStore %res %27 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %atanh_d2d8cd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %21 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %21 + %39 = OpLabel + %40 = OpFunctionCall %void %atanh_d2d8cd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %21 + %42 = OpLabel + %43 = OpFunctionCall %void %atanh_d2d8cd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl.expected.wgsl new file mode 100644 index 0000000000..f9720ab61b --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn atanh_d2d8cd() { + var arg_0 = f16(); + var res : f16 = atanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_d2d8cd(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_d2d8cd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_d2d8cd(); +} diff --git a/test/tint/builtins/gen/var/atanh/e3b450.wgsl b/test/tint/builtins/gen/var/atanh/e3b450.wgsl new file mode 100644 index 0000000000..f1fa1f3658 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/e3b450.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atanh(vec<4, f16>) -> vec<4, f16> +fn atanh_e3b450() { + var arg_0 = vec4(f16()); + var res: vec4 = atanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_e3b450(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_e3b450(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_e3b450(); +} diff --git a/test/tint/builtins/gen/var/atanh/e3b450.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atanh/e3b450.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e36b362efb --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/e3b450.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +vector tint_atanh(vector x) { + return (log(((float16_t(1.0h) + x) / (float16_t(1.0h) - x))) * float16_t(0.5h)); +} + +void atanh_e3b450() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = tint_atanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_e3b450(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_e3b450(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_e3b450(); + return; +} diff --git a/test/tint/builtins/gen/var/atanh/e3b450.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atanh/e3b450.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a96d5844f6 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/e3b450.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +vector tint_atanh(vector x) { + return (log(((float16_t(1.0h) + x) / (float16_t(1.0h) - x))) * float16_t(0.5h)); +} + +void atanh_e3b450() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = tint_atanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_e3b450(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_e3b450(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_e3b450(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C82047E7C0(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/atanh/e3b450.wgsl.expected.glsl b/test/tint/builtins/gen/var/atanh/e3b450.wgsl.expected.glsl new file mode 100644 index 0000000000..160e4643a2 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/e3b450.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec4 tint_atanh(f16vec4 x) { + return mix(atanh(x), f16vec4(0.0hf), greaterThanEqual(x, f16vec4(1.0hf))); +} + +void atanh_e3b450() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = tint_atanh(arg_0); +} + +vec4 vertex_main() { + atanh_e3b450(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec4 tint_atanh(f16vec4 x) { + return mix(atanh(x), f16vec4(0.0hf), greaterThanEqual(x, f16vec4(1.0hf))); +} + +void atanh_e3b450() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = tint_atanh(arg_0); +} + +void fragment_main() { + atanh_e3b450(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec4 tint_atanh(f16vec4 x) { + return mix(atanh(x), f16vec4(0.0hf), greaterThanEqual(x, f16vec4(1.0hf))); +} + +void atanh_e3b450() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = tint_atanh(arg_0); +} + +void compute_main() { + atanh_e3b450(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atanh/e3b450.wgsl.expected.msl b/test/tint/builtins/gen/var/atanh/e3b450.wgsl.expected.msl new file mode 100644 index 0000000000..70237ec209 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/e3b450.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +half4 tint_atanh(half4 x) { + return select(atanh(x), half4(0.0h), (x >= half4(1.0h))); +} + +void atanh_e3b450() { + half4 arg_0 = half4(0.0h); + half4 res = tint_atanh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atanh_e3b450(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atanh_e3b450(); + return; +} + +kernel void compute_main() { + atanh_e3b450(); + return; +} + diff --git a/test/tint/builtins/gen/var/atanh/e3b450.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atanh/e3b450.wgsl.expected.spvasm new file mode 100644 index 0000000000..b284d66e04 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/e3b450.wgsl.expected.spvasm @@ -0,0 +1,91 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_atanh "tint_atanh" + OpName %x "x" + OpName %atanh_e3b450 "atanh_e3b450" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %9 = OpTypeFunction %v4half %v4half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %17 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %21 = OpConstantNull %v4half + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_Function_v4half = OpTypePointer Function %v4half + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tint_atanh = OpFunction %v4half None %9 + %x = OpFunctionParameter %v4half + %14 = OpLabel + %18 = OpFOrdGreaterThanEqual %v4bool %x %17 + %22 = OpExtInst %v4half %23 Atanh %x + %15 = OpSelect %v4half %18 %21 %22 + OpReturnValue %15 + OpFunctionEnd +%atanh_e3b450 = OpFunction %void None %24 + %27 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %21 + %res = OpVariable %_ptr_Function_v4half Function %21 + OpStore %arg_0 %21 + %31 = OpLoad %v4half %arg_0 + %30 = OpFunctionCall %v4half %tint_atanh %31 + OpStore %res %30 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %atanh_e3b450 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %24 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %24 + %42 = OpLabel + %43 = OpFunctionCall %void %atanh_e3b450 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %24 + %45 = OpLabel + %46 = OpFunctionCall %void %atanh_e3b450 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atanh/e3b450.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atanh/e3b450.wgsl.expected.wgsl new file mode 100644 index 0000000000..c4fe719b28 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/e3b450.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn atanh_e3b450() { + var arg_0 = vec4(f16()); + var res : vec4 = atanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_e3b450(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_e3b450(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_e3b450(); +} diff --git a/test/tint/builtins/gen/var/atanh/ec4b06.wgsl b/test/tint/builtins/gen/var/atanh/ec4b06.wgsl new file mode 100644 index 0000000000..57babedd92 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/ec4b06.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atanh(vec<3, f16>) -> vec<3, f16> +fn atanh_ec4b06() { + var arg_0 = vec3(f16()); + var res: vec3 = atanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_ec4b06(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_ec4b06(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_ec4b06(); +} diff --git a/test/tint/builtins/gen/var/atanh/ec4b06.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atanh/ec4b06.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f59fe902f8 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/ec4b06.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +vector tint_atanh(vector x) { + return (log(((float16_t(1.0h) + x) / (float16_t(1.0h) - x))) * float16_t(0.5h)); +} + +void atanh_ec4b06() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = tint_atanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_ec4b06(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_ec4b06(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_ec4b06(); + return; +} diff --git a/test/tint/builtins/gen/var/atanh/ec4b06.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atanh/ec4b06.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c96a0ee959 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/ec4b06.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +vector tint_atanh(vector x) { + return (log(((float16_t(1.0h) + x) / (float16_t(1.0h) - x))) * float16_t(0.5h)); +} + +void atanh_ec4b06() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = tint_atanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_ec4b06(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_ec4b06(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_ec4b06(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002AC957584B0(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/atanh/ec4b06.wgsl.expected.glsl b/test/tint/builtins/gen/var/atanh/ec4b06.wgsl.expected.glsl new file mode 100644 index 0000000000..13d4a41cb5 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/ec4b06.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec3 tint_atanh(f16vec3 x) { + return mix(atanh(x), f16vec3(0.0hf), greaterThanEqual(x, f16vec3(1.0hf))); +} + +void atanh_ec4b06() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = tint_atanh(arg_0); +} + +vec4 vertex_main() { + atanh_ec4b06(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec3 tint_atanh(f16vec3 x) { + return mix(atanh(x), f16vec3(0.0hf), greaterThanEqual(x, f16vec3(1.0hf))); +} + +void atanh_ec4b06() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = tint_atanh(arg_0); +} + +void fragment_main() { + atanh_ec4b06(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec3 tint_atanh(f16vec3 x) { + return mix(atanh(x), f16vec3(0.0hf), greaterThanEqual(x, f16vec3(1.0hf))); +} + +void atanh_ec4b06() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = tint_atanh(arg_0); +} + +void compute_main() { + atanh_ec4b06(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atanh/ec4b06.wgsl.expected.msl b/test/tint/builtins/gen/var/atanh/ec4b06.wgsl.expected.msl new file mode 100644 index 0000000000..6238a7df21 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/ec4b06.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +half3 tint_atanh(half3 x) { + return select(atanh(x), half3(0.0h), (x >= half3(1.0h))); +} + +void atanh_ec4b06() { + half3 arg_0 = half3(0.0h); + half3 res = tint_atanh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atanh_ec4b06(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atanh_ec4b06(); + return; +} + +kernel void compute_main() { + atanh_ec4b06(); + return; +} + diff --git a/test/tint/builtins/gen/var/atanh/ec4b06.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atanh/ec4b06.wgsl.expected.spvasm new file mode 100644 index 0000000000..c58d4e33f5 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/ec4b06.wgsl.expected.spvasm @@ -0,0 +1,91 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_atanh "tint_atanh" + OpName %x "x" + OpName %atanh_ec4b06 "atanh_ec4b06" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %9 = OpTypeFunction %v3half %v3half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %17 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %21 = OpConstantNull %v3half + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_Function_v3half = OpTypePointer Function %v3half + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tint_atanh = OpFunction %v3half None %9 + %x = OpFunctionParameter %v3half + %14 = OpLabel + %18 = OpFOrdGreaterThanEqual %v3bool %x %17 + %22 = OpExtInst %v3half %23 Atanh %x + %15 = OpSelect %v3half %18 %21 %22 + OpReturnValue %15 + OpFunctionEnd +%atanh_ec4b06 = OpFunction %void None %24 + %27 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %21 + %res = OpVariable %_ptr_Function_v3half Function %21 + OpStore %arg_0 %21 + %31 = OpLoad %v3half %arg_0 + %30 = OpFunctionCall %v3half %tint_atanh %31 + OpStore %res %30 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %atanh_ec4b06 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %24 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %24 + %42 = OpLabel + %43 = OpFunctionCall %void %atanh_ec4b06 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %24 + %45 = OpLabel + %46 = OpFunctionCall %void %atanh_ec4b06 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atanh/ec4b06.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atanh/ec4b06.wgsl.expected.wgsl new file mode 100644 index 0000000000..b22a682d07 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/ec4b06.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn atanh_ec4b06() { + var arg_0 = vec3(f16()); + var res : vec3 = atanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_ec4b06(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_ec4b06(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_ec4b06(); +} diff --git a/test/tint/builtins/gen/var/ceil/09bf52.wgsl b/test/tint/builtins/gen/var/ceil/09bf52.wgsl new file mode 100644 index 0000000000..a248d8656e --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/09bf52.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn ceil(vec<3, f16>) -> vec<3, f16> +fn ceil_09bf52() { + var arg_0 = vec3(f16()); + var res: vec3 = ceil(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_09bf52(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_09bf52(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_09bf52(); +} diff --git a/test/tint/builtins/gen/var/ceil/09bf52.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/ceil/09bf52.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f513773952 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/09bf52.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void ceil_09bf52() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = ceil(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_09bf52(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_09bf52(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_09bf52(); + return; +} diff --git a/test/tint/builtins/gen/var/ceil/09bf52.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/ceil/09bf52.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..75dab64c24 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/09bf52.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void ceil_09bf52() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = ceil(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_09bf52(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_09bf52(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_09bf52(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001A987B49660(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001A987B49660(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/ceil/09bf52.wgsl.expected.glsl b/test/tint/builtins/gen/var/ceil/09bf52.wgsl.expected.glsl new file mode 100644 index 0000000000..252778dc52 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/09bf52.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ceil_09bf52() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = ceil(arg_0); +} + +vec4 vertex_main() { + ceil_09bf52(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void ceil_09bf52() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = ceil(arg_0); +} + +void fragment_main() { + ceil_09bf52(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ceil_09bf52() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = ceil(arg_0); +} + +void compute_main() { + ceil_09bf52(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/ceil/09bf52.wgsl.expected.msl b/test/tint/builtins/gen/var/ceil/09bf52.wgsl.expected.msl new file mode 100644 index 0000000000..9ee766b625 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/09bf52.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void ceil_09bf52() { + half3 arg_0 = half3(0.0h); + half3 res = ceil(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ceil_09bf52(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ceil_09bf52(); + return; +} + +kernel void compute_main() { + ceil_09bf52(); + return; +} + diff --git a/test/tint/builtins/gen/var/ceil/09bf52.wgsl.expected.spvasm b/test/tint/builtins/gen/var/ceil/09bf52.wgsl.expected.spvasm new file mode 100644 index 0000000000..dcc2ae08bd --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/09bf52.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ceil_09bf52 "ceil_09bf52" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%ceil_09bf52 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Ceil %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %ceil_09bf52 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %ceil_09bf52 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %ceil_09bf52 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/ceil/09bf52.wgsl.expected.wgsl b/test/tint/builtins/gen/var/ceil/09bf52.wgsl.expected.wgsl new file mode 100644 index 0000000000..c190c8922a --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/09bf52.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn ceil_09bf52() { + var arg_0 = vec3(f16()); + var res : vec3 = ceil(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_09bf52(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_09bf52(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_09bf52(); +} diff --git a/test/tint/builtins/gen/var/ceil/18c240.wgsl b/test/tint/builtins/gen/var/ceil/18c240.wgsl new file mode 100644 index 0000000000..76d060cfea --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/18c240.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn ceil(vec<2, f16>) -> vec<2, f16> +fn ceil_18c240() { + var arg_0 = vec2(f16()); + var res: vec2 = ceil(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_18c240(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_18c240(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_18c240(); +} diff --git a/test/tint/builtins/gen/var/ceil/18c240.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/ceil/18c240.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5080e4666a --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/18c240.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void ceil_18c240() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = ceil(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_18c240(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_18c240(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_18c240(); + return; +} diff --git a/test/tint/builtins/gen/var/ceil/18c240.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/ceil/18c240.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c34ea03ed3 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/18c240.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void ceil_18c240() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = ceil(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_18c240(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_18c240(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_18c240(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F7F15A6FA0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F7F15A6FA0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/ceil/18c240.wgsl.expected.glsl b/test/tint/builtins/gen/var/ceil/18c240.wgsl.expected.glsl new file mode 100644 index 0000000000..5b75aaacd1 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/18c240.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ceil_18c240() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = ceil(arg_0); +} + +vec4 vertex_main() { + ceil_18c240(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void ceil_18c240() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = ceil(arg_0); +} + +void fragment_main() { + ceil_18c240(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ceil_18c240() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = ceil(arg_0); +} + +void compute_main() { + ceil_18c240(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/ceil/18c240.wgsl.expected.msl b/test/tint/builtins/gen/var/ceil/18c240.wgsl.expected.msl new file mode 100644 index 0000000000..dab2bcc65f --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/18c240.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void ceil_18c240() { + half2 arg_0 = half2(0.0h); + half2 res = ceil(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ceil_18c240(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ceil_18c240(); + return; +} + +kernel void compute_main() { + ceil_18c240(); + return; +} + diff --git a/test/tint/builtins/gen/var/ceil/18c240.wgsl.expected.spvasm b/test/tint/builtins/gen/var/ceil/18c240.wgsl.expected.spvasm new file mode 100644 index 0000000000..2bb39dee3f --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/18c240.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ceil_18c240 "ceil_18c240" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%ceil_18c240 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Ceil %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %ceil_18c240 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %ceil_18c240 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %ceil_18c240 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/ceil/18c240.wgsl.expected.wgsl b/test/tint/builtins/gen/var/ceil/18c240.wgsl.expected.wgsl new file mode 100644 index 0000000000..aaf0fad6bd --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/18c240.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn ceil_18c240() { + var arg_0 = vec2(f16()); + var res : vec2 = ceil(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_18c240(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_18c240(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_18c240(); +} diff --git a/test/tint/builtins/gen/var/ceil/4bca2a.wgsl b/test/tint/builtins/gen/var/ceil/4bca2a.wgsl new file mode 100644 index 0000000000..28f5121b3d --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/4bca2a.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn ceil(vec<4, f16>) -> vec<4, f16> +fn ceil_4bca2a() { + var arg_0 = vec4(f16()); + var res: vec4 = ceil(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_4bca2a(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_4bca2a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_4bca2a(); +} diff --git a/test/tint/builtins/gen/var/ceil/4bca2a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/ceil/4bca2a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..804cde298a --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/4bca2a.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void ceil_4bca2a() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = ceil(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_4bca2a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_4bca2a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_4bca2a(); + return; +} diff --git a/test/tint/builtins/gen/var/ceil/4bca2a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/ceil/4bca2a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c01139ba21 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/4bca2a.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void ceil_4bca2a() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = ceil(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_4bca2a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_4bca2a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_4bca2a(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024CF8246830(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024CF8246830(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/ceil/4bca2a.wgsl.expected.glsl b/test/tint/builtins/gen/var/ceil/4bca2a.wgsl.expected.glsl new file mode 100644 index 0000000000..d9ac78fa2d --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/4bca2a.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ceil_4bca2a() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = ceil(arg_0); +} + +vec4 vertex_main() { + ceil_4bca2a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void ceil_4bca2a() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = ceil(arg_0); +} + +void fragment_main() { + ceil_4bca2a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ceil_4bca2a() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = ceil(arg_0); +} + +void compute_main() { + ceil_4bca2a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/ceil/4bca2a.wgsl.expected.msl b/test/tint/builtins/gen/var/ceil/4bca2a.wgsl.expected.msl new file mode 100644 index 0000000000..82cc7148fa --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/4bca2a.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void ceil_4bca2a() { + half4 arg_0 = half4(0.0h); + half4 res = ceil(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ceil_4bca2a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ceil_4bca2a(); + return; +} + +kernel void compute_main() { + ceil_4bca2a(); + return; +} + diff --git a/test/tint/builtins/gen/var/ceil/4bca2a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/ceil/4bca2a.wgsl.expected.spvasm new file mode 100644 index 0000000000..e0f5dea8b6 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/4bca2a.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ceil_4bca2a "ceil_4bca2a" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%ceil_4bca2a = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Ceil %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %ceil_4bca2a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %ceil_4bca2a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %ceil_4bca2a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/ceil/4bca2a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/ceil/4bca2a.wgsl.expected.wgsl new file mode 100644 index 0000000000..682d1c394d --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/4bca2a.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn ceil_4bca2a() { + var arg_0 = vec4(f16()); + var res : vec4 = ceil(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_4bca2a(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_4bca2a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_4bca2a(); +} diff --git a/test/tint/builtins/gen/var/ceil/f3f889.wgsl b/test/tint/builtins/gen/var/ceil/f3f889.wgsl new file mode 100644 index 0000000000..2053a508f4 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/f3f889.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn ceil(f16) -> f16 +fn ceil_f3f889() { + var arg_0 = f16(); + var res: f16 = ceil(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_f3f889(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_f3f889(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_f3f889(); +} diff --git a/test/tint/builtins/gen/var/ceil/f3f889.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/ceil/f3f889.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..03dab80377 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/f3f889.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void ceil_f3f889() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = ceil(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_f3f889(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_f3f889(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_f3f889(); + return; +} diff --git a/test/tint/builtins/gen/var/ceil/f3f889.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/ceil/f3f889.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ecdbf03d00 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/f3f889.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void ceil_f3f889() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = ceil(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_f3f889(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_f3f889(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_f3f889(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002391D5D1160(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002391D5D1160(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/ceil/f3f889.wgsl.expected.glsl b/test/tint/builtins/gen/var/ceil/f3f889.wgsl.expected.glsl new file mode 100644 index 0000000000..3459b17432 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/f3f889.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ceil_f3f889() { + float16_t arg_0 = 0.0hf; + float16_t res = ceil(arg_0); +} + +vec4 vertex_main() { + ceil_f3f889(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void ceil_f3f889() { + float16_t arg_0 = 0.0hf; + float16_t res = ceil(arg_0); +} + +void fragment_main() { + ceil_f3f889(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ceil_f3f889() { + float16_t arg_0 = 0.0hf; + float16_t res = ceil(arg_0); +} + +void compute_main() { + ceil_f3f889(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/ceil/f3f889.wgsl.expected.msl b/test/tint/builtins/gen/var/ceil/f3f889.wgsl.expected.msl new file mode 100644 index 0000000000..48f8d6d794 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/f3f889.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void ceil_f3f889() { + half arg_0 = 0.0h; + half res = ceil(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ceil_f3f889(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ceil_f3f889(); + return; +} + +kernel void compute_main() { + ceil_f3f889(); + return; +} + diff --git a/test/tint/builtins/gen/var/ceil/f3f889.wgsl.expected.spvasm b/test/tint/builtins/gen/var/ceil/f3f889.wgsl.expected.spvasm new file mode 100644 index 0000000000..4d48df9faa --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/f3f889.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ceil_f3f889 "ceil_f3f889" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%ceil_f3f889 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Ceil %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %ceil_f3f889 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %ceil_f3f889 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %ceil_f3f889 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/ceil/f3f889.wgsl.expected.wgsl b/test/tint/builtins/gen/var/ceil/f3f889.wgsl.expected.wgsl new file mode 100644 index 0000000000..d00960ecd8 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/f3f889.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn ceil_f3f889() { + var arg_0 = f16(); + var res : f16 = ceil(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_f3f889(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_f3f889(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_f3f889(); +} diff --git a/test/tint/builtins/gen/var/clamp/235b29.wgsl b/test/tint/builtins/gen/var/clamp/235b29.wgsl new file mode 100644 index 0000000000..c77a34095b --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/235b29.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn clamp(vec<2, f16>, vec<2, f16>, vec<2, f16>) -> vec<2, f16> +fn clamp_235b29() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var arg_2 = vec2(f16()); + var res: vec2 = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_235b29(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_235b29(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_235b29(); +} diff --git a/test/tint/builtins/gen/var/clamp/235b29.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/clamp/235b29.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0bab035852 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/235b29.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void clamp_235b29() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + vector arg_2 = (float16_t(0.0h)).xx; + vector res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_235b29(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_235b29(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_235b29(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/235b29.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/clamp/235b29.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1169ce494c --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/235b29.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +SKIP: FAILED + +void clamp_235b29() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + vector arg_2 = (float16_t(0.0h)).xx; + vector res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_235b29(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_235b29(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_235b29(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024CD8072900(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024CD8072900(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024CD8072900(4,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024CD8072900(5,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/clamp/235b29.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/235b29.wgsl.expected.glsl new file mode 100644 index 0000000000..1921aab221 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/235b29.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void clamp_235b29() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 arg_2 = f16vec2(0.0hf); + f16vec2 res = clamp(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + clamp_235b29(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void clamp_235b29() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 arg_2 = f16vec2(0.0hf); + f16vec2 res = clamp(arg_0, arg_1, arg_2); +} + +void fragment_main() { + clamp_235b29(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void clamp_235b29() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 arg_2 = f16vec2(0.0hf); + f16vec2 res = clamp(arg_0, arg_1, arg_2); +} + +void compute_main() { + clamp_235b29(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/235b29.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/235b29.wgsl.expected.msl new file mode 100644 index 0000000000..1d2f620b4f --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/235b29.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void clamp_235b29() { + half2 arg_0 = half2(0.0h); + half2 arg_1 = half2(0.0h); + half2 arg_2 = half2(0.0h); + half2 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_235b29(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_235b29(); + return; +} + +kernel void compute_main() { + clamp_235b29(); + return; +} + diff --git a/test/tint/builtins/gen/var/clamp/235b29.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/235b29.wgsl.expected.spvasm new file mode 100644 index 0000000000..c93b5b8cc0 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/235b29.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_235b29 "clamp_235b29" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_235b29 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %arg_1 = OpVariable %_ptr_Function_v2half Function %15 + %arg_2 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %22 = OpLoad %v2half %arg_0 + %23 = OpLoad %v2half %arg_1 + %24 = OpLoad %v2half %arg_2 + %20 = OpExtInst %v2half %21 NClamp %22 %23 %24 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %clamp_235b29 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %clamp_235b29 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %clamp_235b29 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/clamp/235b29.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/235b29.wgsl.expected.wgsl new file mode 100644 index 0000000000..93013b2912 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/235b29.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn clamp_235b29() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var arg_2 = vec2(f16()); + var res : vec2 = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_235b29(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_235b29(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_235b29(); +} diff --git a/test/tint/builtins/gen/var/clamp/2c251b.wgsl b/test/tint/builtins/gen/var/clamp/2c251b.wgsl new file mode 100644 index 0000000000..95d83b921a --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/2c251b.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn clamp(vec<4, f16>, vec<4, f16>, vec<4, f16>) -> vec<4, f16> +fn clamp_2c251b() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var arg_2 = vec4(f16()); + var res: vec4 = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_2c251b(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_2c251b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_2c251b(); +} diff --git a/test/tint/builtins/gen/var/clamp/2c251b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/clamp/2c251b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..71ec4f69a2 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/2c251b.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void clamp_2c251b() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + vector arg_2 = (float16_t(0.0h)).xxxx; + vector res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_2c251b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_2c251b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_2c251b(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/2c251b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/clamp/2c251b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..946d07a4a8 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/2c251b.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +SKIP: FAILED + +void clamp_2c251b() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + vector arg_2 = (float16_t(0.0h)).xxxx; + vector res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_2c251b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_2c251b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_2c251b(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D56C1F9DE0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D56C1F9DE0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D56C1F9DE0(4,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D56C1F9DE0(5,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/clamp/2c251b.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/2c251b.wgsl.expected.glsl new file mode 100644 index 0000000000..6c4f3c1514 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/2c251b.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void clamp_2c251b() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 arg_2 = f16vec4(0.0hf); + f16vec4 res = clamp(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + clamp_2c251b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void clamp_2c251b() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 arg_2 = f16vec4(0.0hf); + f16vec4 res = clamp(arg_0, arg_1, arg_2); +} + +void fragment_main() { + clamp_2c251b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void clamp_2c251b() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 arg_2 = f16vec4(0.0hf); + f16vec4 res = clamp(arg_0, arg_1, arg_2); +} + +void compute_main() { + clamp_2c251b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/2c251b.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/2c251b.wgsl.expected.msl new file mode 100644 index 0000000000..b84d2b06af --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/2c251b.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void clamp_2c251b() { + half4 arg_0 = half4(0.0h); + half4 arg_1 = half4(0.0h); + half4 arg_2 = half4(0.0h); + half4 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_2c251b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_2c251b(); + return; +} + +kernel void compute_main() { + clamp_2c251b(); + return; +} + diff --git a/test/tint/builtins/gen/var/clamp/2c251b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/2c251b.wgsl.expected.spvasm new file mode 100644 index 0000000000..995110b45b --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/2c251b.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_2c251b "clamp_2c251b" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_2c251b = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %arg_1 = OpVariable %_ptr_Function_v4half Function %15 + %arg_2 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %22 = OpLoad %v4half %arg_0 + %23 = OpLoad %v4half %arg_1 + %24 = OpLoad %v4half %arg_2 + %20 = OpExtInst %v4half %21 NClamp %22 %23 %24 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %clamp_2c251b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %clamp_2c251b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %clamp_2c251b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/clamp/2c251b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/2c251b.wgsl.expected.wgsl new file mode 100644 index 0000000000..66ca8c34fa --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/2c251b.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn clamp_2c251b() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var arg_2 = vec4(f16()); + var res : vec4 = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_2c251b(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_2c251b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_2c251b(); +} diff --git a/test/tint/builtins/gen/var/clamp/553ffb.wgsl b/test/tint/builtins/gen/var/clamp/553ffb.wgsl new file mode 100644 index 0000000000..accceec0d5 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/553ffb.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn clamp(f16, f16, f16) -> f16 +fn clamp_553ffb() { + var arg_0 = f16(); + var arg_1 = f16(); + var arg_2 = f16(); + var res: f16 = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_553ffb(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_553ffb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_553ffb(); +} diff --git a/test/tint/builtins/gen/var/clamp/553ffb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/clamp/553ffb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3b9eae4e48 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/553ffb.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void clamp_553ffb() { + float16_t arg_0 = float16_t(0.0h); + float16_t arg_1 = float16_t(0.0h); + float16_t arg_2 = float16_t(0.0h); + float16_t res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_553ffb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_553ffb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_553ffb(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/553ffb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/clamp/553ffb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6c663b8dfc --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/553ffb.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void clamp_553ffb() { + float16_t arg_0 = float16_t(0.0h); + float16_t arg_1 = float16_t(0.0h); + float16_t arg_2 = float16_t(0.0h); + float16_t res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_553ffb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_553ffb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_553ffb(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022BE4491540(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022BE4491540(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/clamp/553ffb.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/553ffb.wgsl.expected.glsl new file mode 100644 index 0000000000..30b888f626 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/553ffb.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void clamp_553ffb() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t arg_2 = 0.0hf; + float16_t res = clamp(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + clamp_553ffb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void clamp_553ffb() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t arg_2 = 0.0hf; + float16_t res = clamp(arg_0, arg_1, arg_2); +} + +void fragment_main() { + clamp_553ffb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void clamp_553ffb() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t arg_2 = 0.0hf; + float16_t res = clamp(arg_0, arg_1, arg_2); +} + +void compute_main() { + clamp_553ffb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/553ffb.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/553ffb.wgsl.expected.msl new file mode 100644 index 0000000000..27aaf05b6f --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/553ffb.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void clamp_553ffb() { + half arg_0 = 0.0h; + half arg_1 = 0.0h; + half arg_2 = 0.0h; + half res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_553ffb(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_553ffb(); + return; +} + +kernel void compute_main() { + clamp_553ffb(); + return; +} + diff --git a/test/tint/builtins/gen/var/clamp/553ffb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/553ffb.wgsl.expected.spvasm new file mode 100644 index 0000000000..4254790664 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/553ffb.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_553ffb "clamp_553ffb" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_553ffb = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %arg_1 = OpVariable %_ptr_Function_half Function %14 + %arg_2 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + OpStore %arg_2 %14 + %21 = OpLoad %half %arg_0 + %22 = OpLoad %half %arg_1 + %23 = OpLoad %half %arg_2 + %19 = OpExtInst %half %20 NClamp %21 %22 %23 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %clamp_553ffb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %clamp_553ffb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %clamp_553ffb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/clamp/553ffb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/553ffb.wgsl.expected.wgsl new file mode 100644 index 0000000000..875ec681d6 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/553ffb.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn clamp_553ffb() { + var arg_0 = f16(); + var arg_1 = f16(); + var arg_2 = f16(); + var res : f16 = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_553ffb(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_553ffb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_553ffb(); +} diff --git a/test/tint/builtins/gen/var/clamp/b195eb.wgsl b/test/tint/builtins/gen/var/clamp/b195eb.wgsl new file mode 100644 index 0000000000..b0680c3e20 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/b195eb.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn clamp(vec<3, f16>, vec<3, f16>, vec<3, f16>) -> vec<3, f16> +fn clamp_b195eb() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var arg_2 = vec3(f16()); + var res: vec3 = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_b195eb(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_b195eb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_b195eb(); +} diff --git a/test/tint/builtins/gen/var/clamp/b195eb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/clamp/b195eb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..51d3bc68d0 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/b195eb.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void clamp_b195eb() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector arg_2 = (float16_t(0.0h)).xxx; + vector res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_b195eb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_b195eb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_b195eb(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/b195eb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/clamp/b195eb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..87a16e60d2 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/b195eb.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +SKIP: FAILED + +void clamp_b195eb() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector arg_2 = (float16_t(0.0h)).xxx; + vector res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_b195eb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_b195eb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_b195eb(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002017A6F3930(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002017A6F3930(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002017A6F3930(4,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002017A6F3930(5,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/clamp/b195eb.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/b195eb.wgsl.expected.glsl new file mode 100644 index 0000000000..d1d0084050 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/b195eb.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void clamp_b195eb() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 arg_2 = f16vec3(0.0hf); + f16vec3 res = clamp(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + clamp_b195eb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void clamp_b195eb() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 arg_2 = f16vec3(0.0hf); + f16vec3 res = clamp(arg_0, arg_1, arg_2); +} + +void fragment_main() { + clamp_b195eb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void clamp_b195eb() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 arg_2 = f16vec3(0.0hf); + f16vec3 res = clamp(arg_0, arg_1, arg_2); +} + +void compute_main() { + clamp_b195eb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/b195eb.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/b195eb.wgsl.expected.msl new file mode 100644 index 0000000000..3bedc87f91 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/b195eb.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void clamp_b195eb() { + half3 arg_0 = half3(0.0h); + half3 arg_1 = half3(0.0h); + half3 arg_2 = half3(0.0h); + half3 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_b195eb(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_b195eb(); + return; +} + +kernel void compute_main() { + clamp_b195eb(); + return; +} + diff --git a/test/tint/builtins/gen/var/clamp/b195eb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/b195eb.wgsl.expected.spvasm new file mode 100644 index 0000000000..2383ac6f7e --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/b195eb.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_b195eb "clamp_b195eb" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_b195eb = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %arg_1 = OpVariable %_ptr_Function_v3half Function %15 + %arg_2 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %22 = OpLoad %v3half %arg_0 + %23 = OpLoad %v3half %arg_1 + %24 = OpLoad %v3half %arg_2 + %20 = OpExtInst %v3half %21 NClamp %22 %23 %24 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %clamp_b195eb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %clamp_b195eb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %clamp_b195eb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/clamp/b195eb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/b195eb.wgsl.expected.wgsl new file mode 100644 index 0000000000..7baa8c0ee0 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/b195eb.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn clamp_b195eb() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var arg_2 = vec3(f16()); + var res : vec3 = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_b195eb(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_b195eb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_b195eb(); +} diff --git a/test/tint/builtins/gen/var/cos/0835a8.wgsl b/test/tint/builtins/gen/var/cos/0835a8.wgsl new file mode 100644 index 0000000000..305a93ebe7 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/0835a8.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn cos(vec<3, f16>) -> vec<3, f16> +fn cos_0835a8() { + var arg_0 = vec3(f16()); + var res: vec3 = cos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_0835a8(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_0835a8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_0835a8(); +} diff --git a/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cced281af6 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void cos_0835a8() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = cos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_0835a8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_0835a8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_0835a8(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6a8d875b56 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void cos_0835a8() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = cos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_0835a8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_0835a8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_0835a8(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000026FB6F714B0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000026FB6F714B0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.glsl b/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.glsl new file mode 100644 index 0000000000..bafe1a5463 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cos_0835a8() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = cos(arg_0); +} + +vec4 vertex_main() { + cos_0835a8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void cos_0835a8() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = cos(arg_0); +} + +void fragment_main() { + cos_0835a8(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cos_0835a8() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = cos(arg_0); +} + +void compute_main() { + cos_0835a8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.msl b/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.msl new file mode 100644 index 0000000000..9420e0baf2 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void cos_0835a8() { + half3 arg_0 = half3(0.0h); + half3 res = cos(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cos_0835a8(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cos_0835a8(); + return; +} + +kernel void compute_main() { + cos_0835a8(); + return; +} + diff --git a/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.spvasm new file mode 100644 index 0000000000..9ae25ea410 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cos_0835a8 "cos_0835a8" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %cos_0835a8 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Cos %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %cos_0835a8 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %cos_0835a8 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %cos_0835a8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.wgsl new file mode 100644 index 0000000000..9646c47041 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn cos_0835a8() { + var arg_0 = vec3(f16()); + var res : vec3 = cos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_0835a8(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_0835a8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_0835a8(); +} diff --git a/test/tint/builtins/gen/var/cos/0a89f7.wgsl b/test/tint/builtins/gen/var/cos/0a89f7.wgsl new file mode 100644 index 0000000000..57ead0ae8d --- /dev/null +++ b/test/tint/builtins/gen/var/cos/0a89f7.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn cos(vec<4, f16>) -> vec<4, f16> +fn cos_0a89f7() { + var arg_0 = vec4(f16()); + var res: vec4 = cos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_0a89f7(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_0a89f7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_0a89f7(); +} diff --git a/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3d47a4ab2b --- /dev/null +++ b/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void cos_0a89f7() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = cos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_0a89f7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_0a89f7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_0a89f7(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..01410b8820 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void cos_0a89f7() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = cos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_0a89f7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_0a89f7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_0a89f7(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000012D2C4B1DB0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000012D2C4B1DB0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.glsl b/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.glsl new file mode 100644 index 0000000000..ba601e2f1a --- /dev/null +++ b/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cos_0a89f7() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = cos(arg_0); +} + +vec4 vertex_main() { + cos_0a89f7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void cos_0a89f7() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = cos(arg_0); +} + +void fragment_main() { + cos_0a89f7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cos_0a89f7() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = cos(arg_0); +} + +void compute_main() { + cos_0a89f7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.msl b/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.msl new file mode 100644 index 0000000000..82d913de47 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void cos_0a89f7() { + half4 arg_0 = half4(0.0h); + half4 res = cos(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cos_0a89f7(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cos_0a89f7(); + return; +} + +kernel void compute_main() { + cos_0a89f7(); + return; +} + diff --git a/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.spvasm new file mode 100644 index 0000000000..c2987df17f --- /dev/null +++ b/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cos_0a89f7 "cos_0a89f7" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %cos_0a89f7 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Cos %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %cos_0a89f7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %cos_0a89f7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %cos_0a89f7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.wgsl new file mode 100644 index 0000000000..9d809bd010 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn cos_0a89f7() { + var arg_0 = vec4(f16()); + var res : vec4 = cos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_0a89f7(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_0a89f7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_0a89f7(); +} diff --git a/test/tint/builtins/gen/var/cos/5bc2c6.wgsl b/test/tint/builtins/gen/var/cos/5bc2c6.wgsl new file mode 100644 index 0000000000..f539734fb8 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/5bc2c6.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn cos(vec<2, f16>) -> vec<2, f16> +fn cos_5bc2c6() { + var arg_0 = vec2(f16()); + var res: vec2 = cos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_5bc2c6(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_5bc2c6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_5bc2c6(); +} diff --git a/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..09dad0a3da --- /dev/null +++ b/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void cos_5bc2c6() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = cos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_5bc2c6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_5bc2c6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_5bc2c6(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..856b91fd2a --- /dev/null +++ b/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void cos_5bc2c6() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = cos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_5bc2c6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_5bc2c6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_5bc2c6(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021A2289CA00(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021A2289CA00(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.glsl b/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.glsl new file mode 100644 index 0000000000..511a5070e1 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cos_5bc2c6() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = cos(arg_0); +} + +vec4 vertex_main() { + cos_5bc2c6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void cos_5bc2c6() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = cos(arg_0); +} + +void fragment_main() { + cos_5bc2c6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cos_5bc2c6() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = cos(arg_0); +} + +void compute_main() { + cos_5bc2c6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.msl b/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.msl new file mode 100644 index 0000000000..0eb35962e6 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void cos_5bc2c6() { + half2 arg_0 = half2(0.0h); + half2 res = cos(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cos_5bc2c6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cos_5bc2c6(); + return; +} + +kernel void compute_main() { + cos_5bc2c6(); + return; +} + diff --git a/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.spvasm new file mode 100644 index 0000000000..e3000bb0d1 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cos_5bc2c6 "cos_5bc2c6" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %cos_5bc2c6 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Cos %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %cos_5bc2c6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %cos_5bc2c6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %cos_5bc2c6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.wgsl new file mode 100644 index 0000000000..f5711b7cca --- /dev/null +++ b/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn cos_5bc2c6() { + var arg_0 = vec2(f16()); + var res : vec2 = cos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_5bc2c6(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_5bc2c6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_5bc2c6(); +} diff --git a/test/tint/builtins/gen/var/cos/fc047d.wgsl b/test/tint/builtins/gen/var/cos/fc047d.wgsl new file mode 100644 index 0000000000..0daf862c95 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/fc047d.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn cos(f16) -> f16 +fn cos_fc047d() { + var arg_0 = f16(); + var res: f16 = cos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_fc047d(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_fc047d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_fc047d(); +} diff --git a/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..54b9f70a02 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void cos_fc047d() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = cos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_fc047d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_fc047d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_fc047d(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fb57ccb021 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void cos_fc047d() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = cos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_fc047d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_fc047d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_fc047d(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000023368939570(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000023368939570(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.glsl b/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.glsl new file mode 100644 index 0000000000..093b9d2e4c --- /dev/null +++ b/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cos_fc047d() { + float16_t arg_0 = 0.0hf; + float16_t res = cos(arg_0); +} + +vec4 vertex_main() { + cos_fc047d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void cos_fc047d() { + float16_t arg_0 = 0.0hf; + float16_t res = cos(arg_0); +} + +void fragment_main() { + cos_fc047d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cos_fc047d() { + float16_t arg_0 = 0.0hf; + float16_t res = cos(arg_0); +} + +void compute_main() { + cos_fc047d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.msl b/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.msl new file mode 100644 index 0000000000..2c230eb3df --- /dev/null +++ b/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void cos_fc047d() { + half arg_0 = 0.0h; + half res = cos(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cos_fc047d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cos_fc047d(); + return; +} + +kernel void compute_main() { + cos_fc047d(); + return; +} + diff --git a/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.spvasm new file mode 100644 index 0000000000..4adfb5efe3 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cos_fc047d "cos_fc047d" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %cos_fc047d = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Cos %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %cos_fc047d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %cos_fc047d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %cos_fc047d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.wgsl new file mode 100644 index 0000000000..2230ba231a --- /dev/null +++ b/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn cos_fc047d() { + var arg_0 = f16(); + var res : f16 = cos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_fc047d(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_fc047d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_fc047d(); +} diff --git a/test/tint/builtins/gen/var/cosh/2ed778.wgsl b/test/tint/builtins/gen/var/cosh/2ed778.wgsl new file mode 100644 index 0000000000..b1f69a8002 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/2ed778.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn cosh(f16) -> f16 +fn cosh_2ed778() { + var arg_0 = f16(); + var res: f16 = cosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_2ed778(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_2ed778(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_2ed778(); +} diff --git a/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6689a7fa3f --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void cosh_2ed778() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = cosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_2ed778(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_2ed778(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_2ed778(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..daec56396a --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void cosh_2ed778() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = cosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_2ed778(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_2ed778(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_2ed778(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000025119222EB0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000025119222EB0(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.glsl b/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.glsl new file mode 100644 index 0000000000..52057b9508 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cosh_2ed778() { + float16_t arg_0 = 0.0hf; + float16_t res = cosh(arg_0); +} + +vec4 vertex_main() { + cosh_2ed778(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void cosh_2ed778() { + float16_t arg_0 = 0.0hf; + float16_t res = cosh(arg_0); +} + +void fragment_main() { + cosh_2ed778(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cosh_2ed778() { + float16_t arg_0 = 0.0hf; + float16_t res = cosh(arg_0); +} + +void compute_main() { + cosh_2ed778(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.msl b/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.msl new file mode 100644 index 0000000000..6f72358aae --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void cosh_2ed778() { + half arg_0 = 0.0h; + half res = cosh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cosh_2ed778(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cosh_2ed778(); + return; +} + +kernel void compute_main() { + cosh_2ed778(); + return; +} + diff --git a/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.spvasm new file mode 100644 index 0000000000..2079d7e03b --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cosh_2ed778 "cosh_2ed778" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%cosh_2ed778 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Cosh %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %cosh_2ed778 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %cosh_2ed778 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %cosh_2ed778 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.wgsl new file mode 100644 index 0000000000..4d5670595f --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn cosh_2ed778() { + var arg_0 = f16(); + var res : f16 = cosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_2ed778(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_2ed778(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_2ed778(); +} diff --git a/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl b/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl new file mode 100644 index 0000000000..133748afb0 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn cosh(vec<4, f16>) -> vec<4, f16> +fn cosh_3b7bbf() { + var arg_0 = vec4(f16()); + var res: vec4 = cosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_3b7bbf(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_3b7bbf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_3b7bbf(); +} diff --git a/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5a96478604 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void cosh_3b7bbf() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = cosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_3b7bbf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_3b7bbf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_3b7bbf(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5838354002 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void cosh_3b7bbf() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = cosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_3b7bbf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_3b7bbf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_3b7bbf(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000023E2A2C07F0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000023E2A2C07F0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.glsl b/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.glsl new file mode 100644 index 0000000000..8ea08d9328 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cosh_3b7bbf() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = cosh(arg_0); +} + +vec4 vertex_main() { + cosh_3b7bbf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void cosh_3b7bbf() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = cosh(arg_0); +} + +void fragment_main() { + cosh_3b7bbf(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cosh_3b7bbf() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = cosh(arg_0); +} + +void compute_main() { + cosh_3b7bbf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.msl b/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.msl new file mode 100644 index 0000000000..12acf5fd52 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void cosh_3b7bbf() { + half4 arg_0 = half4(0.0h); + half4 res = cosh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cosh_3b7bbf(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cosh_3b7bbf(); + return; +} + +kernel void compute_main() { + cosh_3b7bbf(); + return; +} + diff --git a/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.spvasm new file mode 100644 index 0000000000..3b9f8d4ba1 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cosh_3b7bbf "cosh_3b7bbf" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%cosh_3b7bbf = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Cosh %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %cosh_3b7bbf + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %cosh_3b7bbf + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %cosh_3b7bbf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.wgsl new file mode 100644 index 0000000000..06d346d94e --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn cosh_3b7bbf() { + var arg_0 = vec4(f16()); + var res : vec4 = cosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_3b7bbf(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_3b7bbf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_3b7bbf(); +} diff --git a/test/tint/builtins/gen/var/cosh/43b672.wgsl b/test/tint/builtins/gen/var/cosh/43b672.wgsl new file mode 100644 index 0000000000..a1e32ad8da --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/43b672.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn cosh(vec<2, f16>) -> vec<2, f16> +fn cosh_43b672() { + var arg_0 = vec2(f16()); + var res: vec2 = cosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_43b672(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_43b672(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_43b672(); +} diff --git a/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..db19b27193 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void cosh_43b672() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = cosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_43b672(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_43b672(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_43b672(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a35fa628a4 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void cosh_43b672() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = cosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_43b672(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_43b672(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_43b672(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000244BAA52310(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000244BAA52310(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.glsl b/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.glsl new file mode 100644 index 0000000000..8c60a2cd95 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cosh_43b672() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = cosh(arg_0); +} + +vec4 vertex_main() { + cosh_43b672(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void cosh_43b672() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = cosh(arg_0); +} + +void fragment_main() { + cosh_43b672(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cosh_43b672() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = cosh(arg_0); +} + +void compute_main() { + cosh_43b672(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.msl b/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.msl new file mode 100644 index 0000000000..1a50e7e669 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void cosh_43b672() { + half2 arg_0 = half2(0.0h); + half2 res = cosh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cosh_43b672(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cosh_43b672(); + return; +} + +kernel void compute_main() { + cosh_43b672(); + return; +} + diff --git a/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.spvasm new file mode 100644 index 0000000000..5658285aea --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cosh_43b672 "cosh_43b672" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%cosh_43b672 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Cosh %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %cosh_43b672 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %cosh_43b672 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %cosh_43b672 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.wgsl new file mode 100644 index 0000000000..979119f2b6 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn cosh_43b672() { + var arg_0 = vec2(f16()); + var res : vec2 = cosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_43b672(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_43b672(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_43b672(); +} diff --git a/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl b/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl new file mode 100644 index 0000000000..10b551b180 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn cosh(vec<3, f16>) -> vec<3, f16> +fn cosh_b1b8a0() { + var arg_0 = vec3(f16()); + var res: vec3 = cosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_b1b8a0(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_b1b8a0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_b1b8a0(); +} diff --git a/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a058cd26b0 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void cosh_b1b8a0() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = cosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_b1b8a0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_b1b8a0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_b1b8a0(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..86a786ded5 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void cosh_b1b8a0() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = cosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_b1b8a0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_b1b8a0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_b1b8a0(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018FD1882B50(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018FD1882B50(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.glsl b/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.glsl new file mode 100644 index 0000000000..6566e922c4 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cosh_b1b8a0() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = cosh(arg_0); +} + +vec4 vertex_main() { + cosh_b1b8a0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void cosh_b1b8a0() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = cosh(arg_0); +} + +void fragment_main() { + cosh_b1b8a0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cosh_b1b8a0() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = cosh(arg_0); +} + +void compute_main() { + cosh_b1b8a0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.msl b/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.msl new file mode 100644 index 0000000000..2cf0802e2c --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void cosh_b1b8a0() { + half3 arg_0 = half3(0.0h); + half3 res = cosh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cosh_b1b8a0(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cosh_b1b8a0(); + return; +} + +kernel void compute_main() { + cosh_b1b8a0(); + return; +} + diff --git a/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.spvasm new file mode 100644 index 0000000000..29505ec4ba --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cosh_b1b8a0 "cosh_b1b8a0" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%cosh_b1b8a0 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Cosh %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %cosh_b1b8a0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %cosh_b1b8a0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %cosh_b1b8a0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.wgsl new file mode 100644 index 0000000000..273765b77d --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn cosh_b1b8a0() { + var arg_0 = vec3(f16()); + var res : vec3 = cosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_b1b8a0(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_b1b8a0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_b1b8a0(); +} diff --git a/test/tint/builtins/gen/var/cross/9857cb.wgsl b/test/tint/builtins/gen/var/cross/9857cb.wgsl new file mode 100644 index 0000000000..39258c8702 --- /dev/null +++ b/test/tint/builtins/gen/var/cross/9857cb.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn cross(vec3, vec3) -> vec3 +fn cross_9857cb() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var res: vec3 = cross(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cross_9857cb(); + return vec4(); +} + +@fragment +fn fragment_main() { + cross_9857cb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cross_9857cb(); +} diff --git a/test/tint/builtins/gen/var/cross/9857cb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cross/9857cb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fdb9f034ef --- /dev/null +++ b/test/tint/builtins/gen/var/cross/9857cb.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void cross_9857cb() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector res = cross(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cross_9857cb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cross_9857cb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cross_9857cb(); + return; +} diff --git a/test/tint/builtins/gen/var/cross/9857cb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/cross/9857cb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9c32ca71bd --- /dev/null +++ b/test/tint/builtins/gen/var/cross/9857cb.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void cross_9857cb() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector res = cross(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cross_9857cb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cross_9857cb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cross_9857cb(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018E1A1D1BC0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018E1A1D1BC0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018E1A1D1BC0(4,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/cross/9857cb.wgsl.expected.glsl b/test/tint/builtins/gen/var/cross/9857cb.wgsl.expected.glsl new file mode 100644 index 0000000000..8d62b4025e --- /dev/null +++ b/test/tint/builtins/gen/var/cross/9857cb.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cross_9857cb() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 res = cross(arg_0, arg_1); +} + +vec4 vertex_main() { + cross_9857cb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void cross_9857cb() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 res = cross(arg_0, arg_1); +} + +void fragment_main() { + cross_9857cb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cross_9857cb() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 res = cross(arg_0, arg_1); +} + +void compute_main() { + cross_9857cb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/cross/9857cb.wgsl.expected.msl b/test/tint/builtins/gen/var/cross/9857cb.wgsl.expected.msl new file mode 100644 index 0000000000..23ad005920 --- /dev/null +++ b/test/tint/builtins/gen/var/cross/9857cb.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void cross_9857cb() { + half3 arg_0 = half3(0.0h); + half3 arg_1 = half3(0.0h); + half3 res = cross(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cross_9857cb(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cross_9857cb(); + return; +} + +kernel void compute_main() { + cross_9857cb(); + return; +} + diff --git a/test/tint/builtins/gen/var/cross/9857cb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cross/9857cb.wgsl.expected.spvasm new file mode 100644 index 0000000000..3f88a0b061 --- /dev/null +++ b/test/tint/builtins/gen/var/cross/9857cb.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cross_9857cb "cross_9857cb" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%cross_9857cb = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %arg_1 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v3half %arg_0 + %22 = OpLoad %v3half %arg_1 + %19 = OpExtInst %v3half %20 Cross %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %cross_9857cb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %cross_9857cb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %cross_9857cb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cross/9857cb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cross/9857cb.wgsl.expected.wgsl new file mode 100644 index 0000000000..c249f4f934 --- /dev/null +++ b/test/tint/builtins/gen/var/cross/9857cb.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn cross_9857cb() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var res : vec3 = cross(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cross_9857cb(); + return vec4(); +} + +@fragment +fn fragment_main() { + cross_9857cb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cross_9857cb(); +} diff --git a/test/tint/builtins/gen/var/degrees/3055d3.wgsl b/test/tint/builtins/gen/var/degrees/3055d3.wgsl new file mode 100644 index 0000000000..2ccb71f726 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/3055d3.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn degrees(vec<4, f16>) -> vec<4, f16> +fn degrees_3055d3() { + var arg_0 = vec4(f16()); + var res: vec4 = degrees(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_3055d3(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_3055d3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_3055d3(); +} diff --git a/test/tint/builtins/gen/var/degrees/3055d3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/degrees/3055d3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b7a4b58df9 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/3055d3.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +vector tint_degrees(vector param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_3055d3() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = tint_degrees(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_3055d3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_3055d3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_3055d3(); + return; +} diff --git a/test/tint/builtins/gen/var/degrees/3055d3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/degrees/3055d3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..dc4b54ad56 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/3055d3.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +vector tint_degrees(vector param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_3055d3() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = tint_degrees(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_3055d3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_3055d3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_3055d3(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000151C0FBF8C0(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/degrees/3055d3.wgsl.expected.glsl b/test/tint/builtins/gen/var/degrees/3055d3.wgsl.expected.glsl new file mode 100644 index 0000000000..8a051036cb --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/3055d3.wgsl.expected.glsl @@ -0,0 +1,70 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec4 tint_degrees(f16vec4 param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_3055d3() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = tint_degrees(arg_0); +} + +vec4 vertex_main() { + degrees_3055d3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec4 tint_degrees(f16vec4 param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_3055d3() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = tint_degrees(arg_0); +} + +void fragment_main() { + degrees_3055d3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec4 tint_degrees(f16vec4 param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_3055d3() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = tint_degrees(arg_0); +} + +void compute_main() { + degrees_3055d3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/degrees/3055d3.wgsl.expected.msl b/test/tint/builtins/gen/var/degrees/3055d3.wgsl.expected.msl new file mode 100644 index 0000000000..e4ca478fba --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/3055d3.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; + +half4 tint_degrees(half4 param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_3055d3() { + half4 arg_0 = half4(0.0h); + half4 res = tint_degrees(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + degrees_3055d3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + degrees_3055d3(); + return; +} + +kernel void compute_main() { + degrees_3055d3(); + return; +} + diff --git a/test/tint/builtins/gen/var/degrees/3055d3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/degrees/3055d3.wgsl.expected.spvasm new file mode 100644 index 0000000000..2604fcfe33 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/3055d3.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %degrees_3055d3 "degrees_3055d3" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%degrees_3055d3 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Degrees %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %degrees_3055d3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %degrees_3055d3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %degrees_3055d3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/degrees/3055d3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/degrees/3055d3.wgsl.expected.wgsl new file mode 100644 index 0000000000..284c1c8c72 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/3055d3.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn degrees_3055d3() { + var arg_0 = vec4(f16()); + var res : vec4 = degrees(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_3055d3(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_3055d3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_3055d3(); +} diff --git a/test/tint/builtins/gen/var/degrees/5e9805.wgsl b/test/tint/builtins/gen/var/degrees/5e9805.wgsl new file mode 100644 index 0000000000..3b13f5f558 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/5e9805.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn degrees(f16) -> f16 +fn degrees_5e9805() { + var arg_0 = f16(); + var res: f16 = degrees(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_5e9805(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_5e9805(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_5e9805(); +} diff --git a/test/tint/builtins/gen/var/degrees/5e9805.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/degrees/5e9805.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b23805c45e --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/5e9805.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +float16_t tint_degrees(float16_t param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_5e9805() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = tint_degrees(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_5e9805(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_5e9805(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_5e9805(); + return; +} diff --git a/test/tint/builtins/gen/var/degrees/5e9805.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/degrees/5e9805.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..32b3d346a4 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/5e9805.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +float16_t tint_degrees(float16_t param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_5e9805() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = tint_degrees(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_5e9805(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_5e9805(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_5e9805(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020047AF8DA0(1,1-9): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/builtins/gen/var/degrees/5e9805.wgsl.expected.glsl b/test/tint/builtins/gen/var/degrees/5e9805.wgsl.expected.glsl new file mode 100644 index 0000000000..69aaca4062 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/5e9805.wgsl.expected.glsl @@ -0,0 +1,70 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +float16_t tint_degrees(float16_t param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_5e9805() { + float16_t arg_0 = 0.0hf; + float16_t res = tint_degrees(arg_0); +} + +vec4 vertex_main() { + degrees_5e9805(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +float16_t tint_degrees(float16_t param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_5e9805() { + float16_t arg_0 = 0.0hf; + float16_t res = tint_degrees(arg_0); +} + +void fragment_main() { + degrees_5e9805(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +float16_t tint_degrees(float16_t param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_5e9805() { + float16_t arg_0 = 0.0hf; + float16_t res = tint_degrees(arg_0); +} + +void compute_main() { + degrees_5e9805(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/degrees/5e9805.wgsl.expected.msl b/test/tint/builtins/gen/var/degrees/5e9805.wgsl.expected.msl new file mode 100644 index 0000000000..6639be5e18 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/5e9805.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; + +half tint_degrees(half param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_5e9805() { + half arg_0 = 0.0h; + half res = tint_degrees(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + degrees_5e9805(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + degrees_5e9805(); + return; +} + +kernel void compute_main() { + degrees_5e9805(); + return; +} + diff --git a/test/tint/builtins/gen/var/degrees/5e9805.wgsl.expected.spvasm b/test/tint/builtins/gen/var/degrees/5e9805.wgsl.expected.spvasm new file mode 100644 index 0000000000..bb166209c3 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/5e9805.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %degrees_5e9805 "degrees_5e9805" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%degrees_5e9805 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Degrees %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %degrees_5e9805 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %degrees_5e9805 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %degrees_5e9805 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/degrees/5e9805.wgsl.expected.wgsl b/test/tint/builtins/gen/var/degrees/5e9805.wgsl.expected.wgsl new file mode 100644 index 0000000000..1d9e554e2e --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/5e9805.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn degrees_5e9805() { + var arg_0 = f16(); + var res : f16 = degrees(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_5e9805(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_5e9805(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_5e9805(); +} diff --git a/test/tint/builtins/gen/var/degrees/dfe8f4.wgsl b/test/tint/builtins/gen/var/degrees/dfe8f4.wgsl new file mode 100644 index 0000000000..6cd4a1de97 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/dfe8f4.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn degrees(vec<3, f16>) -> vec<3, f16> +fn degrees_dfe8f4() { + var arg_0 = vec3(f16()); + var res: vec3 = degrees(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_dfe8f4(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_dfe8f4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_dfe8f4(); +} diff --git a/test/tint/builtins/gen/var/degrees/dfe8f4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/degrees/dfe8f4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..392869bdb9 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/dfe8f4.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +vector tint_degrees(vector param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_dfe8f4() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = tint_degrees(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_dfe8f4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_dfe8f4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_dfe8f4(); + return; +} diff --git a/test/tint/builtins/gen/var/degrees/dfe8f4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/degrees/dfe8f4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5066e38d73 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/dfe8f4.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +vector tint_degrees(vector param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_dfe8f4() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = tint_degrees(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_dfe8f4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_dfe8f4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_dfe8f4(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000192E8B81620(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/degrees/dfe8f4.wgsl.expected.glsl b/test/tint/builtins/gen/var/degrees/dfe8f4.wgsl.expected.glsl new file mode 100644 index 0000000000..d82db9e073 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/dfe8f4.wgsl.expected.glsl @@ -0,0 +1,70 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec3 tint_degrees(f16vec3 param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_dfe8f4() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = tint_degrees(arg_0); +} + +vec4 vertex_main() { + degrees_dfe8f4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec3 tint_degrees(f16vec3 param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_dfe8f4() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = tint_degrees(arg_0); +} + +void fragment_main() { + degrees_dfe8f4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec3 tint_degrees(f16vec3 param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_dfe8f4() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = tint_degrees(arg_0); +} + +void compute_main() { + degrees_dfe8f4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/degrees/dfe8f4.wgsl.expected.msl b/test/tint/builtins/gen/var/degrees/dfe8f4.wgsl.expected.msl new file mode 100644 index 0000000000..cf288cdb58 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/dfe8f4.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; + +half3 tint_degrees(half3 param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_dfe8f4() { + half3 arg_0 = half3(0.0h); + half3 res = tint_degrees(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + degrees_dfe8f4(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + degrees_dfe8f4(); + return; +} + +kernel void compute_main() { + degrees_dfe8f4(); + return; +} + diff --git a/test/tint/builtins/gen/var/degrees/dfe8f4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/degrees/dfe8f4.wgsl.expected.spvasm new file mode 100644 index 0000000000..32166139d0 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/dfe8f4.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %degrees_dfe8f4 "degrees_dfe8f4" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%degrees_dfe8f4 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Degrees %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %degrees_dfe8f4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %degrees_dfe8f4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %degrees_dfe8f4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/degrees/dfe8f4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/degrees/dfe8f4.wgsl.expected.wgsl new file mode 100644 index 0000000000..3ec216f1bb --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/dfe8f4.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn degrees_dfe8f4() { + var arg_0 = vec3(f16()); + var res : vec3 = degrees(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_dfe8f4(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_dfe8f4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_dfe8f4(); +} diff --git a/test/tint/builtins/gen/var/degrees/f59715.wgsl b/test/tint/builtins/gen/var/degrees/f59715.wgsl new file mode 100644 index 0000000000..a091857dc5 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/f59715.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn degrees(vec<2, f16>) -> vec<2, f16> +fn degrees_f59715() { + var arg_0 = vec2(f16()); + var res: vec2 = degrees(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_f59715(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_f59715(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_f59715(); +} diff --git a/test/tint/builtins/gen/var/degrees/f59715.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/degrees/f59715.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2bf6ba7b6b --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/f59715.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +vector tint_degrees(vector param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_f59715() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = tint_degrees(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_f59715(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_f59715(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_f59715(); + return; +} diff --git a/test/tint/builtins/gen/var/degrees/f59715.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/degrees/f59715.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b378860836 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/f59715.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +vector tint_degrees(vector param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_f59715() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = tint_degrees(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_f59715(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_f59715(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_f59715(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022454CA0150(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/degrees/f59715.wgsl.expected.glsl b/test/tint/builtins/gen/var/degrees/f59715.wgsl.expected.glsl new file mode 100644 index 0000000000..0273ac4221 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/f59715.wgsl.expected.glsl @@ -0,0 +1,70 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec2 tint_degrees(f16vec2 param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_f59715() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = tint_degrees(arg_0); +} + +vec4 vertex_main() { + degrees_f59715(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec2 tint_degrees(f16vec2 param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_f59715() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = tint_degrees(arg_0); +} + +void fragment_main() { + degrees_f59715(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec2 tint_degrees(f16vec2 param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_f59715() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = tint_degrees(arg_0); +} + +void compute_main() { + degrees_f59715(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/degrees/f59715.wgsl.expected.msl b/test/tint/builtins/gen/var/degrees/f59715.wgsl.expected.msl new file mode 100644 index 0000000000..a454ff0a37 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/f59715.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; + +half2 tint_degrees(half2 param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_f59715() { + half2 arg_0 = half2(0.0h); + half2 res = tint_degrees(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + degrees_f59715(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + degrees_f59715(); + return; +} + +kernel void compute_main() { + degrees_f59715(); + return; +} + diff --git a/test/tint/builtins/gen/var/degrees/f59715.wgsl.expected.spvasm b/test/tint/builtins/gen/var/degrees/f59715.wgsl.expected.spvasm new file mode 100644 index 0000000000..dfdcb2435f --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/f59715.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %degrees_f59715 "degrees_f59715" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%degrees_f59715 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Degrees %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %degrees_f59715 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %degrees_f59715 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %degrees_f59715 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/degrees/f59715.wgsl.expected.wgsl b/test/tint/builtins/gen/var/degrees/f59715.wgsl.expected.wgsl new file mode 100644 index 0000000000..b3a6abf730 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/f59715.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn degrees_f59715() { + var arg_0 = vec2(f16()); + var res : vec2 = degrees(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_f59715(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_f59715(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_f59715(); +} diff --git a/test/tint/builtins/gen/var/determinant/32bfde.wgsl b/test/tint/builtins/gen/var/determinant/32bfde.wgsl new file mode 100644 index 0000000000..fd0a38e315 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/32bfde.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn determinant(mat<4, 4, f16>) -> f16 +fn determinant_32bfde() { + var arg_0 = mat4x4(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16()); + var res: f16 = determinant(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + determinant_32bfde(); + return vec4(); +} + +@fragment +fn fragment_main() { + determinant_32bfde(); +} + +@compute @workgroup_size(1) +fn compute_main() { + determinant_32bfde(); +} diff --git a/test/tint/builtins/gen/var/determinant/32bfde.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/determinant/32bfde.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..21bb924a04 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/32bfde.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void determinant_32bfde() { + matrix arg_0 = matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); + float16_t res = determinant(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + determinant_32bfde(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + determinant_32bfde(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + determinant_32bfde(); + return; +} diff --git a/test/tint/builtins/gen/var/determinant/32bfde.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/determinant/32bfde.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3db7954463 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/32bfde.wgsl.expected.fxc.hlsl @@ -0,0 +1,38 @@ +SKIP: FAILED + +void determinant_32bfde() { + matrix arg_0 = matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); + float16_t res = determinant(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + determinant_32bfde(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + determinant_32bfde(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + determinant_32bfde(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022F54326C80(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022F54326C80(3,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022F54326C80(3,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/var/determinant/32bfde.wgsl.expected.glsl b/test/tint/builtins/gen/var/determinant/32bfde.wgsl.expected.glsl new file mode 100644 index 0000000000..2edc4dbcb3 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/32bfde.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void determinant_32bfde() { + f16mat4 arg_0 = f16mat4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf)); + float16_t res = determinant(arg_0); +} + +vec4 vertex_main() { + determinant_32bfde(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void determinant_32bfde() { + f16mat4 arg_0 = f16mat4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf)); + float16_t res = determinant(arg_0); +} + +void fragment_main() { + determinant_32bfde(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void determinant_32bfde() { + f16mat4 arg_0 = f16mat4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf)); + float16_t res = determinant(arg_0); +} + +void compute_main() { + determinant_32bfde(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/determinant/32bfde.wgsl.expected.msl b/test/tint/builtins/gen/var/determinant/32bfde.wgsl.expected.msl new file mode 100644 index 0000000000..2398440469 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/32bfde.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void determinant_32bfde() { + half4x4 arg_0 = half4x4(half4(0.0h), half4(0.0h), half4(0.0h), half4(0.0h)); + half res = determinant(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + determinant_32bfde(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + determinant_32bfde(); + return; +} + +kernel void compute_main() { + determinant_32bfde(); + return; +} + diff --git a/test/tint/builtins/gen/var/determinant/32bfde.wgsl.expected.spvasm b/test/tint/builtins/gen/var/determinant/32bfde.wgsl.expected.spvasm new file mode 100644 index 0000000000..3af3168271 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/32bfde.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %determinant_32bfde "determinant_32bfde" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat4v4half = OpTypeMatrix %v4half 4 + %16 = OpConstantNull %mat4v4half +%_ptr_Function_mat4v4half = OpTypePointer Function %mat4v4half +%_ptr_Function_half = OpTypePointer Function %half + %24 = OpConstantNull %half + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%determinant_32bfde = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat4v4half Function %16 + %res = OpVariable %_ptr_Function_half Function %24 + OpStore %arg_0 %16 + %21 = OpLoad %mat4v4half %arg_0 + %19 = OpExtInst %half %20 Determinant %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %determinant_32bfde + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %determinant_32bfde + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %determinant_32bfde + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/determinant/32bfde.wgsl.expected.wgsl b/test/tint/builtins/gen/var/determinant/32bfde.wgsl.expected.wgsl new file mode 100644 index 0000000000..c0fcade5c0 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/32bfde.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn determinant_32bfde() { + var arg_0 = mat4x4(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16()); + var res : f16 = determinant(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + determinant_32bfde(); + return vec4(); +} + +@fragment +fn fragment_main() { + determinant_32bfde(); +} + +@compute @workgroup_size(1) +fn compute_main() { + determinant_32bfde(); +} diff --git a/test/tint/builtins/gen/var/determinant/d7c86f.wgsl b/test/tint/builtins/gen/var/determinant/d7c86f.wgsl new file mode 100644 index 0000000000..b071018e54 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/d7c86f.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn determinant(mat<3, 3, f16>) -> f16 +fn determinant_d7c86f() { + var arg_0 = mat3x3(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16()); + var res: f16 = determinant(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + determinant_d7c86f(); + return vec4(); +} + +@fragment +fn fragment_main() { + determinant_d7c86f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + determinant_d7c86f(); +} diff --git a/test/tint/builtins/gen/var/determinant/d7c86f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/determinant/d7c86f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..899cb344ae --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/d7c86f.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void determinant_d7c86f() { + matrix arg_0 = matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); + float16_t res = determinant(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + determinant_d7c86f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + determinant_d7c86f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + determinant_d7c86f(); + return; +} diff --git a/test/tint/builtins/gen/var/determinant/d7c86f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/determinant/d7c86f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d769802e1a --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/d7c86f.wgsl.expected.fxc.hlsl @@ -0,0 +1,38 @@ +SKIP: FAILED + +void determinant_d7c86f() { + matrix arg_0 = matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); + float16_t res = determinant(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + determinant_d7c86f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + determinant_d7c86f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + determinant_d7c86f(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C5F7AE5180(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C5F7AE5180(3,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C5F7AE5180(3,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/var/determinant/d7c86f.wgsl.expected.glsl b/test/tint/builtins/gen/var/determinant/d7c86f.wgsl.expected.glsl new file mode 100644 index 0000000000..9718310c09 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/d7c86f.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void determinant_d7c86f() { + f16mat3 arg_0 = f16mat3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf)); + float16_t res = determinant(arg_0); +} + +vec4 vertex_main() { + determinant_d7c86f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void determinant_d7c86f() { + f16mat3 arg_0 = f16mat3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf)); + float16_t res = determinant(arg_0); +} + +void fragment_main() { + determinant_d7c86f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void determinant_d7c86f() { + f16mat3 arg_0 = f16mat3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf)); + float16_t res = determinant(arg_0); +} + +void compute_main() { + determinant_d7c86f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/determinant/d7c86f.wgsl.expected.msl b/test/tint/builtins/gen/var/determinant/d7c86f.wgsl.expected.msl new file mode 100644 index 0000000000..a3b282f07a --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/d7c86f.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void determinant_d7c86f() { + half3x3 arg_0 = half3x3(half3(0.0h), half3(0.0h), half3(0.0h)); + half res = determinant(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + determinant_d7c86f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + determinant_d7c86f(); + return; +} + +kernel void compute_main() { + determinant_d7c86f(); + return; +} + diff --git a/test/tint/builtins/gen/var/determinant/d7c86f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/determinant/d7c86f.wgsl.expected.spvasm new file mode 100644 index 0000000000..0540412c56 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/d7c86f.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %determinant_d7c86f "determinant_d7c86f" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat3v3half = OpTypeMatrix %v3half 3 + %16 = OpConstantNull %mat3v3half +%_ptr_Function_mat3v3half = OpTypePointer Function %mat3v3half +%_ptr_Function_half = OpTypePointer Function %half + %24 = OpConstantNull %half + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%determinant_d7c86f = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat3v3half Function %16 + %res = OpVariable %_ptr_Function_half Function %24 + OpStore %arg_0 %16 + %21 = OpLoad %mat3v3half %arg_0 + %19 = OpExtInst %half %20 Determinant %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %determinant_d7c86f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %determinant_d7c86f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %determinant_d7c86f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/determinant/d7c86f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/determinant/d7c86f.wgsl.expected.wgsl new file mode 100644 index 0000000000..aae4d08d2c --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/d7c86f.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn determinant_d7c86f() { + var arg_0 = mat3x3(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16()); + var res : f16 = determinant(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + determinant_d7c86f(); + return vec4(); +} + +@fragment +fn fragment_main() { + determinant_d7c86f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + determinant_d7c86f(); +} diff --git a/test/tint/builtins/gen/var/determinant/fc12a5.wgsl b/test/tint/builtins/gen/var/determinant/fc12a5.wgsl new file mode 100644 index 0000000000..bcb0f6e481 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/fc12a5.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn determinant(mat<2, 2, f16>) -> f16 +fn determinant_fc12a5() { + var arg_0 = mat2x2(f16(), f16(), f16(), f16()); + var res: f16 = determinant(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + determinant_fc12a5(); + return vec4(); +} + +@fragment +fn fragment_main() { + determinant_fc12a5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + determinant_fc12a5(); +} diff --git a/test/tint/builtins/gen/var/determinant/fc12a5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/determinant/fc12a5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..46328d560a --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/fc12a5.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void determinant_fc12a5() { + matrix arg_0 = matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx); + float16_t res = determinant(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + determinant_fc12a5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + determinant_fc12a5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + determinant_fc12a5(); + return; +} diff --git a/test/tint/builtins/gen/var/determinant/fc12a5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/determinant/fc12a5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a06af79785 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/fc12a5.wgsl.expected.fxc.hlsl @@ -0,0 +1,38 @@ +SKIP: FAILED + +void determinant_fc12a5() { + matrix arg_0 = matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx); + float16_t res = determinant(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + determinant_fc12a5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + determinant_fc12a5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + determinant_fc12a5(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022674B2E9D0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022674B2E9D0(3,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022674B2E9D0(3,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/var/determinant/fc12a5.wgsl.expected.glsl b/test/tint/builtins/gen/var/determinant/fc12a5.wgsl.expected.glsl new file mode 100644 index 0000000000..a8dbfa6a0f --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/fc12a5.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void determinant_fc12a5() { + f16mat2 arg_0 = f16mat2(f16vec2(0.0hf), f16vec2(0.0hf)); + float16_t res = determinant(arg_0); +} + +vec4 vertex_main() { + determinant_fc12a5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void determinant_fc12a5() { + f16mat2 arg_0 = f16mat2(f16vec2(0.0hf), f16vec2(0.0hf)); + float16_t res = determinant(arg_0); +} + +void fragment_main() { + determinant_fc12a5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void determinant_fc12a5() { + f16mat2 arg_0 = f16mat2(f16vec2(0.0hf), f16vec2(0.0hf)); + float16_t res = determinant(arg_0); +} + +void compute_main() { + determinant_fc12a5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/determinant/fc12a5.wgsl.expected.msl b/test/tint/builtins/gen/var/determinant/fc12a5.wgsl.expected.msl new file mode 100644 index 0000000000..2e6b14e149 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/fc12a5.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void determinant_fc12a5() { + half2x2 arg_0 = half2x2(half2(0.0h), half2(0.0h)); + half res = determinant(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + determinant_fc12a5(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + determinant_fc12a5(); + return; +} + +kernel void compute_main() { + determinant_fc12a5(); + return; +} + diff --git a/test/tint/builtins/gen/var/determinant/fc12a5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/determinant/fc12a5.wgsl.expected.spvasm new file mode 100644 index 0000000000..1141730e28 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/fc12a5.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %determinant_fc12a5 "determinant_fc12a5" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat2v2half = OpTypeMatrix %v2half 2 + %16 = OpConstantNull %mat2v2half +%_ptr_Function_mat2v2half = OpTypePointer Function %mat2v2half +%_ptr_Function_half = OpTypePointer Function %half + %24 = OpConstantNull %half + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%determinant_fc12a5 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat2v2half Function %16 + %res = OpVariable %_ptr_Function_half Function %24 + OpStore %arg_0 %16 + %21 = OpLoad %mat2v2half %arg_0 + %19 = OpExtInst %half %20 Determinant %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %determinant_fc12a5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %determinant_fc12a5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %determinant_fc12a5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/determinant/fc12a5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/determinant/fc12a5.wgsl.expected.wgsl new file mode 100644 index 0000000000..225d3cfd93 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/fc12a5.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn determinant_fc12a5() { + var arg_0 = mat2x2(f16(), f16(), f16(), f16()); + var res : f16 = determinant(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + determinant_fc12a5(); + return vec4(); +} + +@fragment +fn fragment_main() { + determinant_fc12a5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + determinant_fc12a5(); +} diff --git a/test/tint/builtins/gen/var/distance/7272f3.wgsl b/test/tint/builtins/gen/var/distance/7272f3.wgsl new file mode 100644 index 0000000000..f8aad30c93 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/7272f3.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn distance(vec<4, f16>, vec<4, f16>) -> f16 +fn distance_7272f3() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var res: f16 = distance(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_7272f3(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_7272f3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_7272f3(); +} diff --git a/test/tint/builtins/gen/var/distance/7272f3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/distance/7272f3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1b62fdc621 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/7272f3.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void distance_7272f3() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + float16_t res = distance(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_7272f3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_7272f3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_7272f3(); + return; +} diff --git a/test/tint/builtins/gen/var/distance/7272f3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/distance/7272f3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..019f6afc3a --- /dev/null +++ b/test/tint/builtins/gen/var/distance/7272f3.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +void distance_7272f3() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + float16_t res = distance(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_7272f3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_7272f3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_7272f3(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001EADAF82D50(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001EADAF82D50(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001EADAF82D50(4,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001EADAF82D50(4,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/var/distance/7272f3.wgsl.expected.glsl b/test/tint/builtins/gen/var/distance/7272f3.wgsl.expected.glsl new file mode 100644 index 0000000000..16eba83445 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/7272f3.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void distance_7272f3() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + float16_t res = distance(arg_0, arg_1); +} + +vec4 vertex_main() { + distance_7272f3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void distance_7272f3() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + float16_t res = distance(arg_0, arg_1); +} + +void fragment_main() { + distance_7272f3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void distance_7272f3() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + float16_t res = distance(arg_0, arg_1); +} + +void compute_main() { + distance_7272f3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/distance/7272f3.wgsl.expected.msl b/test/tint/builtins/gen/var/distance/7272f3.wgsl.expected.msl new file mode 100644 index 0000000000..24a1476c81 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/7272f3.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void distance_7272f3() { + half4 arg_0 = half4(0.0h); + half4 arg_1 = half4(0.0h); + half res = distance(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + distance_7272f3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + distance_7272f3(); + return; +} + +kernel void compute_main() { + distance_7272f3(); + return; +} + diff --git a/test/tint/builtins/gen/var/distance/7272f3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/distance/7272f3.wgsl.expected.spvasm new file mode 100644 index 0000000000..967f8eab46 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/7272f3.wgsl.expected.spvasm @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %distance_7272f3 "distance_7272f3" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half +%_ptr_Function_half = OpTypePointer Function %half + %25 = OpConstantNull %half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%distance_7272f3 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %arg_1 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_half Function %25 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v4half %arg_0 + %22 = OpLoad %v4half %arg_1 + %19 = OpExtInst %half %20 Distance %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %distance_7272f3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %distance_7272f3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %distance_7272f3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/distance/7272f3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/distance/7272f3.wgsl.expected.wgsl new file mode 100644 index 0000000000..3689ad7631 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/7272f3.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn distance_7272f3() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var res : f16 = distance(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_7272f3(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_7272f3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_7272f3(); +} diff --git a/test/tint/builtins/gen/var/distance/7d201f.wgsl b/test/tint/builtins/gen/var/distance/7d201f.wgsl new file mode 100644 index 0000000000..a66064c8b5 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/7d201f.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn distance(f16, f16) -> f16 +fn distance_7d201f() { + var arg_0 = f16(); + var arg_1 = f16(); + var res: f16 = distance(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_7d201f(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_7d201f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_7d201f(); +} diff --git a/test/tint/builtins/gen/var/distance/7d201f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/distance/7d201f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e83ccf12fe --- /dev/null +++ b/test/tint/builtins/gen/var/distance/7d201f.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void distance_7d201f() { + float16_t arg_0 = float16_t(0.0h); + float16_t arg_1 = float16_t(0.0h); + float16_t res = distance(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_7d201f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_7d201f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_7d201f(); + return; +} diff --git a/test/tint/builtins/gen/var/distance/7d201f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/distance/7d201f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..42c0407676 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/7d201f.wgsl.expected.fxc.hlsl @@ -0,0 +1,38 @@ +SKIP: FAILED + +void distance_7d201f() { + float16_t arg_0 = float16_t(0.0h); + float16_t arg_1 = float16_t(0.0h); + float16_t res = distance(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_7d201f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_7d201f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_7d201f(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020A788F9640(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020A788F9640(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/distance/7d201f.wgsl.expected.glsl b/test/tint/builtins/gen/var/distance/7d201f.wgsl.expected.glsl new file mode 100644 index 0000000000..0ed25e6a06 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/7d201f.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void distance_7d201f() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t res = distance(arg_0, arg_1); +} + +vec4 vertex_main() { + distance_7d201f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void distance_7d201f() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t res = distance(arg_0, arg_1); +} + +void fragment_main() { + distance_7d201f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void distance_7d201f() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t res = distance(arg_0, arg_1); +} + +void compute_main() { + distance_7d201f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/distance/7d201f.wgsl.expected.msl b/test/tint/builtins/gen/var/distance/7d201f.wgsl.expected.msl new file mode 100644 index 0000000000..780d62ec89 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/7d201f.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void distance_7d201f() { + half arg_0 = 0.0h; + half arg_1 = 0.0h; + half res = fabs(arg_0 - arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + distance_7d201f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + distance_7d201f(); + return; +} + +kernel void compute_main() { + distance_7d201f(); + return; +} + diff --git a/test/tint/builtins/gen/var/distance/7d201f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/distance/7d201f.wgsl.expected.spvasm new file mode 100644 index 0000000000..b39b43cfbb --- /dev/null +++ b/test/tint/builtins/gen/var/distance/7d201f.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %distance_7d201f "distance_7d201f" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%distance_7d201f = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %arg_1 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + %20 = OpLoad %half %arg_0 + %21 = OpLoad %half %arg_1 + %18 = OpExtInst %half %19 Distance %20 %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %distance_7d201f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %distance_7d201f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %distance_7d201f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/distance/7d201f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/distance/7d201f.wgsl.expected.wgsl new file mode 100644 index 0000000000..4480b58193 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/7d201f.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn distance_7d201f() { + var arg_0 = f16(); + var arg_1 = f16(); + var res : f16 = distance(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_7d201f(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_7d201f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_7d201f(); +} diff --git a/test/tint/builtins/gen/var/distance/892a5d.wgsl b/test/tint/builtins/gen/var/distance/892a5d.wgsl new file mode 100644 index 0000000000..2a5c2080ce --- /dev/null +++ b/test/tint/builtins/gen/var/distance/892a5d.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn distance(vec<2, f16>, vec<2, f16>) -> f16 +fn distance_892a5d() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var res: f16 = distance(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_892a5d(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_892a5d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_892a5d(); +} diff --git a/test/tint/builtins/gen/var/distance/892a5d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/distance/892a5d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..034e57e09b --- /dev/null +++ b/test/tint/builtins/gen/var/distance/892a5d.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void distance_892a5d() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + float16_t res = distance(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_892a5d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_892a5d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_892a5d(); + return; +} diff --git a/test/tint/builtins/gen/var/distance/892a5d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/distance/892a5d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e6d94bf908 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/892a5d.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +void distance_892a5d() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + float16_t res = distance(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_892a5d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_892a5d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_892a5d(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001FA47782B40(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001FA47782B40(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001FA47782B40(4,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001FA47782B40(4,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/var/distance/892a5d.wgsl.expected.glsl b/test/tint/builtins/gen/var/distance/892a5d.wgsl.expected.glsl new file mode 100644 index 0000000000..a615b6f8e3 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/892a5d.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void distance_892a5d() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + float16_t res = distance(arg_0, arg_1); +} + +vec4 vertex_main() { + distance_892a5d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void distance_892a5d() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + float16_t res = distance(arg_0, arg_1); +} + +void fragment_main() { + distance_892a5d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void distance_892a5d() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + float16_t res = distance(arg_0, arg_1); +} + +void compute_main() { + distance_892a5d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/distance/892a5d.wgsl.expected.msl b/test/tint/builtins/gen/var/distance/892a5d.wgsl.expected.msl new file mode 100644 index 0000000000..8fe755ddb3 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/892a5d.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void distance_892a5d() { + half2 arg_0 = half2(0.0h); + half2 arg_1 = half2(0.0h); + half res = distance(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + distance_892a5d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + distance_892a5d(); + return; +} + +kernel void compute_main() { + distance_892a5d(); + return; +} + diff --git a/test/tint/builtins/gen/var/distance/892a5d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/distance/892a5d.wgsl.expected.spvasm new file mode 100644 index 0000000000..59a5d06ed9 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/892a5d.wgsl.expected.spvasm @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %distance_892a5d "distance_892a5d" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half +%_ptr_Function_half = OpTypePointer Function %half + %25 = OpConstantNull %half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%distance_892a5d = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %arg_1 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_half Function %25 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v2half %arg_0 + %22 = OpLoad %v2half %arg_1 + %19 = OpExtInst %half %20 Distance %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %distance_892a5d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %distance_892a5d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %distance_892a5d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/distance/892a5d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/distance/892a5d.wgsl.expected.wgsl new file mode 100644 index 0000000000..279adafbd4 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/892a5d.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn distance_892a5d() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var res : f16 = distance(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_892a5d(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_892a5d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_892a5d(); +} diff --git a/test/tint/builtins/gen/var/distance/928fa0.wgsl b/test/tint/builtins/gen/var/distance/928fa0.wgsl new file mode 100644 index 0000000000..83a533b887 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/928fa0.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn distance(vec<3, f16>, vec<3, f16>) -> f16 +fn distance_928fa0() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var res: f16 = distance(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_928fa0(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_928fa0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_928fa0(); +} diff --git a/test/tint/builtins/gen/var/distance/928fa0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/distance/928fa0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..097d7b8edd --- /dev/null +++ b/test/tint/builtins/gen/var/distance/928fa0.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void distance_928fa0() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + float16_t res = distance(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_928fa0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_928fa0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_928fa0(); + return; +} diff --git a/test/tint/builtins/gen/var/distance/928fa0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/distance/928fa0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..354f95e3a7 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/928fa0.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +void distance_928fa0() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + float16_t res = distance(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_928fa0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_928fa0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_928fa0(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000277E5AD2CF0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000277E5AD2CF0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000277E5AD2CF0(4,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000277E5AD2CF0(4,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/var/distance/928fa0.wgsl.expected.glsl b/test/tint/builtins/gen/var/distance/928fa0.wgsl.expected.glsl new file mode 100644 index 0000000000..77dd598b10 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/928fa0.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void distance_928fa0() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + float16_t res = distance(arg_0, arg_1); +} + +vec4 vertex_main() { + distance_928fa0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void distance_928fa0() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + float16_t res = distance(arg_0, arg_1); +} + +void fragment_main() { + distance_928fa0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void distance_928fa0() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + float16_t res = distance(arg_0, arg_1); +} + +void compute_main() { + distance_928fa0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/distance/928fa0.wgsl.expected.msl b/test/tint/builtins/gen/var/distance/928fa0.wgsl.expected.msl new file mode 100644 index 0000000000..b2a96ab114 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/928fa0.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void distance_928fa0() { + half3 arg_0 = half3(0.0h); + half3 arg_1 = half3(0.0h); + half res = distance(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + distance_928fa0(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + distance_928fa0(); + return; +} + +kernel void compute_main() { + distance_928fa0(); + return; +} + diff --git a/test/tint/builtins/gen/var/distance/928fa0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/distance/928fa0.wgsl.expected.spvasm new file mode 100644 index 0000000000..96965393a9 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/928fa0.wgsl.expected.spvasm @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %distance_928fa0 "distance_928fa0" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half +%_ptr_Function_half = OpTypePointer Function %half + %25 = OpConstantNull %half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%distance_928fa0 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %arg_1 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_half Function %25 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v3half %arg_0 + %22 = OpLoad %v3half %arg_1 + %19 = OpExtInst %half %20 Distance %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %distance_928fa0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %distance_928fa0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %distance_928fa0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/distance/928fa0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/distance/928fa0.wgsl.expected.wgsl new file mode 100644 index 0000000000..840d9e5cf0 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/928fa0.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn distance_928fa0() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var res : f16 = distance(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_928fa0(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_928fa0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_928fa0(); +} diff --git a/test/tint/builtins/gen/var/dot/8e40f1.wgsl b/test/tint/builtins/gen/var/dot/8e40f1.wgsl new file mode 100644 index 0000000000..eceecd1056 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/8e40f1.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn dot(vec<3, f16>, vec<3, f16>) -> f16 +fn dot_8e40f1() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var res: f16 = dot(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_8e40f1(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_8e40f1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_8e40f1(); +} diff --git a/test/tint/builtins/gen/var/dot/8e40f1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/dot/8e40f1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ad11be220a --- /dev/null +++ b/test/tint/builtins/gen/var/dot/8e40f1.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void dot_8e40f1() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + float16_t res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_8e40f1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_8e40f1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_8e40f1(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/8e40f1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/dot/8e40f1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ad26057ae0 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/8e40f1.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +void dot_8e40f1() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + float16_t res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_8e40f1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_8e40f1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_8e40f1(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018A9A333310(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018A9A333310(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018A9A333310(4,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018A9A333310(4,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/var/dot/8e40f1.wgsl.expected.glsl b/test/tint/builtins/gen/var/dot/8e40f1.wgsl.expected.glsl new file mode 100644 index 0000000000..18066bf0c5 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/8e40f1.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void dot_8e40f1() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + float16_t res = dot(arg_0, arg_1); +} + +vec4 vertex_main() { + dot_8e40f1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void dot_8e40f1() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + float16_t res = dot(arg_0, arg_1); +} + +void fragment_main() { + dot_8e40f1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void dot_8e40f1() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + float16_t res = dot(arg_0, arg_1); +} + +void compute_main() { + dot_8e40f1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/8e40f1.wgsl.expected.msl b/test/tint/builtins/gen/var/dot/8e40f1.wgsl.expected.msl new file mode 100644 index 0000000000..eacb81c04d --- /dev/null +++ b/test/tint/builtins/gen/var/dot/8e40f1.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void dot_8e40f1() { + half3 arg_0 = half3(0.0h); + half3 arg_1 = half3(0.0h); + half res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + dot_8e40f1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + dot_8e40f1(); + return; +} + +kernel void compute_main() { + dot_8e40f1(); + return; +} + diff --git a/test/tint/builtins/gen/var/dot/8e40f1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dot/8e40f1.wgsl.expected.spvasm new file mode 100644 index 0000000000..6bed79d843 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/8e40f1.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %dot_8e40f1 "dot_8e40f1" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half +%_ptr_Function_half = OpTypePointer Function %half + %24 = OpConstantNull %half + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %dot_8e40f1 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %arg_1 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_half Function %24 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %20 = OpLoad %v3half %arg_0 + %21 = OpLoad %v3half %arg_1 + %19 = OpDot %half %20 %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %dot_8e40f1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %dot_8e40f1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %dot_8e40f1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dot/8e40f1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dot/8e40f1.wgsl.expected.wgsl new file mode 100644 index 0000000000..db92b086bc --- /dev/null +++ b/test/tint/builtins/gen/var/dot/8e40f1.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn dot_8e40f1() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var res : f16 = dot(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_8e40f1(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_8e40f1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_8e40f1(); +} diff --git a/test/tint/builtins/gen/var/dot/cd5a04.wgsl b/test/tint/builtins/gen/var/dot/cd5a04.wgsl new file mode 100644 index 0000000000..9226d5cffb --- /dev/null +++ b/test/tint/builtins/gen/var/dot/cd5a04.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn dot(vec<2, f16>, vec<2, f16>) -> f16 +fn dot_cd5a04() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var res: f16 = dot(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_cd5a04(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_cd5a04(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_cd5a04(); +} diff --git a/test/tint/builtins/gen/var/dot/cd5a04.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/dot/cd5a04.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..27c17be74c --- /dev/null +++ b/test/tint/builtins/gen/var/dot/cd5a04.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void dot_cd5a04() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + float16_t res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_cd5a04(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_cd5a04(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_cd5a04(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/cd5a04.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/dot/cd5a04.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2a3cca805f --- /dev/null +++ b/test/tint/builtins/gen/var/dot/cd5a04.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +void dot_cd5a04() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + float16_t res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_cd5a04(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_cd5a04(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_cd5a04(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020151407920(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020151407920(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020151407920(4,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020151407920(4,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/var/dot/cd5a04.wgsl.expected.glsl b/test/tint/builtins/gen/var/dot/cd5a04.wgsl.expected.glsl new file mode 100644 index 0000000000..03060cef0e --- /dev/null +++ b/test/tint/builtins/gen/var/dot/cd5a04.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void dot_cd5a04() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + float16_t res = dot(arg_0, arg_1); +} + +vec4 vertex_main() { + dot_cd5a04(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void dot_cd5a04() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + float16_t res = dot(arg_0, arg_1); +} + +void fragment_main() { + dot_cd5a04(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void dot_cd5a04() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + float16_t res = dot(arg_0, arg_1); +} + +void compute_main() { + dot_cd5a04(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/cd5a04.wgsl.expected.msl b/test/tint/builtins/gen/var/dot/cd5a04.wgsl.expected.msl new file mode 100644 index 0000000000..b70c4db63d --- /dev/null +++ b/test/tint/builtins/gen/var/dot/cd5a04.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void dot_cd5a04() { + half2 arg_0 = half2(0.0h); + half2 arg_1 = half2(0.0h); + half res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + dot_cd5a04(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + dot_cd5a04(); + return; +} + +kernel void compute_main() { + dot_cd5a04(); + return; +} + diff --git a/test/tint/builtins/gen/var/dot/cd5a04.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dot/cd5a04.wgsl.expected.spvasm new file mode 100644 index 0000000000..9cef5f77fa --- /dev/null +++ b/test/tint/builtins/gen/var/dot/cd5a04.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %dot_cd5a04 "dot_cd5a04" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half +%_ptr_Function_half = OpTypePointer Function %half + %24 = OpConstantNull %half + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %dot_cd5a04 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %arg_1 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_half Function %24 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %20 = OpLoad %v2half %arg_0 + %21 = OpLoad %v2half %arg_1 + %19 = OpDot %half %20 %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %dot_cd5a04 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %dot_cd5a04 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %dot_cd5a04 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dot/cd5a04.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dot/cd5a04.wgsl.expected.wgsl new file mode 100644 index 0000000000..8fc1a17fc2 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/cd5a04.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn dot_cd5a04() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var res : f16 = dot(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_cd5a04(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_cd5a04(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_cd5a04(); +} diff --git a/test/tint/builtins/gen/var/dot/d0d179.wgsl b/test/tint/builtins/gen/var/dot/d0d179.wgsl new file mode 100644 index 0000000000..972ce4323e --- /dev/null +++ b/test/tint/builtins/gen/var/dot/d0d179.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn dot(vec<4, f16>, vec<4, f16>) -> f16 +fn dot_d0d179() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var res: f16 = dot(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_d0d179(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_d0d179(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_d0d179(); +} diff --git a/test/tint/builtins/gen/var/dot/d0d179.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/dot/d0d179.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e6a5b4c7a7 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/d0d179.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void dot_d0d179() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + float16_t res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_d0d179(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_d0d179(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_d0d179(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/d0d179.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/dot/d0d179.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..67a0bee40b --- /dev/null +++ b/test/tint/builtins/gen/var/dot/d0d179.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +void dot_d0d179() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + float16_t res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_d0d179(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_d0d179(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_d0d179(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000019F987BD460(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000019F987BD460(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000019F987BD460(4,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000019F987BD460(4,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/var/dot/d0d179.wgsl.expected.glsl b/test/tint/builtins/gen/var/dot/d0d179.wgsl.expected.glsl new file mode 100644 index 0000000000..fd6939cedb --- /dev/null +++ b/test/tint/builtins/gen/var/dot/d0d179.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void dot_d0d179() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + float16_t res = dot(arg_0, arg_1); +} + +vec4 vertex_main() { + dot_d0d179(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void dot_d0d179() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + float16_t res = dot(arg_0, arg_1); +} + +void fragment_main() { + dot_d0d179(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void dot_d0d179() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + float16_t res = dot(arg_0, arg_1); +} + +void compute_main() { + dot_d0d179(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/d0d179.wgsl.expected.msl b/test/tint/builtins/gen/var/dot/d0d179.wgsl.expected.msl new file mode 100644 index 0000000000..4a83867129 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/d0d179.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void dot_d0d179() { + half4 arg_0 = half4(0.0h); + half4 arg_1 = half4(0.0h); + half res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + dot_d0d179(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + dot_d0d179(); + return; +} + +kernel void compute_main() { + dot_d0d179(); + return; +} + diff --git a/test/tint/builtins/gen/var/dot/d0d179.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dot/d0d179.wgsl.expected.spvasm new file mode 100644 index 0000000000..5bca82850a --- /dev/null +++ b/test/tint/builtins/gen/var/dot/d0d179.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %dot_d0d179 "dot_d0d179" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half +%_ptr_Function_half = OpTypePointer Function %half + %24 = OpConstantNull %half + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %dot_d0d179 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %arg_1 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_half Function %24 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %20 = OpLoad %v4half %arg_0 + %21 = OpLoad %v4half %arg_1 + %19 = OpDot %half %20 %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %dot_d0d179 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %dot_d0d179 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %dot_d0d179 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dot/d0d179.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dot/d0d179.wgsl.expected.wgsl new file mode 100644 index 0000000000..3297912d2d --- /dev/null +++ b/test/tint/builtins/gen/var/dot/d0d179.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn dot_d0d179() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var res : f16 = dot(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_d0d179(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_d0d179(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_d0d179(); +} diff --git a/test/tint/builtins/gen/var/dot4I8Packed/881e62.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/dot4I8Packed/881e62.wgsl.expected.fxc.hlsl index b5bc6986db..733f9e5858 100644 --- a/test/tint/builtins/gen/var/dot4I8Packed/881e62.wgsl.expected.fxc.hlsl +++ b/test/tint/builtins/gen/var/dot4I8Packed/881e62.wgsl.expected.fxc.hlsl @@ -37,3 +37,6 @@ void compute_main() { dot4I8Packed_881e62(); return; } +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001A416C12830(3,10-56): error X3004: undeclared identifier 'dot4add_i8packed' + diff --git a/test/tint/builtins/gen/var/dot4U8Packed/fbed7b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/dot4U8Packed/fbed7b.wgsl.expected.fxc.hlsl index fb71ba6b4b..fef2404566 100644 --- a/test/tint/builtins/gen/var/dot4U8Packed/fbed7b.wgsl.expected.fxc.hlsl +++ b/test/tint/builtins/gen/var/dot4U8Packed/fbed7b.wgsl.expected.fxc.hlsl @@ -37,3 +37,6 @@ void compute_main() { dot4U8Packed_fbed7b(); return; } +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000191724B1570(3,10-56): error X3004: undeclared identifier 'dot4add_u8packed' + diff --git a/test/tint/builtins/gen/var/exp/13806d.wgsl b/test/tint/builtins/gen/var/exp/13806d.wgsl new file mode 100644 index 0000000000..6c3ccde44c --- /dev/null +++ b/test/tint/builtins/gen/var/exp/13806d.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn exp(vec<3, f16>) -> vec<3, f16> +fn exp_13806d() { + var arg_0 = vec3(f16()); + var res: vec3 = exp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_13806d(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_13806d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_13806d(); +} diff --git a/test/tint/builtins/gen/var/exp/13806d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/exp/13806d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..eb7e5a8895 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/13806d.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void exp_13806d() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = exp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_13806d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_13806d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_13806d(); + return; +} diff --git a/test/tint/builtins/gen/var/exp/13806d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/exp/13806d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ebcc65f90c --- /dev/null +++ b/test/tint/builtins/gen/var/exp/13806d.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void exp_13806d() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = exp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_13806d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_13806d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_13806d(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002270EAE6F40(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002270EAE6F40(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/exp/13806d.wgsl.expected.glsl b/test/tint/builtins/gen/var/exp/13806d.wgsl.expected.glsl new file mode 100644 index 0000000000..72d5c8a5d6 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/13806d.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp_13806d() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = exp(arg_0); +} + +vec4 vertex_main() { + exp_13806d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void exp_13806d() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = exp(arg_0); +} + +void fragment_main() { + exp_13806d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp_13806d() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = exp(arg_0); +} + +void compute_main() { + exp_13806d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/exp/13806d.wgsl.expected.msl b/test/tint/builtins/gen/var/exp/13806d.wgsl.expected.msl new file mode 100644 index 0000000000..891a68a9d4 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/13806d.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void exp_13806d() { + half3 arg_0 = half3(0.0h); + half3 res = exp(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp_13806d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp_13806d(); + return; +} + +kernel void compute_main() { + exp_13806d(); + return; +} + diff --git a/test/tint/builtins/gen/var/exp/13806d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/exp/13806d.wgsl.expected.spvasm new file mode 100644 index 0000000000..90c05375c8 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/13806d.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp_13806d "exp_13806d" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %exp_13806d = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Exp %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %exp_13806d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %exp_13806d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %exp_13806d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/exp/13806d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/exp/13806d.wgsl.expected.wgsl new file mode 100644 index 0000000000..044b03aa4c --- /dev/null +++ b/test/tint/builtins/gen/var/exp/13806d.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn exp_13806d() { + var arg_0 = vec3(f16()); + var res : vec3 = exp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_13806d(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_13806d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_13806d(); +} diff --git a/test/tint/builtins/gen/var/exp/2e08e2.wgsl b/test/tint/builtins/gen/var/exp/2e08e2.wgsl new file mode 100644 index 0000000000..15f67b1b9c --- /dev/null +++ b/test/tint/builtins/gen/var/exp/2e08e2.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn exp(vec<2, f16>) -> vec<2, f16> +fn exp_2e08e2() { + var arg_0 = vec2(f16()); + var res: vec2 = exp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_2e08e2(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_2e08e2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_2e08e2(); +} diff --git a/test/tint/builtins/gen/var/exp/2e08e2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/exp/2e08e2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e9d14139a7 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/2e08e2.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void exp_2e08e2() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = exp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_2e08e2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_2e08e2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_2e08e2(); + return; +} diff --git a/test/tint/builtins/gen/var/exp/2e08e2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/exp/2e08e2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0f2359df39 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/2e08e2.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void exp_2e08e2() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = exp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_2e08e2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_2e08e2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_2e08e2(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000256E60D6F90(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000256E60D6F90(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/exp/2e08e2.wgsl.expected.glsl b/test/tint/builtins/gen/var/exp/2e08e2.wgsl.expected.glsl new file mode 100644 index 0000000000..f53e9a7ffc --- /dev/null +++ b/test/tint/builtins/gen/var/exp/2e08e2.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp_2e08e2() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = exp(arg_0); +} + +vec4 vertex_main() { + exp_2e08e2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void exp_2e08e2() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = exp(arg_0); +} + +void fragment_main() { + exp_2e08e2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp_2e08e2() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = exp(arg_0); +} + +void compute_main() { + exp_2e08e2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/exp/2e08e2.wgsl.expected.msl b/test/tint/builtins/gen/var/exp/2e08e2.wgsl.expected.msl new file mode 100644 index 0000000000..cc293279fa --- /dev/null +++ b/test/tint/builtins/gen/var/exp/2e08e2.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void exp_2e08e2() { + half2 arg_0 = half2(0.0h); + half2 res = exp(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp_2e08e2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp_2e08e2(); + return; +} + +kernel void compute_main() { + exp_2e08e2(); + return; +} + diff --git a/test/tint/builtins/gen/var/exp/2e08e2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/exp/2e08e2.wgsl.expected.spvasm new file mode 100644 index 0000000000..6c662e04b1 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/2e08e2.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp_2e08e2 "exp_2e08e2" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %exp_2e08e2 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Exp %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %exp_2e08e2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %exp_2e08e2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %exp_2e08e2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/exp/2e08e2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/exp/2e08e2.wgsl.expected.wgsl new file mode 100644 index 0000000000..c041e1a63c --- /dev/null +++ b/test/tint/builtins/gen/var/exp/2e08e2.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn exp_2e08e2() { + var arg_0 = vec2(f16()); + var res : vec2 = exp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_2e08e2(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_2e08e2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_2e08e2(); +} diff --git a/test/tint/builtins/gen/var/exp/611a87.wgsl b/test/tint/builtins/gen/var/exp/611a87.wgsl new file mode 100644 index 0000000000..86e69d5924 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/611a87.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn exp(vec<4, f16>) -> vec<4, f16> +fn exp_611a87() { + var arg_0 = vec4(f16()); + var res: vec4 = exp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_611a87(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_611a87(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_611a87(); +} diff --git a/test/tint/builtins/gen/var/exp/611a87.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/exp/611a87.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7b99c789f3 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/611a87.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void exp_611a87() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = exp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_611a87(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_611a87(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_611a87(); + return; +} diff --git a/test/tint/builtins/gen/var/exp/611a87.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/exp/611a87.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..30ab783003 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/611a87.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void exp_611a87() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = exp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_611a87(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_611a87(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_611a87(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002855D95D650(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002855D95D650(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/exp/611a87.wgsl.expected.glsl b/test/tint/builtins/gen/var/exp/611a87.wgsl.expected.glsl new file mode 100644 index 0000000000..ed49b7cd38 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/611a87.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp_611a87() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = exp(arg_0); +} + +vec4 vertex_main() { + exp_611a87(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void exp_611a87() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = exp(arg_0); +} + +void fragment_main() { + exp_611a87(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp_611a87() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = exp(arg_0); +} + +void compute_main() { + exp_611a87(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/exp/611a87.wgsl.expected.msl b/test/tint/builtins/gen/var/exp/611a87.wgsl.expected.msl new file mode 100644 index 0000000000..dd3d353de5 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/611a87.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void exp_611a87() { + half4 arg_0 = half4(0.0h); + half4 res = exp(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp_611a87(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp_611a87(); + return; +} + +kernel void compute_main() { + exp_611a87(); + return; +} + diff --git a/test/tint/builtins/gen/var/exp/611a87.wgsl.expected.spvasm b/test/tint/builtins/gen/var/exp/611a87.wgsl.expected.spvasm new file mode 100644 index 0000000000..17d3daf799 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/611a87.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp_611a87 "exp_611a87" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %exp_611a87 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Exp %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %exp_611a87 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %exp_611a87 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %exp_611a87 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/exp/611a87.wgsl.expected.wgsl b/test/tint/builtins/gen/var/exp/611a87.wgsl.expected.wgsl new file mode 100644 index 0000000000..d208a93878 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/611a87.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn exp_611a87() { + var arg_0 = vec4(f16()); + var res : vec4 = exp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_611a87(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_611a87(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_611a87(); +} diff --git a/test/tint/builtins/gen/var/exp/c18fe9.wgsl b/test/tint/builtins/gen/var/exp/c18fe9.wgsl new file mode 100644 index 0000000000..e28c16ab4b --- /dev/null +++ b/test/tint/builtins/gen/var/exp/c18fe9.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn exp(f16) -> f16 +fn exp_c18fe9() { + var arg_0 = f16(); + var res: f16 = exp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_c18fe9(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_c18fe9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_c18fe9(); +} diff --git a/test/tint/builtins/gen/var/exp/c18fe9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/exp/c18fe9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c137c9c5c1 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/c18fe9.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void exp_c18fe9() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = exp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_c18fe9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_c18fe9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_c18fe9(); + return; +} diff --git a/test/tint/builtins/gen/var/exp/c18fe9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/exp/c18fe9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ad6ebcad4c --- /dev/null +++ b/test/tint/builtins/gen/var/exp/c18fe9.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void exp_c18fe9() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = exp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_c18fe9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_c18fe9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_c18fe9(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002AE86501340(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002AE86501340(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/exp/c18fe9.wgsl.expected.glsl b/test/tint/builtins/gen/var/exp/c18fe9.wgsl.expected.glsl new file mode 100644 index 0000000000..73b9ba13eb --- /dev/null +++ b/test/tint/builtins/gen/var/exp/c18fe9.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp_c18fe9() { + float16_t arg_0 = 0.0hf; + float16_t res = exp(arg_0); +} + +vec4 vertex_main() { + exp_c18fe9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void exp_c18fe9() { + float16_t arg_0 = 0.0hf; + float16_t res = exp(arg_0); +} + +void fragment_main() { + exp_c18fe9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp_c18fe9() { + float16_t arg_0 = 0.0hf; + float16_t res = exp(arg_0); +} + +void compute_main() { + exp_c18fe9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/exp/c18fe9.wgsl.expected.msl b/test/tint/builtins/gen/var/exp/c18fe9.wgsl.expected.msl new file mode 100644 index 0000000000..6bcb8c64e2 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/c18fe9.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void exp_c18fe9() { + half arg_0 = 0.0h; + half res = exp(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp_c18fe9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp_c18fe9(); + return; +} + +kernel void compute_main() { + exp_c18fe9(); + return; +} + diff --git a/test/tint/builtins/gen/var/exp/c18fe9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/exp/c18fe9.wgsl.expected.spvasm new file mode 100644 index 0000000000..8575fb843a --- /dev/null +++ b/test/tint/builtins/gen/var/exp/c18fe9.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp_c18fe9 "exp_c18fe9" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %exp_c18fe9 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Exp %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %exp_c18fe9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %exp_c18fe9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %exp_c18fe9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/exp/c18fe9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/exp/c18fe9.wgsl.expected.wgsl new file mode 100644 index 0000000000..3daf44c664 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/c18fe9.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn exp_c18fe9() { + var arg_0 = f16(); + var res : f16 = exp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_c18fe9(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_c18fe9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_c18fe9(); +} diff --git a/test/tint/builtins/gen/var/exp2/151a4c.wgsl b/test/tint/builtins/gen/var/exp2/151a4c.wgsl new file mode 100644 index 0000000000..5a42f5b46f --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/151a4c.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn exp2(vec<2, f16>) -> vec<2, f16> +fn exp2_151a4c() { + var arg_0 = vec2(f16()); + var res: vec2 = exp2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_151a4c(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_151a4c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_151a4c(); +} diff --git a/test/tint/builtins/gen/var/exp2/151a4c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/exp2/151a4c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d1633f9d7e --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/151a4c.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void exp2_151a4c() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = exp2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_151a4c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_151a4c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_151a4c(); + return; +} diff --git a/test/tint/builtins/gen/var/exp2/151a4c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/exp2/151a4c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..aaf1ee1fb1 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/151a4c.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void exp2_151a4c() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = exp2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_151a4c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_151a4c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_151a4c(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000027F32148910(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000027F32148910(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/exp2/151a4c.wgsl.expected.glsl b/test/tint/builtins/gen/var/exp2/151a4c.wgsl.expected.glsl new file mode 100644 index 0000000000..a3e4e9381f --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/151a4c.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp2_151a4c() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = exp2(arg_0); +} + +vec4 vertex_main() { + exp2_151a4c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void exp2_151a4c() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = exp2(arg_0); +} + +void fragment_main() { + exp2_151a4c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp2_151a4c() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = exp2(arg_0); +} + +void compute_main() { + exp2_151a4c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/exp2/151a4c.wgsl.expected.msl b/test/tint/builtins/gen/var/exp2/151a4c.wgsl.expected.msl new file mode 100644 index 0000000000..26b057cd5e --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/151a4c.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void exp2_151a4c() { + half2 arg_0 = half2(0.0h); + half2 res = exp2(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp2_151a4c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp2_151a4c(); + return; +} + +kernel void compute_main() { + exp2_151a4c(); + return; +} + diff --git a/test/tint/builtins/gen/var/exp2/151a4c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/exp2/151a4c.wgsl.expected.spvasm new file mode 100644 index 0000000000..7db1e64e22 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/151a4c.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp2_151a4c "exp2_151a4c" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%exp2_151a4c = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Exp2 %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %exp2_151a4c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %exp2_151a4c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %exp2_151a4c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/exp2/151a4c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/exp2/151a4c.wgsl.expected.wgsl new file mode 100644 index 0000000000..33f0c7f702 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/151a4c.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn exp2_151a4c() { + var arg_0 = vec2(f16()); + var res : vec2 = exp2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_151a4c(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_151a4c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_151a4c(); +} diff --git a/test/tint/builtins/gen/var/exp2/751377.wgsl b/test/tint/builtins/gen/var/exp2/751377.wgsl new file mode 100644 index 0000000000..9f15ce7925 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/751377.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn exp2(vec<3, f16>) -> vec<3, f16> +fn exp2_751377() { + var arg_0 = vec3(f16()); + var res: vec3 = exp2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_751377(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_751377(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_751377(); +} diff --git a/test/tint/builtins/gen/var/exp2/751377.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/exp2/751377.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e6251d2770 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/751377.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void exp2_751377() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = exp2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_751377(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_751377(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_751377(); + return; +} diff --git a/test/tint/builtins/gen/var/exp2/751377.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/exp2/751377.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3284d6f4c4 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/751377.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void exp2_751377() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = exp2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_751377(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_751377(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_751377(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000028B810B9560(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000028B810B9560(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/exp2/751377.wgsl.expected.glsl b/test/tint/builtins/gen/var/exp2/751377.wgsl.expected.glsl new file mode 100644 index 0000000000..93e0de7380 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/751377.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp2_751377() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = exp2(arg_0); +} + +vec4 vertex_main() { + exp2_751377(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void exp2_751377() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = exp2(arg_0); +} + +void fragment_main() { + exp2_751377(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp2_751377() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = exp2(arg_0); +} + +void compute_main() { + exp2_751377(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/exp2/751377.wgsl.expected.msl b/test/tint/builtins/gen/var/exp2/751377.wgsl.expected.msl new file mode 100644 index 0000000000..ee675e3f78 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/751377.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void exp2_751377() { + half3 arg_0 = half3(0.0h); + half3 res = exp2(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp2_751377(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp2_751377(); + return; +} + +kernel void compute_main() { + exp2_751377(); + return; +} + diff --git a/test/tint/builtins/gen/var/exp2/751377.wgsl.expected.spvasm b/test/tint/builtins/gen/var/exp2/751377.wgsl.expected.spvasm new file mode 100644 index 0000000000..a6a7c0c133 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/751377.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp2_751377 "exp2_751377" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%exp2_751377 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Exp2 %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %exp2_751377 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %exp2_751377 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %exp2_751377 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/exp2/751377.wgsl.expected.wgsl b/test/tint/builtins/gen/var/exp2/751377.wgsl.expected.wgsl new file mode 100644 index 0000000000..54d18f084c --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/751377.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn exp2_751377() { + var arg_0 = vec3(f16()); + var res : vec3 = exp2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_751377(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_751377(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_751377(); +} diff --git a/test/tint/builtins/gen/var/exp2/b408e4.wgsl b/test/tint/builtins/gen/var/exp2/b408e4.wgsl new file mode 100644 index 0000000000..25f4d91ebe --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/b408e4.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn exp2(f16) -> f16 +fn exp2_b408e4() { + var arg_0 = f16(); + var res: f16 = exp2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_b408e4(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_b408e4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_b408e4(); +} diff --git a/test/tint/builtins/gen/var/exp2/b408e4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/exp2/b408e4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1da83c0d56 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/b408e4.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void exp2_b408e4() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = exp2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_b408e4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_b408e4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_b408e4(); + return; +} diff --git a/test/tint/builtins/gen/var/exp2/b408e4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/exp2/b408e4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..dad65555bb --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/b408e4.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void exp2_b408e4() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = exp2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_b408e4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_b408e4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_b408e4(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001CEFA5170D0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001CEFA5170D0(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/exp2/b408e4.wgsl.expected.glsl b/test/tint/builtins/gen/var/exp2/b408e4.wgsl.expected.glsl new file mode 100644 index 0000000000..978b7dfe08 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/b408e4.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp2_b408e4() { + float16_t arg_0 = 0.0hf; + float16_t res = exp2(arg_0); +} + +vec4 vertex_main() { + exp2_b408e4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void exp2_b408e4() { + float16_t arg_0 = 0.0hf; + float16_t res = exp2(arg_0); +} + +void fragment_main() { + exp2_b408e4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp2_b408e4() { + float16_t arg_0 = 0.0hf; + float16_t res = exp2(arg_0); +} + +void compute_main() { + exp2_b408e4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/exp2/b408e4.wgsl.expected.msl b/test/tint/builtins/gen/var/exp2/b408e4.wgsl.expected.msl new file mode 100644 index 0000000000..3e0cbb24fa --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/b408e4.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void exp2_b408e4() { + half arg_0 = 0.0h; + half res = exp2(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp2_b408e4(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp2_b408e4(); + return; +} + +kernel void compute_main() { + exp2_b408e4(); + return; +} + diff --git a/test/tint/builtins/gen/var/exp2/b408e4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/exp2/b408e4.wgsl.expected.spvasm new file mode 100644 index 0000000000..c387afbc58 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/b408e4.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp2_b408e4 "exp2_b408e4" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%exp2_b408e4 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Exp2 %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %exp2_b408e4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %exp2_b408e4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %exp2_b408e4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/exp2/b408e4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/exp2/b408e4.wgsl.expected.wgsl new file mode 100644 index 0000000000..0772e03956 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/b408e4.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn exp2_b408e4() { + var arg_0 = f16(); + var res : f16 = exp2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_b408e4(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_b408e4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_b408e4(); +} diff --git a/test/tint/builtins/gen/var/exp2/ffa827.wgsl b/test/tint/builtins/gen/var/exp2/ffa827.wgsl new file mode 100644 index 0000000000..f9fc7cbd63 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/ffa827.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn exp2(vec<4, f16>) -> vec<4, f16> +fn exp2_ffa827() { + var arg_0 = vec4(f16()); + var res: vec4 = exp2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_ffa827(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_ffa827(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_ffa827(); +} diff --git a/test/tint/builtins/gen/var/exp2/ffa827.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/exp2/ffa827.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..199b7a8b8a --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/ffa827.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void exp2_ffa827() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = exp2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_ffa827(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_ffa827(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_ffa827(); + return; +} diff --git a/test/tint/builtins/gen/var/exp2/ffa827.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/exp2/ffa827.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..87e544c06b --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/ffa827.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void exp2_ffa827() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = exp2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_ffa827(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_ffa827(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_ffa827(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E8001E07F0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E8001E07F0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/exp2/ffa827.wgsl.expected.glsl b/test/tint/builtins/gen/var/exp2/ffa827.wgsl.expected.glsl new file mode 100644 index 0000000000..eacdcb00e1 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/ffa827.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp2_ffa827() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = exp2(arg_0); +} + +vec4 vertex_main() { + exp2_ffa827(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void exp2_ffa827() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = exp2(arg_0); +} + +void fragment_main() { + exp2_ffa827(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp2_ffa827() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = exp2(arg_0); +} + +void compute_main() { + exp2_ffa827(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/exp2/ffa827.wgsl.expected.msl b/test/tint/builtins/gen/var/exp2/ffa827.wgsl.expected.msl new file mode 100644 index 0000000000..0dc6782398 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/ffa827.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void exp2_ffa827() { + half4 arg_0 = half4(0.0h); + half4 res = exp2(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp2_ffa827(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp2_ffa827(); + return; +} + +kernel void compute_main() { + exp2_ffa827(); + return; +} + diff --git a/test/tint/builtins/gen/var/exp2/ffa827.wgsl.expected.spvasm b/test/tint/builtins/gen/var/exp2/ffa827.wgsl.expected.spvasm new file mode 100644 index 0000000000..d343ed6620 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/ffa827.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp2_ffa827 "exp2_ffa827" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%exp2_ffa827 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Exp2 %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %exp2_ffa827 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %exp2_ffa827 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %exp2_ffa827 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/exp2/ffa827.wgsl.expected.wgsl b/test/tint/builtins/gen/var/exp2/ffa827.wgsl.expected.wgsl new file mode 100644 index 0000000000..cc00537444 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/ffa827.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn exp2_ffa827() { + var arg_0 = vec4(f16()); + var res : vec4 = exp2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_ffa827(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_ffa827(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_ffa827(); +} diff --git a/test/tint/builtins/gen/var/faceForward/524986.wgsl b/test/tint/builtins/gen/var/faceForward/524986.wgsl new file mode 100644 index 0000000000..1dafe7bcfe --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/524986.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn faceForward(vec<3, f16>, vec<3, f16>, vec<3, f16>) -> vec<3, f16> +fn faceForward_524986() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var arg_2 = vec3(f16()); + var res: vec3 = faceForward(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + faceForward_524986(); + return vec4(); +} + +@fragment +fn fragment_main() { + faceForward_524986(); +} + +@compute @workgroup_size(1) +fn compute_main() { + faceForward_524986(); +} diff --git a/test/tint/builtins/gen/var/faceForward/524986.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/faceForward/524986.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ebf2086ccc --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/524986.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void faceForward_524986() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector arg_2 = (float16_t(0.0h)).xxx; + vector res = faceforward(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + faceForward_524986(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + faceForward_524986(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + faceForward_524986(); + return; +} diff --git a/test/tint/builtins/gen/var/faceForward/524986.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/faceForward/524986.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..13e64eb462 --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/524986.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +SKIP: FAILED + +void faceForward_524986() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector arg_2 = (float16_t(0.0h)).xxx; + vector res = faceforward(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + faceForward_524986(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + faceForward_524986(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + faceForward_524986(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000295C6562990(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000295C6562990(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000295C6562990(4,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000295C6562990(5,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/faceForward/524986.wgsl.expected.glsl b/test/tint/builtins/gen/var/faceForward/524986.wgsl.expected.glsl new file mode 100644 index 0000000000..a53d71045d --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/524986.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void faceForward_524986() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 arg_2 = f16vec3(0.0hf); + f16vec3 res = faceforward(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + faceForward_524986(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void faceForward_524986() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 arg_2 = f16vec3(0.0hf); + f16vec3 res = faceforward(arg_0, arg_1, arg_2); +} + +void fragment_main() { + faceForward_524986(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void faceForward_524986() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 arg_2 = f16vec3(0.0hf); + f16vec3 res = faceforward(arg_0, arg_1, arg_2); +} + +void compute_main() { + faceForward_524986(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/faceForward/524986.wgsl.expected.msl b/test/tint/builtins/gen/var/faceForward/524986.wgsl.expected.msl new file mode 100644 index 0000000000..71beddb9a4 --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/524986.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void faceForward_524986() { + half3 arg_0 = half3(0.0h); + half3 arg_1 = half3(0.0h); + half3 arg_2 = half3(0.0h); + half3 res = faceforward(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + faceForward_524986(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + faceForward_524986(); + return; +} + +kernel void compute_main() { + faceForward_524986(); + return; +} + diff --git a/test/tint/builtins/gen/var/faceForward/524986.wgsl.expected.spvasm b/test/tint/builtins/gen/var/faceForward/524986.wgsl.expected.spvasm new file mode 100644 index 0000000000..7c84d75b56 --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/524986.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %faceForward_524986 "faceForward_524986" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%faceForward_524986 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %arg_1 = OpVariable %_ptr_Function_v3half Function %15 + %arg_2 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %22 = OpLoad %v3half %arg_0 + %23 = OpLoad %v3half %arg_1 + %24 = OpLoad %v3half %arg_2 + %20 = OpExtInst %v3half %21 FaceForward %22 %23 %24 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %faceForward_524986 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %faceForward_524986 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %faceForward_524986 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/faceForward/524986.wgsl.expected.wgsl b/test/tint/builtins/gen/var/faceForward/524986.wgsl.expected.wgsl new file mode 100644 index 0000000000..99a0ce8f7c --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/524986.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn faceForward_524986() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var arg_2 = vec3(f16()); + var res : vec3 = faceForward(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + faceForward_524986(); + return vec4(); +} + +@fragment +fn fragment_main() { + faceForward_524986(); +} + +@compute @workgroup_size(1) +fn compute_main() { + faceForward_524986(); +} diff --git a/test/tint/builtins/gen/var/faceForward/cc63dc.wgsl b/test/tint/builtins/gen/var/faceForward/cc63dc.wgsl new file mode 100644 index 0000000000..4c15845b28 --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/cc63dc.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn faceForward(vec<4, f16>, vec<4, f16>, vec<4, f16>) -> vec<4, f16> +fn faceForward_cc63dc() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var arg_2 = vec4(f16()); + var res: vec4 = faceForward(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + faceForward_cc63dc(); + return vec4(); +} + +@fragment +fn fragment_main() { + faceForward_cc63dc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + faceForward_cc63dc(); +} diff --git a/test/tint/builtins/gen/var/faceForward/cc63dc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/faceForward/cc63dc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9137554b02 --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/cc63dc.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void faceForward_cc63dc() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + vector arg_2 = (float16_t(0.0h)).xxxx; + vector res = faceforward(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + faceForward_cc63dc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + faceForward_cc63dc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + faceForward_cc63dc(); + return; +} diff --git a/test/tint/builtins/gen/var/faceForward/cc63dc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/faceForward/cc63dc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a1942e9304 --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/cc63dc.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +SKIP: FAILED + +void faceForward_cc63dc() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + vector arg_2 = (float16_t(0.0h)).xxxx; + vector res = faceforward(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + faceForward_cc63dc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + faceForward_cc63dc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + faceForward_cc63dc(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002186E2D0B70(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002186E2D0B70(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002186E2D0B70(4,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002186E2D0B70(5,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/faceForward/cc63dc.wgsl.expected.glsl b/test/tint/builtins/gen/var/faceForward/cc63dc.wgsl.expected.glsl new file mode 100644 index 0000000000..37cf24fcf5 --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/cc63dc.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void faceForward_cc63dc() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 arg_2 = f16vec4(0.0hf); + f16vec4 res = faceforward(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + faceForward_cc63dc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void faceForward_cc63dc() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 arg_2 = f16vec4(0.0hf); + f16vec4 res = faceforward(arg_0, arg_1, arg_2); +} + +void fragment_main() { + faceForward_cc63dc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void faceForward_cc63dc() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 arg_2 = f16vec4(0.0hf); + f16vec4 res = faceforward(arg_0, arg_1, arg_2); +} + +void compute_main() { + faceForward_cc63dc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/faceForward/cc63dc.wgsl.expected.msl b/test/tint/builtins/gen/var/faceForward/cc63dc.wgsl.expected.msl new file mode 100644 index 0000000000..aa5ce15687 --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/cc63dc.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void faceForward_cc63dc() { + half4 arg_0 = half4(0.0h); + half4 arg_1 = half4(0.0h); + half4 arg_2 = half4(0.0h); + half4 res = faceforward(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + faceForward_cc63dc(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + faceForward_cc63dc(); + return; +} + +kernel void compute_main() { + faceForward_cc63dc(); + return; +} + diff --git a/test/tint/builtins/gen/var/faceForward/cc63dc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/faceForward/cc63dc.wgsl.expected.spvasm new file mode 100644 index 0000000000..eccdf4368f --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/cc63dc.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %faceForward_cc63dc "faceForward_cc63dc" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%faceForward_cc63dc = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %arg_1 = OpVariable %_ptr_Function_v4half Function %15 + %arg_2 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %22 = OpLoad %v4half %arg_0 + %23 = OpLoad %v4half %arg_1 + %24 = OpLoad %v4half %arg_2 + %20 = OpExtInst %v4half %21 FaceForward %22 %23 %24 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %faceForward_cc63dc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %faceForward_cc63dc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %faceForward_cc63dc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/faceForward/cc63dc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/faceForward/cc63dc.wgsl.expected.wgsl new file mode 100644 index 0000000000..48f247d081 --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/cc63dc.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn faceForward_cc63dc() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var arg_2 = vec4(f16()); + var res : vec4 = faceForward(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + faceForward_cc63dc(); + return vec4(); +} + +@fragment +fn fragment_main() { + faceForward_cc63dc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + faceForward_cc63dc(); +} diff --git a/test/tint/builtins/gen/var/faceForward/fb0f2e.wgsl b/test/tint/builtins/gen/var/faceForward/fb0f2e.wgsl new file mode 100644 index 0000000000..51da087a3a --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/fb0f2e.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn faceForward(vec<2, f16>, vec<2, f16>, vec<2, f16>) -> vec<2, f16> +fn faceForward_fb0f2e() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var arg_2 = vec2(f16()); + var res: vec2 = faceForward(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + faceForward_fb0f2e(); + return vec4(); +} + +@fragment +fn fragment_main() { + faceForward_fb0f2e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + faceForward_fb0f2e(); +} diff --git a/test/tint/builtins/gen/var/faceForward/fb0f2e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/faceForward/fb0f2e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9e0972c562 --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/fb0f2e.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void faceForward_fb0f2e() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + vector arg_2 = (float16_t(0.0h)).xx; + vector res = faceforward(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + faceForward_fb0f2e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + faceForward_fb0f2e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + faceForward_fb0f2e(); + return; +} diff --git a/test/tint/builtins/gen/var/faceForward/fb0f2e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/faceForward/fb0f2e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..68f1d02e8c --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/fb0f2e.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +SKIP: FAILED + +void faceForward_fb0f2e() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + vector arg_2 = (float16_t(0.0h)).xx; + vector res = faceforward(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + faceForward_fb0f2e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + faceForward_fb0f2e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + faceForward_fb0f2e(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002526D7A2430(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002526D7A2430(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002526D7A2430(4,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002526D7A2430(5,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/faceForward/fb0f2e.wgsl.expected.glsl b/test/tint/builtins/gen/var/faceForward/fb0f2e.wgsl.expected.glsl new file mode 100644 index 0000000000..9dfcea05eb --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/fb0f2e.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void faceForward_fb0f2e() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 arg_2 = f16vec2(0.0hf); + f16vec2 res = faceforward(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + faceForward_fb0f2e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void faceForward_fb0f2e() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 arg_2 = f16vec2(0.0hf); + f16vec2 res = faceforward(arg_0, arg_1, arg_2); +} + +void fragment_main() { + faceForward_fb0f2e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void faceForward_fb0f2e() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 arg_2 = f16vec2(0.0hf); + f16vec2 res = faceforward(arg_0, arg_1, arg_2); +} + +void compute_main() { + faceForward_fb0f2e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/faceForward/fb0f2e.wgsl.expected.msl b/test/tint/builtins/gen/var/faceForward/fb0f2e.wgsl.expected.msl new file mode 100644 index 0000000000..9a425c70cc --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/fb0f2e.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void faceForward_fb0f2e() { + half2 arg_0 = half2(0.0h); + half2 arg_1 = half2(0.0h); + half2 arg_2 = half2(0.0h); + half2 res = faceforward(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + faceForward_fb0f2e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + faceForward_fb0f2e(); + return; +} + +kernel void compute_main() { + faceForward_fb0f2e(); + return; +} + diff --git a/test/tint/builtins/gen/var/faceForward/fb0f2e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/faceForward/fb0f2e.wgsl.expected.spvasm new file mode 100644 index 0000000000..a5f1f816ad --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/fb0f2e.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %faceForward_fb0f2e "faceForward_fb0f2e" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%faceForward_fb0f2e = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %arg_1 = OpVariable %_ptr_Function_v2half Function %15 + %arg_2 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %22 = OpLoad %v2half %arg_0 + %23 = OpLoad %v2half %arg_1 + %24 = OpLoad %v2half %arg_2 + %20 = OpExtInst %v2half %21 FaceForward %22 %23 %24 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %faceForward_fb0f2e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %faceForward_fb0f2e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %faceForward_fb0f2e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/faceForward/fb0f2e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/faceForward/fb0f2e.wgsl.expected.wgsl new file mode 100644 index 0000000000..985cbab1af --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/fb0f2e.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn faceForward_fb0f2e() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var arg_2 = vec2(f16()); + var res : vec2 = faceForward(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + faceForward_fb0f2e(); + return vec4(); +} + +@fragment +fn fragment_main() { + faceForward_fb0f2e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + faceForward_fb0f2e(); +} diff --git a/test/tint/builtins/gen/var/floor/3802c0.wgsl b/test/tint/builtins/gen/var/floor/3802c0.wgsl new file mode 100644 index 0000000000..22ede14734 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/3802c0.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn floor(vec<3, f16>) -> vec<3, f16> +fn floor_3802c0() { + var arg_0 = vec3(f16()); + var res: vec3 = floor(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_3802c0(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_3802c0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_3802c0(); +} diff --git a/test/tint/builtins/gen/var/floor/3802c0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/floor/3802c0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a997d823f0 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/3802c0.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void floor_3802c0() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = floor(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_3802c0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_3802c0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_3802c0(); + return; +} diff --git a/test/tint/builtins/gen/var/floor/3802c0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/floor/3802c0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e3478266ea --- /dev/null +++ b/test/tint/builtins/gen/var/floor/3802c0.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void floor_3802c0() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = floor(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_3802c0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_3802c0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_3802c0(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002CFD3102AA0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002CFD3102AA0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/floor/3802c0.wgsl.expected.glsl b/test/tint/builtins/gen/var/floor/3802c0.wgsl.expected.glsl new file mode 100644 index 0000000000..2f0dabfa35 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/3802c0.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void floor_3802c0() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = floor(arg_0); +} + +vec4 vertex_main() { + floor_3802c0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void floor_3802c0() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = floor(arg_0); +} + +void fragment_main() { + floor_3802c0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void floor_3802c0() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = floor(arg_0); +} + +void compute_main() { + floor_3802c0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/floor/3802c0.wgsl.expected.msl b/test/tint/builtins/gen/var/floor/3802c0.wgsl.expected.msl new file mode 100644 index 0000000000..48f2187e8d --- /dev/null +++ b/test/tint/builtins/gen/var/floor/3802c0.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void floor_3802c0() { + half3 arg_0 = half3(0.0h); + half3 res = floor(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + floor_3802c0(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + floor_3802c0(); + return; +} + +kernel void compute_main() { + floor_3802c0(); + return; +} + diff --git a/test/tint/builtins/gen/var/floor/3802c0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/floor/3802c0.wgsl.expected.spvasm new file mode 100644 index 0000000000..8c34a52ae4 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/3802c0.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %floor_3802c0 "floor_3802c0" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%floor_3802c0 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Floor %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %floor_3802c0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %floor_3802c0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %floor_3802c0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/floor/3802c0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/floor/3802c0.wgsl.expected.wgsl new file mode 100644 index 0000000000..e668dbc57e --- /dev/null +++ b/test/tint/builtins/gen/var/floor/3802c0.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn floor_3802c0() { + var arg_0 = vec3(f16()); + var res : vec3 = floor(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_3802c0(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_3802c0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_3802c0(); +} diff --git a/test/tint/builtins/gen/var/floor/84658c.wgsl b/test/tint/builtins/gen/var/floor/84658c.wgsl new file mode 100644 index 0000000000..9cf6d75491 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/84658c.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn floor(vec<2, f16>) -> vec<2, f16> +fn floor_84658c() { + var arg_0 = vec2(f16()); + var res: vec2 = floor(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_84658c(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_84658c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_84658c(); +} diff --git a/test/tint/builtins/gen/var/floor/84658c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/floor/84658c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d10e8f8b52 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/84658c.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void floor_84658c() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = floor(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_84658c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_84658c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_84658c(); + return; +} diff --git a/test/tint/builtins/gen/var/floor/84658c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/floor/84658c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..04bf97acdc --- /dev/null +++ b/test/tint/builtins/gen/var/floor/84658c.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void floor_84658c() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = floor(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_84658c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_84658c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_84658c(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000208743D86D0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000208743D86D0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/floor/84658c.wgsl.expected.glsl b/test/tint/builtins/gen/var/floor/84658c.wgsl.expected.glsl new file mode 100644 index 0000000000..6c2236fcc7 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/84658c.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void floor_84658c() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = floor(arg_0); +} + +vec4 vertex_main() { + floor_84658c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void floor_84658c() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = floor(arg_0); +} + +void fragment_main() { + floor_84658c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void floor_84658c() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = floor(arg_0); +} + +void compute_main() { + floor_84658c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/floor/84658c.wgsl.expected.msl b/test/tint/builtins/gen/var/floor/84658c.wgsl.expected.msl new file mode 100644 index 0000000000..dbc91a4c58 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/84658c.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void floor_84658c() { + half2 arg_0 = half2(0.0h); + half2 res = floor(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + floor_84658c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + floor_84658c(); + return; +} + +kernel void compute_main() { + floor_84658c(); + return; +} + diff --git a/test/tint/builtins/gen/var/floor/84658c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/floor/84658c.wgsl.expected.spvasm new file mode 100644 index 0000000000..5ab1072c26 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/84658c.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %floor_84658c "floor_84658c" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%floor_84658c = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Floor %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %floor_84658c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %floor_84658c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %floor_84658c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/floor/84658c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/floor/84658c.wgsl.expected.wgsl new file mode 100644 index 0000000000..af40f90ea0 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/84658c.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn floor_84658c() { + var arg_0 = vec2(f16()); + var res : vec2 = floor(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_84658c(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_84658c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_84658c(); +} diff --git a/test/tint/builtins/gen/var/floor/a2d31b.wgsl b/test/tint/builtins/gen/var/floor/a2d31b.wgsl new file mode 100644 index 0000000000..edc990a1fe --- /dev/null +++ b/test/tint/builtins/gen/var/floor/a2d31b.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn floor(vec<4, f16>) -> vec<4, f16> +fn floor_a2d31b() { + var arg_0 = vec4(f16()); + var res: vec4 = floor(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_a2d31b(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_a2d31b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_a2d31b(); +} diff --git a/test/tint/builtins/gen/var/floor/a2d31b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/floor/a2d31b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3eccce668e --- /dev/null +++ b/test/tint/builtins/gen/var/floor/a2d31b.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void floor_a2d31b() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = floor(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_a2d31b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_a2d31b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_a2d31b(); + return; +} diff --git a/test/tint/builtins/gen/var/floor/a2d31b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/floor/a2d31b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b670bde492 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/a2d31b.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void floor_a2d31b() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = floor(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_a2d31b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_a2d31b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_a2d31b(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020277229EB0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020277229EB0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/floor/a2d31b.wgsl.expected.glsl b/test/tint/builtins/gen/var/floor/a2d31b.wgsl.expected.glsl new file mode 100644 index 0000000000..4e2d116377 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/a2d31b.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void floor_a2d31b() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = floor(arg_0); +} + +vec4 vertex_main() { + floor_a2d31b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void floor_a2d31b() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = floor(arg_0); +} + +void fragment_main() { + floor_a2d31b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void floor_a2d31b() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = floor(arg_0); +} + +void compute_main() { + floor_a2d31b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/floor/a2d31b.wgsl.expected.msl b/test/tint/builtins/gen/var/floor/a2d31b.wgsl.expected.msl new file mode 100644 index 0000000000..521eda3580 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/a2d31b.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void floor_a2d31b() { + half4 arg_0 = half4(0.0h); + half4 res = floor(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + floor_a2d31b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + floor_a2d31b(); + return; +} + +kernel void compute_main() { + floor_a2d31b(); + return; +} + diff --git a/test/tint/builtins/gen/var/floor/a2d31b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/floor/a2d31b.wgsl.expected.spvasm new file mode 100644 index 0000000000..4cf75b1f50 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/a2d31b.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %floor_a2d31b "floor_a2d31b" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%floor_a2d31b = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Floor %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %floor_a2d31b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %floor_a2d31b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %floor_a2d31b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/floor/a2d31b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/floor/a2d31b.wgsl.expected.wgsl new file mode 100644 index 0000000000..7b23f7d38a --- /dev/null +++ b/test/tint/builtins/gen/var/floor/a2d31b.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn floor_a2d31b() { + var arg_0 = vec4(f16()); + var res : vec4 = floor(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_a2d31b(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_a2d31b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_a2d31b(); +} diff --git a/test/tint/builtins/gen/var/floor/b6e09c.wgsl b/test/tint/builtins/gen/var/floor/b6e09c.wgsl new file mode 100644 index 0000000000..7ddbc74948 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/b6e09c.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn floor(f16) -> f16 +fn floor_b6e09c() { + var arg_0 = f16(); + var res: f16 = floor(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_b6e09c(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_b6e09c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_b6e09c(); +} diff --git a/test/tint/builtins/gen/var/floor/b6e09c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/floor/b6e09c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a13fef1f77 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/b6e09c.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void floor_b6e09c() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = floor(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_b6e09c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_b6e09c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_b6e09c(); + return; +} diff --git a/test/tint/builtins/gen/var/floor/b6e09c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/floor/b6e09c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..04d82705d0 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/b6e09c.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void floor_b6e09c() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = floor(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_b6e09c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_b6e09c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_b6e09c(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001FC8E37C9F0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001FC8E37C9F0(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/floor/b6e09c.wgsl.expected.glsl b/test/tint/builtins/gen/var/floor/b6e09c.wgsl.expected.glsl new file mode 100644 index 0000000000..5a9ededee0 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/b6e09c.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void floor_b6e09c() { + float16_t arg_0 = 0.0hf; + float16_t res = floor(arg_0); +} + +vec4 vertex_main() { + floor_b6e09c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void floor_b6e09c() { + float16_t arg_0 = 0.0hf; + float16_t res = floor(arg_0); +} + +void fragment_main() { + floor_b6e09c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void floor_b6e09c() { + float16_t arg_0 = 0.0hf; + float16_t res = floor(arg_0); +} + +void compute_main() { + floor_b6e09c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/floor/b6e09c.wgsl.expected.msl b/test/tint/builtins/gen/var/floor/b6e09c.wgsl.expected.msl new file mode 100644 index 0000000000..eddf8f2c10 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/b6e09c.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void floor_b6e09c() { + half arg_0 = 0.0h; + half res = floor(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + floor_b6e09c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + floor_b6e09c(); + return; +} + +kernel void compute_main() { + floor_b6e09c(); + return; +} + diff --git a/test/tint/builtins/gen/var/floor/b6e09c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/floor/b6e09c.wgsl.expected.spvasm new file mode 100644 index 0000000000..45cc608104 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/b6e09c.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %floor_b6e09c "floor_b6e09c" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%floor_b6e09c = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Floor %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %floor_b6e09c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %floor_b6e09c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %floor_b6e09c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/floor/b6e09c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/floor/b6e09c.wgsl.expected.wgsl new file mode 100644 index 0000000000..68db5d7201 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/b6e09c.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn floor_b6e09c() { + var arg_0 = f16(); + var res : f16 = floor(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_b6e09c(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_b6e09c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_b6e09c(); +} diff --git a/test/tint/builtins/gen/var/fma/ab7818.wgsl b/test/tint/builtins/gen/var/fma/ab7818.wgsl new file mode 100644 index 0000000000..ab0ffd7e47 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/ab7818.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn fma(vec<4, f16>, vec<4, f16>, vec<4, f16>) -> vec<4, f16> +fn fma_ab7818() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var arg_2 = vec4(f16()); + var res: vec4 = fma(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_ab7818(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_ab7818(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_ab7818(); +} diff --git a/test/tint/builtins/gen/var/fma/ab7818.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/fma/ab7818.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ba7fd240c1 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/ab7818.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void fma_ab7818() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + vector arg_2 = (float16_t(0.0h)).xxxx; + vector res = mad(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_ab7818(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_ab7818(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_ab7818(); + return; +} diff --git a/test/tint/builtins/gen/var/fma/ab7818.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/fma/ab7818.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4cc79d74ea --- /dev/null +++ b/test/tint/builtins/gen/var/fma/ab7818.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +SKIP: FAILED + +void fma_ab7818() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + vector arg_2 = (float16_t(0.0h)).xxxx; + vector res = mad(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_ab7818(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_ab7818(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_ab7818(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C8EC063920(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C8EC063920(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C8EC063920(4,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C8EC063920(5,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/fma/ab7818.wgsl.expected.glsl b/test/tint/builtins/gen/var/fma/ab7818.wgsl.expected.glsl new file mode 100644 index 0000000000..210f2f999d --- /dev/null +++ b/test/tint/builtins/gen/var/fma/ab7818.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fma_ab7818() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 arg_2 = f16vec4(0.0hf); + f16vec4 res = ((arg_0) * (arg_1) + (arg_2)); +} + +vec4 vertex_main() { + fma_ab7818(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void fma_ab7818() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 arg_2 = f16vec4(0.0hf); + f16vec4 res = ((arg_0) * (arg_1) + (arg_2)); +} + +void fragment_main() { + fma_ab7818(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fma_ab7818() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 arg_2 = f16vec4(0.0hf); + f16vec4 res = ((arg_0) * (arg_1) + (arg_2)); +} + +void compute_main() { + fma_ab7818(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fma/ab7818.wgsl.expected.msl b/test/tint/builtins/gen/var/fma/ab7818.wgsl.expected.msl new file mode 100644 index 0000000000..7618e6d448 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/ab7818.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void fma_ab7818() { + half4 arg_0 = half4(0.0h); + half4 arg_1 = half4(0.0h); + half4 arg_2 = half4(0.0h); + half4 res = fma(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fma_ab7818(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fma_ab7818(); + return; +} + +kernel void compute_main() { + fma_ab7818(); + return; +} + diff --git a/test/tint/builtins/gen/var/fma/ab7818.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fma/ab7818.wgsl.expected.spvasm new file mode 100644 index 0000000000..cfe30fe69c --- /dev/null +++ b/test/tint/builtins/gen/var/fma/ab7818.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fma_ab7818 "fma_ab7818" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %fma_ab7818 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %arg_1 = OpVariable %_ptr_Function_v4half Function %15 + %arg_2 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %22 = OpLoad %v4half %arg_0 + %23 = OpLoad %v4half %arg_1 + %24 = OpLoad %v4half %arg_2 + %20 = OpExtInst %v4half %21 Fma %22 %23 %24 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %fma_ab7818 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %fma_ab7818 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %fma_ab7818 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fma/ab7818.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fma/ab7818.wgsl.expected.wgsl new file mode 100644 index 0000000000..14808bab52 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/ab7818.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn fma_ab7818() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var arg_2 = vec4(f16()); + var res : vec4 = fma(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_ab7818(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_ab7818(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_ab7818(); +} diff --git a/test/tint/builtins/gen/var/fma/bf21b6.wgsl b/test/tint/builtins/gen/var/fma/bf21b6.wgsl new file mode 100644 index 0000000000..7fa271160c --- /dev/null +++ b/test/tint/builtins/gen/var/fma/bf21b6.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn fma(vec<2, f16>, vec<2, f16>, vec<2, f16>) -> vec<2, f16> +fn fma_bf21b6() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var arg_2 = vec2(f16()); + var res: vec2 = fma(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_bf21b6(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_bf21b6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_bf21b6(); +} diff --git a/test/tint/builtins/gen/var/fma/bf21b6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/fma/bf21b6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fad050827b --- /dev/null +++ b/test/tint/builtins/gen/var/fma/bf21b6.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void fma_bf21b6() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + vector arg_2 = (float16_t(0.0h)).xx; + vector res = mad(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_bf21b6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_bf21b6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_bf21b6(); + return; +} diff --git a/test/tint/builtins/gen/var/fma/bf21b6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/fma/bf21b6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c30ed3a656 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/bf21b6.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +SKIP: FAILED + +void fma_bf21b6() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + vector arg_2 = (float16_t(0.0h)).xx; + vector res = mad(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_bf21b6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_bf21b6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_bf21b6(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000213565C3920(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000213565C3920(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000213565C3920(4,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000213565C3920(5,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/fma/bf21b6.wgsl.expected.glsl b/test/tint/builtins/gen/var/fma/bf21b6.wgsl.expected.glsl new file mode 100644 index 0000000000..d6376ec1ff --- /dev/null +++ b/test/tint/builtins/gen/var/fma/bf21b6.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fma_bf21b6() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 arg_2 = f16vec2(0.0hf); + f16vec2 res = ((arg_0) * (arg_1) + (arg_2)); +} + +vec4 vertex_main() { + fma_bf21b6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void fma_bf21b6() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 arg_2 = f16vec2(0.0hf); + f16vec2 res = ((arg_0) * (arg_1) + (arg_2)); +} + +void fragment_main() { + fma_bf21b6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fma_bf21b6() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 arg_2 = f16vec2(0.0hf); + f16vec2 res = ((arg_0) * (arg_1) + (arg_2)); +} + +void compute_main() { + fma_bf21b6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fma/bf21b6.wgsl.expected.msl b/test/tint/builtins/gen/var/fma/bf21b6.wgsl.expected.msl new file mode 100644 index 0000000000..fd5f39ce59 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/bf21b6.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void fma_bf21b6() { + half2 arg_0 = half2(0.0h); + half2 arg_1 = half2(0.0h); + half2 arg_2 = half2(0.0h); + half2 res = fma(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fma_bf21b6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fma_bf21b6(); + return; +} + +kernel void compute_main() { + fma_bf21b6(); + return; +} + diff --git a/test/tint/builtins/gen/var/fma/bf21b6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fma/bf21b6.wgsl.expected.spvasm new file mode 100644 index 0000000000..d66229d6f1 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/bf21b6.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fma_bf21b6 "fma_bf21b6" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %fma_bf21b6 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %arg_1 = OpVariable %_ptr_Function_v2half Function %15 + %arg_2 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %22 = OpLoad %v2half %arg_0 + %23 = OpLoad %v2half %arg_1 + %24 = OpLoad %v2half %arg_2 + %20 = OpExtInst %v2half %21 Fma %22 %23 %24 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %fma_bf21b6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %fma_bf21b6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %fma_bf21b6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fma/bf21b6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fma/bf21b6.wgsl.expected.wgsl new file mode 100644 index 0000000000..aef061d83a --- /dev/null +++ b/test/tint/builtins/gen/var/fma/bf21b6.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn fma_bf21b6() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var arg_2 = vec2(f16()); + var res : vec2 = fma(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_bf21b6(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_bf21b6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_bf21b6(); +} diff --git a/test/tint/builtins/gen/var/fma/c8abb3.wgsl b/test/tint/builtins/gen/var/fma/c8abb3.wgsl new file mode 100644 index 0000000000..c86a6991f0 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/c8abb3.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn fma(f16, f16, f16) -> f16 +fn fma_c8abb3() { + var arg_0 = f16(); + var arg_1 = f16(); + var arg_2 = f16(); + var res: f16 = fma(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_c8abb3(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_c8abb3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_c8abb3(); +} diff --git a/test/tint/builtins/gen/var/fma/c8abb3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/fma/c8abb3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ce25e33259 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/c8abb3.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void fma_c8abb3() { + float16_t arg_0 = float16_t(0.0h); + float16_t arg_1 = float16_t(0.0h); + float16_t arg_2 = float16_t(0.0h); + float16_t res = mad(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_c8abb3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_c8abb3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_c8abb3(); + return; +} diff --git a/test/tint/builtins/gen/var/fma/c8abb3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/fma/c8abb3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0085a06f40 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/c8abb3.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void fma_c8abb3() { + float16_t arg_0 = float16_t(0.0h); + float16_t arg_1 = float16_t(0.0h); + float16_t arg_2 = float16_t(0.0h); + float16_t res = mad(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_c8abb3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_c8abb3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_c8abb3(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001545EC319C0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001545EC319C0(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/fma/c8abb3.wgsl.expected.glsl b/test/tint/builtins/gen/var/fma/c8abb3.wgsl.expected.glsl new file mode 100644 index 0000000000..971fb93533 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/c8abb3.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fma_c8abb3() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t arg_2 = 0.0hf; + float16_t res = ((arg_0) * (arg_1) + (arg_2)); +} + +vec4 vertex_main() { + fma_c8abb3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void fma_c8abb3() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t arg_2 = 0.0hf; + float16_t res = ((arg_0) * (arg_1) + (arg_2)); +} + +void fragment_main() { + fma_c8abb3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fma_c8abb3() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t arg_2 = 0.0hf; + float16_t res = ((arg_0) * (arg_1) + (arg_2)); +} + +void compute_main() { + fma_c8abb3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fma/c8abb3.wgsl.expected.msl b/test/tint/builtins/gen/var/fma/c8abb3.wgsl.expected.msl new file mode 100644 index 0000000000..8cef0c3de5 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/c8abb3.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void fma_c8abb3() { + half arg_0 = 0.0h; + half arg_1 = 0.0h; + half arg_2 = 0.0h; + half res = fma(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fma_c8abb3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fma_c8abb3(); + return; +} + +kernel void compute_main() { + fma_c8abb3(); + return; +} + diff --git a/test/tint/builtins/gen/var/fma/c8abb3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fma/c8abb3.wgsl.expected.spvasm new file mode 100644 index 0000000000..b033681808 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/c8abb3.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fma_c8abb3 "fma_c8abb3" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %fma_c8abb3 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %arg_1 = OpVariable %_ptr_Function_half Function %14 + %arg_2 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + OpStore %arg_2 %14 + %21 = OpLoad %half %arg_0 + %22 = OpLoad %half %arg_1 + %23 = OpLoad %half %arg_2 + %19 = OpExtInst %half %20 Fma %21 %22 %23 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %fma_c8abb3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %fma_c8abb3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %fma_c8abb3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fma/c8abb3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fma/c8abb3.wgsl.expected.wgsl new file mode 100644 index 0000000000..6f24f34dc5 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/c8abb3.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn fma_c8abb3() { + var arg_0 = f16(); + var arg_1 = f16(); + var arg_2 = f16(); + var res : f16 = fma(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_c8abb3(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_c8abb3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_c8abb3(); +} diff --git a/test/tint/builtins/gen/var/fma/e7abdc.wgsl b/test/tint/builtins/gen/var/fma/e7abdc.wgsl new file mode 100644 index 0000000000..a07279df16 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/e7abdc.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn fma(vec<3, f16>, vec<3, f16>, vec<3, f16>) -> vec<3, f16> +fn fma_e7abdc() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var arg_2 = vec3(f16()); + var res: vec3 = fma(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_e7abdc(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_e7abdc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_e7abdc(); +} diff --git a/test/tint/builtins/gen/var/fma/e7abdc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/fma/e7abdc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b6b357e77b --- /dev/null +++ b/test/tint/builtins/gen/var/fma/e7abdc.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void fma_e7abdc() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector arg_2 = (float16_t(0.0h)).xxx; + vector res = mad(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_e7abdc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_e7abdc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_e7abdc(); + return; +} diff --git a/test/tint/builtins/gen/var/fma/e7abdc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/fma/e7abdc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0866b5c4f2 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/e7abdc.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +SKIP: FAILED + +void fma_e7abdc() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector arg_2 = (float16_t(0.0h)).xxx; + vector res = mad(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_e7abdc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_e7abdc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_e7abdc(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D742133930(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D742133930(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D742133930(4,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D742133930(5,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/fma/e7abdc.wgsl.expected.glsl b/test/tint/builtins/gen/var/fma/e7abdc.wgsl.expected.glsl new file mode 100644 index 0000000000..ba47f42fee --- /dev/null +++ b/test/tint/builtins/gen/var/fma/e7abdc.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fma_e7abdc() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 arg_2 = f16vec3(0.0hf); + f16vec3 res = ((arg_0) * (arg_1) + (arg_2)); +} + +vec4 vertex_main() { + fma_e7abdc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void fma_e7abdc() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 arg_2 = f16vec3(0.0hf); + f16vec3 res = ((arg_0) * (arg_1) + (arg_2)); +} + +void fragment_main() { + fma_e7abdc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fma_e7abdc() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 arg_2 = f16vec3(0.0hf); + f16vec3 res = ((arg_0) * (arg_1) + (arg_2)); +} + +void compute_main() { + fma_e7abdc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fma/e7abdc.wgsl.expected.msl b/test/tint/builtins/gen/var/fma/e7abdc.wgsl.expected.msl new file mode 100644 index 0000000000..c7e165ade3 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/e7abdc.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void fma_e7abdc() { + half3 arg_0 = half3(0.0h); + half3 arg_1 = half3(0.0h); + half3 arg_2 = half3(0.0h); + half3 res = fma(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fma_e7abdc(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fma_e7abdc(); + return; +} + +kernel void compute_main() { + fma_e7abdc(); + return; +} + diff --git a/test/tint/builtins/gen/var/fma/e7abdc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fma/e7abdc.wgsl.expected.spvasm new file mode 100644 index 0000000000..c9aaaf7a64 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/e7abdc.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fma_e7abdc "fma_e7abdc" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %fma_e7abdc = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %arg_1 = OpVariable %_ptr_Function_v3half Function %15 + %arg_2 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %22 = OpLoad %v3half %arg_0 + %23 = OpLoad %v3half %arg_1 + %24 = OpLoad %v3half %arg_2 + %20 = OpExtInst %v3half %21 Fma %22 %23 %24 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %fma_e7abdc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %fma_e7abdc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %fma_e7abdc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fma/e7abdc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fma/e7abdc.wgsl.expected.wgsl new file mode 100644 index 0000000000..2dbbcac3fc --- /dev/null +++ b/test/tint/builtins/gen/var/fma/e7abdc.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn fma_e7abdc() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var arg_2 = vec3(f16()); + var res : vec3 = fma(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_e7abdc(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_e7abdc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_e7abdc(); +} diff --git a/test/tint/builtins/gen/var/fract/181aa9.wgsl b/test/tint/builtins/gen/var/fract/181aa9.wgsl new file mode 100644 index 0000000000..12cc4bf347 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/181aa9.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn fract(vec<2, f16>) -> vec<2, f16> +fn fract_181aa9() { + var arg_0 = vec2(f16()); + var res: vec2 = fract(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_181aa9(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_181aa9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_181aa9(); +} diff --git a/test/tint/builtins/gen/var/fract/181aa9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/fract/181aa9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..08a307dbd7 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/181aa9.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void fract_181aa9() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = frac(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_181aa9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_181aa9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_181aa9(); + return; +} diff --git a/test/tint/builtins/gen/var/fract/181aa9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/fract/181aa9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..87fc1a1e47 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/181aa9.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void fract_181aa9() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = frac(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_181aa9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_181aa9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_181aa9(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000290A4231990(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000290A4231990(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/fract/181aa9.wgsl.expected.glsl b/test/tint/builtins/gen/var/fract/181aa9.wgsl.expected.glsl new file mode 100644 index 0000000000..e9871d3d3c --- /dev/null +++ b/test/tint/builtins/gen/var/fract/181aa9.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fract_181aa9() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = fract(arg_0); +} + +vec4 vertex_main() { + fract_181aa9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void fract_181aa9() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = fract(arg_0); +} + +void fragment_main() { + fract_181aa9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fract_181aa9() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = fract(arg_0); +} + +void compute_main() { + fract_181aa9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fract/181aa9.wgsl.expected.msl b/test/tint/builtins/gen/var/fract/181aa9.wgsl.expected.msl new file mode 100644 index 0000000000..f3351da3af --- /dev/null +++ b/test/tint/builtins/gen/var/fract/181aa9.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void fract_181aa9() { + half2 arg_0 = half2(0.0h); + half2 res = fract(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fract_181aa9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fract_181aa9(); + return; +} + +kernel void compute_main() { + fract_181aa9(); + return; +} + diff --git a/test/tint/builtins/gen/var/fract/181aa9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fract/181aa9.wgsl.expected.spvasm new file mode 100644 index 0000000000..47d1ee6787 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/181aa9.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fract_181aa9 "fract_181aa9" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%fract_181aa9 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Fract %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %fract_181aa9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %fract_181aa9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %fract_181aa9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fract/181aa9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fract/181aa9.wgsl.expected.wgsl new file mode 100644 index 0000000000..6e73c70769 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/181aa9.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn fract_181aa9() { + var arg_0 = vec2(f16()); + var res : vec2 = fract(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_181aa9(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_181aa9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_181aa9(); +} diff --git a/test/tint/builtins/gen/var/fract/498c77.wgsl b/test/tint/builtins/gen/var/fract/498c77.wgsl new file mode 100644 index 0000000000..aef30b3549 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/498c77.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn fract(vec<4, f16>) -> vec<4, f16> +fn fract_498c77() { + var arg_0 = vec4(f16()); + var res: vec4 = fract(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_498c77(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_498c77(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_498c77(); +} diff --git a/test/tint/builtins/gen/var/fract/498c77.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/fract/498c77.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d9e34efb4f --- /dev/null +++ b/test/tint/builtins/gen/var/fract/498c77.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void fract_498c77() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = frac(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_498c77(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_498c77(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_498c77(); + return; +} diff --git a/test/tint/builtins/gen/var/fract/498c77.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/fract/498c77.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bf6c7aedbe --- /dev/null +++ b/test/tint/builtins/gen/var/fract/498c77.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void fract_498c77() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = frac(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_498c77(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_498c77(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_498c77(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F8576786D0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F8576786D0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/fract/498c77.wgsl.expected.glsl b/test/tint/builtins/gen/var/fract/498c77.wgsl.expected.glsl new file mode 100644 index 0000000000..c9daa26d24 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/498c77.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fract_498c77() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = fract(arg_0); +} + +vec4 vertex_main() { + fract_498c77(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void fract_498c77() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = fract(arg_0); +} + +void fragment_main() { + fract_498c77(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fract_498c77() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = fract(arg_0); +} + +void compute_main() { + fract_498c77(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fract/498c77.wgsl.expected.msl b/test/tint/builtins/gen/var/fract/498c77.wgsl.expected.msl new file mode 100644 index 0000000000..3f7a3f18e9 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/498c77.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void fract_498c77() { + half4 arg_0 = half4(0.0h); + half4 res = fract(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fract_498c77(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fract_498c77(); + return; +} + +kernel void compute_main() { + fract_498c77(); + return; +} + diff --git a/test/tint/builtins/gen/var/fract/498c77.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fract/498c77.wgsl.expected.spvasm new file mode 100644 index 0000000000..62ab9e0992 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/498c77.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fract_498c77 "fract_498c77" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%fract_498c77 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Fract %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %fract_498c77 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %fract_498c77 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %fract_498c77 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fract/498c77.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fract/498c77.wgsl.expected.wgsl new file mode 100644 index 0000000000..325c892908 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/498c77.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn fract_498c77() { + var arg_0 = vec4(f16()); + var res : vec4 = fract(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_498c77(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_498c77(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_498c77(); +} diff --git a/test/tint/builtins/gen/var/fract/958a1d.wgsl b/test/tint/builtins/gen/var/fract/958a1d.wgsl new file mode 100644 index 0000000000..187f494946 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/958a1d.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn fract(vec<3, f16>) -> vec<3, f16> +fn fract_958a1d() { + var arg_0 = vec3(f16()); + var res: vec3 = fract(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_958a1d(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_958a1d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_958a1d(); +} diff --git a/test/tint/builtins/gen/var/fract/958a1d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/fract/958a1d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..98322b9651 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/958a1d.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void fract_958a1d() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = frac(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_958a1d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_958a1d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_958a1d(); + return; +} diff --git a/test/tint/builtins/gen/var/fract/958a1d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/fract/958a1d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6771ca7dd9 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/958a1d.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void fract_958a1d() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = frac(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_958a1d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_958a1d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_958a1d(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002450F006F40(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002450F006F40(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/fract/958a1d.wgsl.expected.glsl b/test/tint/builtins/gen/var/fract/958a1d.wgsl.expected.glsl new file mode 100644 index 0000000000..283602bbf9 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/958a1d.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fract_958a1d() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = fract(arg_0); +} + +vec4 vertex_main() { + fract_958a1d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void fract_958a1d() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = fract(arg_0); +} + +void fragment_main() { + fract_958a1d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fract_958a1d() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = fract(arg_0); +} + +void compute_main() { + fract_958a1d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fract/958a1d.wgsl.expected.msl b/test/tint/builtins/gen/var/fract/958a1d.wgsl.expected.msl new file mode 100644 index 0000000000..745157e8d7 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/958a1d.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void fract_958a1d() { + half3 arg_0 = half3(0.0h); + half3 res = fract(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fract_958a1d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fract_958a1d(); + return; +} + +kernel void compute_main() { + fract_958a1d(); + return; +} + diff --git a/test/tint/builtins/gen/var/fract/958a1d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fract/958a1d.wgsl.expected.spvasm new file mode 100644 index 0000000000..9393329722 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/958a1d.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fract_958a1d "fract_958a1d" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%fract_958a1d = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Fract %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %fract_958a1d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %fract_958a1d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %fract_958a1d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fract/958a1d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fract/958a1d.wgsl.expected.wgsl new file mode 100644 index 0000000000..d35d4d5513 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/958a1d.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn fract_958a1d() { + var arg_0 = vec3(f16()); + var res : vec3 = fract(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_958a1d(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_958a1d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_958a1d(); +} diff --git a/test/tint/builtins/gen/var/fract/eb38ce.wgsl b/test/tint/builtins/gen/var/fract/eb38ce.wgsl new file mode 100644 index 0000000000..435df2c91b --- /dev/null +++ b/test/tint/builtins/gen/var/fract/eb38ce.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn fract(f16) -> f16 +fn fract_eb38ce() { + var arg_0 = f16(); + var res: f16 = fract(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_eb38ce(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_eb38ce(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_eb38ce(); +} diff --git a/test/tint/builtins/gen/var/fract/eb38ce.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/fract/eb38ce.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9aa5d74d2b --- /dev/null +++ b/test/tint/builtins/gen/var/fract/eb38ce.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void fract_eb38ce() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = frac(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_eb38ce(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_eb38ce(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_eb38ce(); + return; +} diff --git a/test/tint/builtins/gen/var/fract/eb38ce.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/fract/eb38ce.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c481b82bbf --- /dev/null +++ b/test/tint/builtins/gen/var/fract/eb38ce.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void fract_eb38ce() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = frac(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_eb38ce(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_eb38ce(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_eb38ce(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024B27352E20(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024B27352E20(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/fract/eb38ce.wgsl.expected.glsl b/test/tint/builtins/gen/var/fract/eb38ce.wgsl.expected.glsl new file mode 100644 index 0000000000..bb439189a8 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/eb38ce.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fract_eb38ce() { + float16_t arg_0 = 0.0hf; + float16_t res = fract(arg_0); +} + +vec4 vertex_main() { + fract_eb38ce(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void fract_eb38ce() { + float16_t arg_0 = 0.0hf; + float16_t res = fract(arg_0); +} + +void fragment_main() { + fract_eb38ce(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fract_eb38ce() { + float16_t arg_0 = 0.0hf; + float16_t res = fract(arg_0); +} + +void compute_main() { + fract_eb38ce(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fract/eb38ce.wgsl.expected.msl b/test/tint/builtins/gen/var/fract/eb38ce.wgsl.expected.msl new file mode 100644 index 0000000000..6ca36be1f4 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/eb38ce.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void fract_eb38ce() { + half arg_0 = 0.0h; + half res = fract(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fract_eb38ce(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fract_eb38ce(); + return; +} + +kernel void compute_main() { + fract_eb38ce(); + return; +} + diff --git a/test/tint/builtins/gen/var/fract/eb38ce.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fract/eb38ce.wgsl.expected.spvasm new file mode 100644 index 0000000000..1d320c349d --- /dev/null +++ b/test/tint/builtins/gen/var/fract/eb38ce.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fract_eb38ce "fract_eb38ce" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%fract_eb38ce = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Fract %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %fract_eb38ce + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %fract_eb38ce + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %fract_eb38ce + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fract/eb38ce.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fract/eb38ce.wgsl.expected.wgsl new file mode 100644 index 0000000000..a590daeccd --- /dev/null +++ b/test/tint/builtins/gen/var/fract/eb38ce.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn fract_eb38ce() { + var arg_0 = f16(); + var res : f16 = fract(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_eb38ce(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_eb38ce(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_eb38ce(); +} diff --git a/test/tint/builtins/gen/var/frexp/3dd21e.wgsl b/test/tint/builtins/gen/var/frexp/3dd21e.wgsl new file mode 100644 index 0000000000..6b40118a1f --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/3dd21e.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn frexp(vec<4, f16>) -> __frexp_result_vec<4, f16> +fn frexp_3dd21e() { + var arg_0 = vec4(f16()); + var res = frexp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_3dd21e(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_3dd21e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_3dd21e(); +} diff --git a/test/tint/builtins/gen/var/frexp/3dd21e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/frexp/3dd21e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..557bac1ec8 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/3dd21e.wgsl.expected.dxc.hlsl @@ -0,0 +1,42 @@ +struct frexp_result_vec4_f16 { + vector sig; + int4 exp; +}; +frexp_result_vec4_f16 tint_frexp(vector param_0) { + vector exp; + vector sig = frexp(param_0, exp); + frexp_result_vec4_f16 result = {sig, int4(exp)}; + return result; +} + +void frexp_3dd21e() { + vector arg_0 = (float16_t(0.0h)).xxxx; + frexp_result_vec4_f16 res = tint_frexp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_3dd21e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_3dd21e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_3dd21e(); + return; +} diff --git a/test/tint/builtins/gen/var/frexp/3dd21e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/frexp/3dd21e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c514368998 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/3dd21e.wgsl.expected.fxc.hlsl @@ -0,0 +1,47 @@ +SKIP: FAILED + +struct frexp_result_vec4_f16 { + vector sig; + int4 exp; +}; +frexp_result_vec4_f16 tint_frexp(vector param_0) { + vector exp; + vector sig = frexp(param_0, exp); + frexp_result_vec4_f16 result = {sig, int4(exp)}; + return result; +} + +void frexp_3dd21e() { + vector arg_0 = (float16_t(0.0h)).xxxx; + frexp_result_vec4_f16 res = tint_frexp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_3dd21e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_3dd21e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_3dd21e(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002B0820A2F50(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/frexp/3dd21e.wgsl.expected.glsl b/test/tint/builtins/gen/var/frexp/3dd21e.wgsl.expected.glsl new file mode 100644 index 0000000000..a1dc1665bf --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/3dd21e.wgsl.expected.glsl @@ -0,0 +1,91 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct frexp_result_vec4_f16 { + f16vec4 sig; + ivec4 exp; +}; + +frexp_result_vec4_f16 tint_frexp(f16vec4 param_0) { + frexp_result_vec4_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_3dd21e() { + f16vec4 arg_0 = f16vec4(0.0hf); + frexp_result_vec4_f16 res = tint_frexp(arg_0); +} + +vec4 vertex_main() { + frexp_3dd21e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +struct frexp_result_vec4_f16 { + f16vec4 sig; + ivec4 exp; +}; + +frexp_result_vec4_f16 tint_frexp(f16vec4 param_0) { + frexp_result_vec4_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_3dd21e() { + f16vec4 arg_0 = f16vec4(0.0hf); + frexp_result_vec4_f16 res = tint_frexp(arg_0); +} + +void fragment_main() { + frexp_3dd21e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct frexp_result_vec4_f16 { + f16vec4 sig; + ivec4 exp; +}; + +frexp_result_vec4_f16 tint_frexp(f16vec4 param_0) { + frexp_result_vec4_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_3dd21e() { + f16vec4 arg_0 = f16vec4(0.0hf); + frexp_result_vec4_f16 res = tint_frexp(arg_0); +} + +void compute_main() { + frexp_3dd21e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/frexp/3dd21e.wgsl.expected.msl b/test/tint/builtins/gen/var/frexp/3dd21e.wgsl.expected.msl new file mode 100644 index 0000000000..7ca5bd7611 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/3dd21e.wgsl.expected.msl @@ -0,0 +1,45 @@ +#include + +using namespace metal; + +struct frexp_result_vec4_f16 { + half4 sig; + int4 exp; +}; +frexp_result_vec4_f16 tint_frexp(half4 param_0) { + frexp_result_vec4_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + +void frexp_3dd21e() { + half4 arg_0 = half4(0.0h); + frexp_result_vec4_f16 res = tint_frexp(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + frexp_3dd21e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + frexp_3dd21e(); + return; +} + +kernel void compute_main() { + frexp_3dd21e(); + return; +} + diff --git a/test/tint/builtins/gen/var/frexp/3dd21e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/frexp/3dd21e.wgsl.expected.spvasm new file mode 100644 index 0000000000..70eddba230 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/3dd21e.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %frexp_3dd21e "frexp_3dd21e" + OpName %arg_0 "arg_0" + OpName %__frexp_result_vec4_f16 "__frexp_result_vec4_f16" + OpMemberName %__frexp_result_vec4_f16 0 "sig" + OpMemberName %__frexp_result_vec4_f16 1 "exp" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__frexp_result_vec4_f16 0 Offset 0 + OpMemberDecorate %__frexp_result_vec4_f16 1 Offset 16 + %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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 +%__frexp_result_vec4_f16 = OpTypeStruct %v4half %v4int +%_ptr_Function___frexp_result_vec4_f16 = OpTypePointer Function %__frexp_result_vec4_f16 + %26 = OpConstantNull %__frexp_result_vec4_f16 + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%frexp_3dd21e = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function___frexp_result_vec4_f16 Function %26 + OpStore %arg_0 %15 + %23 = OpLoad %v4half %arg_0 + %18 = OpExtInst %__frexp_result_vec4_f16 %22 FrexpStruct %23 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %frexp_3dd21e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %frexp_3dd21e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %39 = OpLabel + %40 = OpFunctionCall %void %frexp_3dd21e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/frexp/3dd21e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/frexp/3dd21e.wgsl.expected.wgsl new file mode 100644 index 0000000000..557f702e52 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/3dd21e.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn frexp_3dd21e() { + var arg_0 = vec4(f16()); + var res = frexp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_3dd21e(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_3dd21e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_3dd21e(); +} diff --git a/test/tint/builtins/gen/var/frexp/5257dd.wgsl b/test/tint/builtins/gen/var/frexp/5257dd.wgsl new file mode 100644 index 0000000000..9451324f73 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/5257dd.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn frexp(f16) -> __frexp_result +fn frexp_5257dd() { + var arg_0 = f16(); + var res = frexp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_5257dd(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_5257dd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_5257dd(); +} diff --git a/test/tint/builtins/gen/var/frexp/5257dd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/frexp/5257dd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b52f6d8b82 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/5257dd.wgsl.expected.dxc.hlsl @@ -0,0 +1,42 @@ +struct frexp_result_f16 { + float16_t sig; + int exp; +}; +frexp_result_f16 tint_frexp(float16_t param_0) { + float16_t exp; + float16_t sig = frexp(param_0, exp); + frexp_result_f16 result = {sig, int(exp)}; + return result; +} + +void frexp_5257dd() { + float16_t arg_0 = float16_t(0.0h); + frexp_result_f16 res = tint_frexp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_5257dd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_5257dd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_5257dd(); + return; +} diff --git a/test/tint/builtins/gen/var/frexp/5257dd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/frexp/5257dd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e4e360f6ac --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/5257dd.wgsl.expected.fxc.hlsl @@ -0,0 +1,47 @@ +SKIP: FAILED + +struct frexp_result_f16 { + float16_t sig; + int exp; +}; +frexp_result_f16 tint_frexp(float16_t param_0) { + float16_t exp; + float16_t sig = frexp(param_0, exp); + frexp_result_f16 result = {sig, int(exp)}; + return result; +} + +void frexp_5257dd() { + float16_t arg_0 = float16_t(0.0h); + frexp_result_f16 res = tint_frexp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_5257dd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_5257dd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_5257dd(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000029E12ED17D0(2,3-11): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/builtins/gen/var/frexp/5257dd.wgsl.expected.glsl b/test/tint/builtins/gen/var/frexp/5257dd.wgsl.expected.glsl new file mode 100644 index 0000000000..0d7e39fc58 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/5257dd.wgsl.expected.glsl @@ -0,0 +1,91 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct frexp_result_f16 { + float16_t sig; + int exp; +}; + +frexp_result_f16 tint_frexp(float16_t param_0) { + frexp_result_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_5257dd() { + float16_t arg_0 = 0.0hf; + frexp_result_f16 res = tint_frexp(arg_0); +} + +vec4 vertex_main() { + frexp_5257dd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +struct frexp_result_f16 { + float16_t sig; + int exp; +}; + +frexp_result_f16 tint_frexp(float16_t param_0) { + frexp_result_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_5257dd() { + float16_t arg_0 = 0.0hf; + frexp_result_f16 res = tint_frexp(arg_0); +} + +void fragment_main() { + frexp_5257dd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct frexp_result_f16 { + float16_t sig; + int exp; +}; + +frexp_result_f16 tint_frexp(float16_t param_0) { + frexp_result_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_5257dd() { + float16_t arg_0 = 0.0hf; + frexp_result_f16 res = tint_frexp(arg_0); +} + +void compute_main() { + frexp_5257dd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/frexp/5257dd.wgsl.expected.msl b/test/tint/builtins/gen/var/frexp/5257dd.wgsl.expected.msl new file mode 100644 index 0000000000..9d0edc3971 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/5257dd.wgsl.expected.msl @@ -0,0 +1,45 @@ +#include + +using namespace metal; + +struct frexp_result_f16 { + half sig; + int exp; +}; +frexp_result_f16 tint_frexp(half param_0) { + frexp_result_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + +void frexp_5257dd() { + half arg_0 = 0.0h; + frexp_result_f16 res = tint_frexp(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + frexp_5257dd(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + frexp_5257dd(); + return; +} + +kernel void compute_main() { + frexp_5257dd(); + return; +} + diff --git a/test/tint/builtins/gen/var/frexp/5257dd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/frexp/5257dd.wgsl.expected.spvasm new file mode 100644 index 0000000000..b0008a83b7 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/5257dd.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %frexp_5257dd "frexp_5257dd" + OpName %arg_0 "arg_0" + OpName %__frexp_result_f16 "__frexp_result_f16" + OpMemberName %__frexp_result_f16 0 "sig" + OpMemberName %__frexp_result_f16 1 "exp" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__frexp_result_f16 0 Offset 0 + OpMemberDecorate %__frexp_result_f16 1 Offset 4 + %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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %int = OpTypeInt 32 1 +%__frexp_result_f16 = OpTypeStruct %half %int +%_ptr_Function___frexp_result_f16 = OpTypePointer Function %__frexp_result_f16 + %24 = OpConstantNull %__frexp_result_f16 + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%frexp_5257dd = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function___frexp_result_f16 Function %24 + OpStore %arg_0 %14 + %21 = OpLoad %half %arg_0 + %17 = OpExtInst %__frexp_result_f16 %20 FrexpStruct %21 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %frexp_5257dd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %frexp_5257dd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %frexp_5257dd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/frexp/5257dd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/frexp/5257dd.wgsl.expected.wgsl new file mode 100644 index 0000000000..664e19ab35 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/5257dd.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn frexp_5257dd() { + var arg_0 = f16(); + var res = frexp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_5257dd(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_5257dd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_5257dd(); +} diff --git a/test/tint/builtins/gen/var/frexp/5f47bf.wgsl b/test/tint/builtins/gen/var/frexp/5f47bf.wgsl new file mode 100644 index 0000000000..8d43e800bd --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/5f47bf.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn frexp(vec<2, f16>) -> __frexp_result_vec<2, f16> +fn frexp_5f47bf() { + var arg_0 = vec2(f16()); + var res = frexp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_5f47bf(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_5f47bf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_5f47bf(); +} diff --git a/test/tint/builtins/gen/var/frexp/5f47bf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/frexp/5f47bf.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..478ced8cc2 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/5f47bf.wgsl.expected.dxc.hlsl @@ -0,0 +1,42 @@ +struct frexp_result_vec2_f16 { + vector sig; + int2 exp; +}; +frexp_result_vec2_f16 tint_frexp(vector param_0) { + vector exp; + vector sig = frexp(param_0, exp); + frexp_result_vec2_f16 result = {sig, int2(exp)}; + return result; +} + +void frexp_5f47bf() { + vector arg_0 = (float16_t(0.0h)).xx; + frexp_result_vec2_f16 res = tint_frexp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_5f47bf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_5f47bf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_5f47bf(); + return; +} diff --git a/test/tint/builtins/gen/var/frexp/5f47bf.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/frexp/5f47bf.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..82d183ac7a --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/5f47bf.wgsl.expected.fxc.hlsl @@ -0,0 +1,47 @@ +SKIP: FAILED + +struct frexp_result_vec2_f16 { + vector sig; + int2 exp; +}; +frexp_result_vec2_f16 tint_frexp(vector param_0) { + vector exp; + vector sig = frexp(param_0, exp); + frexp_result_vec2_f16 result = {sig, int2(exp)}; + return result; +} + +void frexp_5f47bf() { + vector arg_0 = (float16_t(0.0h)).xx; + frexp_result_vec2_f16 res = tint_frexp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_5f47bf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_5f47bf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_5f47bf(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002974137DC80(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/frexp/5f47bf.wgsl.expected.glsl b/test/tint/builtins/gen/var/frexp/5f47bf.wgsl.expected.glsl new file mode 100644 index 0000000000..2864a81f1d --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/5f47bf.wgsl.expected.glsl @@ -0,0 +1,91 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct frexp_result_vec2_f16 { + f16vec2 sig; + ivec2 exp; +}; + +frexp_result_vec2_f16 tint_frexp(f16vec2 param_0) { + frexp_result_vec2_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_5f47bf() { + f16vec2 arg_0 = f16vec2(0.0hf); + frexp_result_vec2_f16 res = tint_frexp(arg_0); +} + +vec4 vertex_main() { + frexp_5f47bf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +struct frexp_result_vec2_f16 { + f16vec2 sig; + ivec2 exp; +}; + +frexp_result_vec2_f16 tint_frexp(f16vec2 param_0) { + frexp_result_vec2_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_5f47bf() { + f16vec2 arg_0 = f16vec2(0.0hf); + frexp_result_vec2_f16 res = tint_frexp(arg_0); +} + +void fragment_main() { + frexp_5f47bf(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct frexp_result_vec2_f16 { + f16vec2 sig; + ivec2 exp; +}; + +frexp_result_vec2_f16 tint_frexp(f16vec2 param_0) { + frexp_result_vec2_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_5f47bf() { + f16vec2 arg_0 = f16vec2(0.0hf); + frexp_result_vec2_f16 res = tint_frexp(arg_0); +} + +void compute_main() { + frexp_5f47bf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/frexp/5f47bf.wgsl.expected.msl b/test/tint/builtins/gen/var/frexp/5f47bf.wgsl.expected.msl new file mode 100644 index 0000000000..dfdef716a0 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/5f47bf.wgsl.expected.msl @@ -0,0 +1,45 @@ +#include + +using namespace metal; + +struct frexp_result_vec2_f16 { + half2 sig; + int2 exp; +}; +frexp_result_vec2_f16 tint_frexp(half2 param_0) { + frexp_result_vec2_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + +void frexp_5f47bf() { + half2 arg_0 = half2(0.0h); + frexp_result_vec2_f16 res = tint_frexp(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + frexp_5f47bf(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + frexp_5f47bf(); + return; +} + +kernel void compute_main() { + frexp_5f47bf(); + return; +} + diff --git a/test/tint/builtins/gen/var/frexp/5f47bf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/frexp/5f47bf.wgsl.expected.spvasm new file mode 100644 index 0000000000..c9c41906a9 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/5f47bf.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %frexp_5f47bf "frexp_5f47bf" + OpName %arg_0 "arg_0" + OpName %__frexp_result_vec2_f16 "__frexp_result_vec2_f16" + OpMemberName %__frexp_result_vec2_f16 0 "sig" + OpMemberName %__frexp_result_vec2_f16 1 "exp" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__frexp_result_vec2_f16 0 Offset 0 + OpMemberDecorate %__frexp_result_vec2_f16 1 Offset 8 + %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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%__frexp_result_vec2_f16 = OpTypeStruct %v2half %v2int +%_ptr_Function___frexp_result_vec2_f16 = OpTypePointer Function %__frexp_result_vec2_f16 + %26 = OpConstantNull %__frexp_result_vec2_f16 + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%frexp_5f47bf = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function___frexp_result_vec2_f16 Function %26 + OpStore %arg_0 %15 + %23 = OpLoad %v2half %arg_0 + %18 = OpExtInst %__frexp_result_vec2_f16 %22 FrexpStruct %23 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %frexp_5f47bf + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %frexp_5f47bf + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %39 = OpLabel + %40 = OpFunctionCall %void %frexp_5f47bf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/frexp/5f47bf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/frexp/5f47bf.wgsl.expected.wgsl new file mode 100644 index 0000000000..63fce21c8c --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/5f47bf.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn frexp_5f47bf() { + var arg_0 = vec2(f16()); + var res = frexp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_5f47bf(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_5f47bf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_5f47bf(); +} diff --git a/test/tint/builtins/gen/var/frexp/ae4a66.wgsl b/test/tint/builtins/gen/var/frexp/ae4a66.wgsl new file mode 100644 index 0000000000..e5aad680cc --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/ae4a66.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn frexp(vec<3, f16>) -> __frexp_result_vec<3, f16> +fn frexp_ae4a66() { + var arg_0 = vec3(f16()); + var res = frexp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_ae4a66(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_ae4a66(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_ae4a66(); +} diff --git a/test/tint/builtins/gen/var/frexp/ae4a66.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/frexp/ae4a66.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..633a556ae8 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/ae4a66.wgsl.expected.dxc.hlsl @@ -0,0 +1,42 @@ +struct frexp_result_vec3_f16 { + vector sig; + int3 exp; +}; +frexp_result_vec3_f16 tint_frexp(vector param_0) { + vector exp; + vector sig = frexp(param_0, exp); + frexp_result_vec3_f16 result = {sig, int3(exp)}; + return result; +} + +void frexp_ae4a66() { + vector arg_0 = (float16_t(0.0h)).xxx; + frexp_result_vec3_f16 res = tint_frexp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_ae4a66(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_ae4a66(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_ae4a66(); + return; +} diff --git a/test/tint/builtins/gen/var/frexp/ae4a66.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/frexp/ae4a66.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..31c17af458 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/ae4a66.wgsl.expected.fxc.hlsl @@ -0,0 +1,47 @@ +SKIP: FAILED + +struct frexp_result_vec3_f16 { + vector sig; + int3 exp; +}; +frexp_result_vec3_f16 tint_frexp(vector param_0) { + vector exp; + vector sig = frexp(param_0, exp); + frexp_result_vec3_f16 result = {sig, int3(exp)}; + return result; +} + +void frexp_ae4a66() { + vector arg_0 = (float16_t(0.0h)).xxx; + frexp_result_vec3_f16 res = tint_frexp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_ae4a66(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_ae4a66(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_ae4a66(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024B22CBDA70(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/frexp/ae4a66.wgsl.expected.glsl b/test/tint/builtins/gen/var/frexp/ae4a66.wgsl.expected.glsl new file mode 100644 index 0000000000..36a46283c2 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/ae4a66.wgsl.expected.glsl @@ -0,0 +1,91 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct frexp_result_vec3_f16 { + f16vec3 sig; + ivec3 exp; +}; + +frexp_result_vec3_f16 tint_frexp(f16vec3 param_0) { + frexp_result_vec3_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_ae4a66() { + f16vec3 arg_0 = f16vec3(0.0hf); + frexp_result_vec3_f16 res = tint_frexp(arg_0); +} + +vec4 vertex_main() { + frexp_ae4a66(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +struct frexp_result_vec3_f16 { + f16vec3 sig; + ivec3 exp; +}; + +frexp_result_vec3_f16 tint_frexp(f16vec3 param_0) { + frexp_result_vec3_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_ae4a66() { + f16vec3 arg_0 = f16vec3(0.0hf); + frexp_result_vec3_f16 res = tint_frexp(arg_0); +} + +void fragment_main() { + frexp_ae4a66(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct frexp_result_vec3_f16 { + f16vec3 sig; + ivec3 exp; +}; + +frexp_result_vec3_f16 tint_frexp(f16vec3 param_0) { + frexp_result_vec3_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_ae4a66() { + f16vec3 arg_0 = f16vec3(0.0hf); + frexp_result_vec3_f16 res = tint_frexp(arg_0); +} + +void compute_main() { + frexp_ae4a66(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/frexp/ae4a66.wgsl.expected.msl b/test/tint/builtins/gen/var/frexp/ae4a66.wgsl.expected.msl new file mode 100644 index 0000000000..670a53486e --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/ae4a66.wgsl.expected.msl @@ -0,0 +1,45 @@ +#include + +using namespace metal; + +struct frexp_result_vec3_f16 { + half3 sig; + int3 exp; +}; +frexp_result_vec3_f16 tint_frexp(half3 param_0) { + frexp_result_vec3_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + +void frexp_ae4a66() { + half3 arg_0 = half3(0.0h); + frexp_result_vec3_f16 res = tint_frexp(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + frexp_ae4a66(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + frexp_ae4a66(); + return; +} + +kernel void compute_main() { + frexp_ae4a66(); + return; +} + diff --git a/test/tint/builtins/gen/var/frexp/ae4a66.wgsl.expected.spvasm b/test/tint/builtins/gen/var/frexp/ae4a66.wgsl.expected.spvasm new file mode 100644 index 0000000000..e71e3524d4 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/ae4a66.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %frexp_ae4a66 "frexp_ae4a66" + OpName %arg_0 "arg_0" + OpName %__frexp_result_vec3_f16 "__frexp_result_vec3_f16" + OpMemberName %__frexp_result_vec3_f16 0 "sig" + OpMemberName %__frexp_result_vec3_f16 1 "exp" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__frexp_result_vec3_f16 0 Offset 0 + OpMemberDecorate %__frexp_result_vec3_f16 1 Offset 16 + %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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%__frexp_result_vec3_f16 = OpTypeStruct %v3half %v3int +%_ptr_Function___frexp_result_vec3_f16 = OpTypePointer Function %__frexp_result_vec3_f16 + %26 = OpConstantNull %__frexp_result_vec3_f16 + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%frexp_ae4a66 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function___frexp_result_vec3_f16 Function %26 + OpStore %arg_0 %15 + %23 = OpLoad %v3half %arg_0 + %18 = OpExtInst %__frexp_result_vec3_f16 %22 FrexpStruct %23 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %frexp_ae4a66 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %frexp_ae4a66 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %39 = OpLabel + %40 = OpFunctionCall %void %frexp_ae4a66 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/frexp/ae4a66.wgsl.expected.wgsl b/test/tint/builtins/gen/var/frexp/ae4a66.wgsl.expected.wgsl new file mode 100644 index 0000000000..cdbd561c76 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/ae4a66.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn frexp_ae4a66() { + var arg_0 = vec3(f16()); + var res = frexp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_ae4a66(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_ae4a66(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_ae4a66(); +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/440300.wgsl b/test/tint/builtins/gen/var/inverseSqrt/440300.wgsl new file mode 100644 index 0000000000..246419557f --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/440300.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn inverseSqrt(f16) -> f16 +fn inverseSqrt_440300() { + var arg_0 = f16(); + var res: f16 = inverseSqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_440300(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_440300(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_440300(); +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/440300.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/inverseSqrt/440300.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fe2cbec09a --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/440300.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void inverseSqrt_440300() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = rsqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_440300(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_440300(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_440300(); + return; +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/440300.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/inverseSqrt/440300.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..68da594354 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/440300.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void inverseSqrt_440300() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = rsqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_440300(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_440300(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_440300(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020CC4502790(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020CC4502790(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/inverseSqrt/440300.wgsl.expected.glsl b/test/tint/builtins/gen/var/inverseSqrt/440300.wgsl.expected.glsl new file mode 100644 index 0000000000..d673b30861 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/440300.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void inverseSqrt_440300() { + float16_t arg_0 = 0.0hf; + float16_t res = inversesqrt(arg_0); +} + +vec4 vertex_main() { + inverseSqrt_440300(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void inverseSqrt_440300() { + float16_t arg_0 = 0.0hf; + float16_t res = inversesqrt(arg_0); +} + +void fragment_main() { + inverseSqrt_440300(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void inverseSqrt_440300() { + float16_t arg_0 = 0.0hf; + float16_t res = inversesqrt(arg_0); +} + +void compute_main() { + inverseSqrt_440300(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/440300.wgsl.expected.msl b/test/tint/builtins/gen/var/inverseSqrt/440300.wgsl.expected.msl new file mode 100644 index 0000000000..f8cd8539be --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/440300.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void inverseSqrt_440300() { + half arg_0 = 0.0h; + half res = rsqrt(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + inverseSqrt_440300(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + inverseSqrt_440300(); + return; +} + +kernel void compute_main() { + inverseSqrt_440300(); + return; +} + diff --git a/test/tint/builtins/gen/var/inverseSqrt/440300.wgsl.expected.spvasm b/test/tint/builtins/gen/var/inverseSqrt/440300.wgsl.expected.spvasm new file mode 100644 index 0000000000..d53e1d78b1 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/440300.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %inverseSqrt_440300 "inverseSqrt_440300" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%inverseSqrt_440300 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 InverseSqrt %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %inverseSqrt_440300 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %inverseSqrt_440300 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %inverseSqrt_440300 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/inverseSqrt/440300.wgsl.expected.wgsl b/test/tint/builtins/gen/var/inverseSqrt/440300.wgsl.expected.wgsl new file mode 100644 index 0000000000..f0c832a9b5 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/440300.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn inverseSqrt_440300() { + var arg_0 = f16(); + var res : f16 = inverseSqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_440300(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_440300(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_440300(); +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/5f51f8.wgsl b/test/tint/builtins/gen/var/inverseSqrt/5f51f8.wgsl new file mode 100644 index 0000000000..e7e70aa188 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/5f51f8.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn inverseSqrt(vec<2, f16>) -> vec<2, f16> +fn inverseSqrt_5f51f8() { + var arg_0 = vec2(f16()); + var res: vec2 = inverseSqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_5f51f8(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_5f51f8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_5f51f8(); +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/5f51f8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/inverseSqrt/5f51f8.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5ed334a92c --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/5f51f8.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void inverseSqrt_5f51f8() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = rsqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_5f51f8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_5f51f8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_5f51f8(); + return; +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/5f51f8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/inverseSqrt/5f51f8.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..13b4979149 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/5f51f8.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void inverseSqrt_5f51f8() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = rsqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_5f51f8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_5f51f8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_5f51f8(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002676056B340(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002676056B340(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/inverseSqrt/5f51f8.wgsl.expected.glsl b/test/tint/builtins/gen/var/inverseSqrt/5f51f8.wgsl.expected.glsl new file mode 100644 index 0000000000..4117f6a4ba --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/5f51f8.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void inverseSqrt_5f51f8() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = inversesqrt(arg_0); +} + +vec4 vertex_main() { + inverseSqrt_5f51f8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void inverseSqrt_5f51f8() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = inversesqrt(arg_0); +} + +void fragment_main() { + inverseSqrt_5f51f8(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void inverseSqrt_5f51f8() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = inversesqrt(arg_0); +} + +void compute_main() { + inverseSqrt_5f51f8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/5f51f8.wgsl.expected.msl b/test/tint/builtins/gen/var/inverseSqrt/5f51f8.wgsl.expected.msl new file mode 100644 index 0000000000..58cd62850e --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/5f51f8.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void inverseSqrt_5f51f8() { + half2 arg_0 = half2(0.0h); + half2 res = rsqrt(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + inverseSqrt_5f51f8(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + inverseSqrt_5f51f8(); + return; +} + +kernel void compute_main() { + inverseSqrt_5f51f8(); + return; +} + diff --git a/test/tint/builtins/gen/var/inverseSqrt/5f51f8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/inverseSqrt/5f51f8.wgsl.expected.spvasm new file mode 100644 index 0000000000..3d428891b2 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/5f51f8.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %inverseSqrt_5f51f8 "inverseSqrt_5f51f8" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%inverseSqrt_5f51f8 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 InverseSqrt %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %inverseSqrt_5f51f8 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %inverseSqrt_5f51f8 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %inverseSqrt_5f51f8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/inverseSqrt/5f51f8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/inverseSqrt/5f51f8.wgsl.expected.wgsl new file mode 100644 index 0000000000..edabbfce51 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/5f51f8.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn inverseSqrt_5f51f8() { + var arg_0 = vec2(f16()); + var res : vec2 = inverseSqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_5f51f8(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_5f51f8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_5f51f8(); +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/b85ebd.wgsl b/test/tint/builtins/gen/var/inverseSqrt/b85ebd.wgsl new file mode 100644 index 0000000000..4a9369f80c --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/b85ebd.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn inverseSqrt(vec<3, f16>) -> vec<3, f16> +fn inverseSqrt_b85ebd() { + var arg_0 = vec3(f16()); + var res: vec3 = inverseSqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_b85ebd(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_b85ebd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_b85ebd(); +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/b85ebd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/inverseSqrt/b85ebd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fdeb4e86d9 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/b85ebd.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void inverseSqrt_b85ebd() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = rsqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_b85ebd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_b85ebd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_b85ebd(); + return; +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/b85ebd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/inverseSqrt/b85ebd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4fd1981ca6 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/b85ebd.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void inverseSqrt_b85ebd() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = rsqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_b85ebd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_b85ebd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_b85ebd(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000214452BD540(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000214452BD540(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/inverseSqrt/b85ebd.wgsl.expected.glsl b/test/tint/builtins/gen/var/inverseSqrt/b85ebd.wgsl.expected.glsl new file mode 100644 index 0000000000..bf3927205f --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/b85ebd.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void inverseSqrt_b85ebd() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = inversesqrt(arg_0); +} + +vec4 vertex_main() { + inverseSqrt_b85ebd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void inverseSqrt_b85ebd() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = inversesqrt(arg_0); +} + +void fragment_main() { + inverseSqrt_b85ebd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void inverseSqrt_b85ebd() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = inversesqrt(arg_0); +} + +void compute_main() { + inverseSqrt_b85ebd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/b85ebd.wgsl.expected.msl b/test/tint/builtins/gen/var/inverseSqrt/b85ebd.wgsl.expected.msl new file mode 100644 index 0000000000..a7f7be195c --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/b85ebd.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void inverseSqrt_b85ebd() { + half3 arg_0 = half3(0.0h); + half3 res = rsqrt(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + inverseSqrt_b85ebd(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + inverseSqrt_b85ebd(); + return; +} + +kernel void compute_main() { + inverseSqrt_b85ebd(); + return; +} + diff --git a/test/tint/builtins/gen/var/inverseSqrt/b85ebd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/inverseSqrt/b85ebd.wgsl.expected.spvasm new file mode 100644 index 0000000000..a43efc81ab --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/b85ebd.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %inverseSqrt_b85ebd "inverseSqrt_b85ebd" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%inverseSqrt_b85ebd = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 InverseSqrt %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %inverseSqrt_b85ebd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %inverseSqrt_b85ebd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %inverseSqrt_b85ebd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/inverseSqrt/b85ebd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/inverseSqrt/b85ebd.wgsl.expected.wgsl new file mode 100644 index 0000000000..b53c8ee421 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/b85ebd.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn inverseSqrt_b85ebd() { + var arg_0 = vec3(f16()); + var res : vec3 = inverseSqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_b85ebd(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_b85ebd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_b85ebd(); +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/cbdc70.wgsl b/test/tint/builtins/gen/var/inverseSqrt/cbdc70.wgsl new file mode 100644 index 0000000000..fdb5f64849 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/cbdc70.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn inverseSqrt(vec<4, f16>) -> vec<4, f16> +fn inverseSqrt_cbdc70() { + var arg_0 = vec4(f16()); + var res: vec4 = inverseSqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_cbdc70(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_cbdc70(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_cbdc70(); +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/cbdc70.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/inverseSqrt/cbdc70.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ae31e2e3bf --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/cbdc70.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void inverseSqrt_cbdc70() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = rsqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_cbdc70(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_cbdc70(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_cbdc70(); + return; +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/cbdc70.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/inverseSqrt/cbdc70.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5079fc1bbc --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/cbdc70.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void inverseSqrt_cbdc70() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = rsqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_cbdc70(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_cbdc70(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_cbdc70(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024C10401C30(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024C10401C30(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/inverseSqrt/cbdc70.wgsl.expected.glsl b/test/tint/builtins/gen/var/inverseSqrt/cbdc70.wgsl.expected.glsl new file mode 100644 index 0000000000..5d41267e07 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/cbdc70.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void inverseSqrt_cbdc70() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = inversesqrt(arg_0); +} + +vec4 vertex_main() { + inverseSqrt_cbdc70(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void inverseSqrt_cbdc70() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = inversesqrt(arg_0); +} + +void fragment_main() { + inverseSqrt_cbdc70(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void inverseSqrt_cbdc70() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = inversesqrt(arg_0); +} + +void compute_main() { + inverseSqrt_cbdc70(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/cbdc70.wgsl.expected.msl b/test/tint/builtins/gen/var/inverseSqrt/cbdc70.wgsl.expected.msl new file mode 100644 index 0000000000..0dc51ef684 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/cbdc70.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void inverseSqrt_cbdc70() { + half4 arg_0 = half4(0.0h); + half4 res = rsqrt(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + inverseSqrt_cbdc70(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + inverseSqrt_cbdc70(); + return; +} + +kernel void compute_main() { + inverseSqrt_cbdc70(); + return; +} + diff --git a/test/tint/builtins/gen/var/inverseSqrt/cbdc70.wgsl.expected.spvasm b/test/tint/builtins/gen/var/inverseSqrt/cbdc70.wgsl.expected.spvasm new file mode 100644 index 0000000000..e476973fac --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/cbdc70.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %inverseSqrt_cbdc70 "inverseSqrt_cbdc70" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%inverseSqrt_cbdc70 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 InverseSqrt %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %inverseSqrt_cbdc70 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %inverseSqrt_cbdc70 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %inverseSqrt_cbdc70 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/inverseSqrt/cbdc70.wgsl.expected.wgsl b/test/tint/builtins/gen/var/inverseSqrt/cbdc70.wgsl.expected.wgsl new file mode 100644 index 0000000000..f4e10cf477 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/cbdc70.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn inverseSqrt_cbdc70() { + var arg_0 = vec4(f16()); + var res : vec4 = inverseSqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_cbdc70(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_cbdc70(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_cbdc70(); +} diff --git a/test/tint/builtins/gen/var/ldexp/3d90b4.wgsl b/test/tint/builtins/gen/var/ldexp/3d90b4.wgsl new file mode 100644 index 0000000000..152969f810 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/3d90b4.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn ldexp(vec<2, f16>, vec<2, i32>) -> vec<2, f16> +fn ldexp_3d90b4() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(1); + var res: vec2 = ldexp(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_3d90b4(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_3d90b4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_3d90b4(); +} diff --git a/test/tint/builtins/gen/var/ldexp/3d90b4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/ldexp/3d90b4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..876fcb1a34 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/3d90b4.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void ldexp_3d90b4() { + vector arg_0 = (float16_t(0.0h)).xx; + int2 arg_1 = (1).xx; + vector res = ldexp(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_3d90b4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_3d90b4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_3d90b4(); + return; +} diff --git a/test/tint/builtins/gen/var/ldexp/3d90b4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/ldexp/3d90b4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e19db386b6 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/3d90b4.wgsl.expected.fxc.hlsl @@ -0,0 +1,38 @@ +SKIP: FAILED + +void ldexp_3d90b4() { + vector arg_0 = (float16_t(0.0h)).xx; + int2 arg_1 = (1).xx; + vector res = ldexp(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_3d90b4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_3d90b4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_3d90b4(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000297E2767C20(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000297E2767C20(4,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/ldexp/3d90b4.wgsl.expected.glsl b/test/tint/builtins/gen/var/ldexp/3d90b4.wgsl.expected.glsl new file mode 100644 index 0000000000..13d5b8901e --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/3d90b4.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ldexp_3d90b4() { + f16vec2 arg_0 = f16vec2(0.0hf); + ivec2 arg_1 = ivec2(1); + f16vec2 res = ldexp(arg_0, arg_1); +} + +vec4 vertex_main() { + ldexp_3d90b4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void ldexp_3d90b4() { + f16vec2 arg_0 = f16vec2(0.0hf); + ivec2 arg_1 = ivec2(1); + f16vec2 res = ldexp(arg_0, arg_1); +} + +void fragment_main() { + ldexp_3d90b4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ldexp_3d90b4() { + f16vec2 arg_0 = f16vec2(0.0hf); + ivec2 arg_1 = ivec2(1); + f16vec2 res = ldexp(arg_0, arg_1); +} + +void compute_main() { + ldexp_3d90b4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/ldexp/3d90b4.wgsl.expected.msl b/test/tint/builtins/gen/var/ldexp/3d90b4.wgsl.expected.msl new file mode 100644 index 0000000000..317c875f17 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/3d90b4.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void ldexp_3d90b4() { + half2 arg_0 = half2(0.0h); + int2 arg_1 = int2(1); + half2 res = ldexp(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ldexp_3d90b4(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ldexp_3d90b4(); + return; +} + +kernel void compute_main() { + ldexp_3d90b4(); + return; +} + diff --git a/test/tint/builtins/gen/var/ldexp/3d90b4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/ldexp/3d90b4.wgsl.expected.spvasm new file mode 100644 index 0000000000..61326bd8b9 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/3d90b4.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %26 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ldexp_3d90b4 "ldexp_3d90b4" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_1 = OpConstant %int 1 + %21 = OpConstantComposite %v2int %int_1 %int_1 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %24 = OpConstantNull %v2int + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%ldexp_3d90b4 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %arg_1 = OpVariable %_ptr_Function_v2int Function %24 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %21 + %27 = OpLoad %v2half %arg_0 + %28 = OpLoad %v2int %arg_1 + %25 = OpExtInst %v2half %26 Ldexp %27 %28 + OpStore %res %25 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %ldexp_3d90b4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %39 = OpLabel + %40 = OpFunctionCall %void %ldexp_3d90b4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %42 = OpLabel + %43 = OpFunctionCall %void %ldexp_3d90b4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/ldexp/3d90b4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/ldexp/3d90b4.wgsl.expected.wgsl new file mode 100644 index 0000000000..c4773b8f7a --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/3d90b4.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn ldexp_3d90b4() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(1); + var res : vec2 = ldexp(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_3d90b4(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_3d90b4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_3d90b4(); +} diff --git a/test/tint/builtins/gen/var/ldexp/624e0c.wgsl b/test/tint/builtins/gen/var/ldexp/624e0c.wgsl new file mode 100644 index 0000000000..2bf526d0ae --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/624e0c.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn ldexp(f16, i32) -> f16 +fn ldexp_624e0c() { + var arg_0 = f16(); + var arg_1 = 1; + var res: f16 = ldexp(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_624e0c(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_624e0c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_624e0c(); +} diff --git a/test/tint/builtins/gen/var/ldexp/624e0c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/ldexp/624e0c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6c7e796f95 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/624e0c.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void ldexp_624e0c() { + float16_t arg_0 = float16_t(0.0h); + int arg_1 = 1; + float16_t res = ldexp(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_624e0c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_624e0c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_624e0c(); + return; +} diff --git a/test/tint/builtins/gen/var/ldexp/624e0c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/ldexp/624e0c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..77d2859f6b --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/624e0c.wgsl.expected.fxc.hlsl @@ -0,0 +1,38 @@ +SKIP: FAILED + +void ldexp_624e0c() { + float16_t arg_0 = float16_t(0.0h); + int arg_1 = 1; + float16_t res = ldexp(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_624e0c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_624e0c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_624e0c(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C8D38A1580(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C8D38A1580(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/ldexp/624e0c.wgsl.expected.glsl b/test/tint/builtins/gen/var/ldexp/624e0c.wgsl.expected.glsl new file mode 100644 index 0000000000..f978069f59 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/624e0c.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ldexp_624e0c() { + float16_t arg_0 = 0.0hf; + int arg_1 = 1; + float16_t res = ldexp(arg_0, arg_1); +} + +vec4 vertex_main() { + ldexp_624e0c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void ldexp_624e0c() { + float16_t arg_0 = 0.0hf; + int arg_1 = 1; + float16_t res = ldexp(arg_0, arg_1); +} + +void fragment_main() { + ldexp_624e0c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ldexp_624e0c() { + float16_t arg_0 = 0.0hf; + int arg_1 = 1; + float16_t res = ldexp(arg_0, arg_1); +} + +void compute_main() { + ldexp_624e0c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/ldexp/624e0c.wgsl.expected.msl b/test/tint/builtins/gen/var/ldexp/624e0c.wgsl.expected.msl new file mode 100644 index 0000000000..f0bc88f5de --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/624e0c.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void ldexp_624e0c() { + half arg_0 = 0.0h; + int arg_1 = 1; + half res = ldexp(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ldexp_624e0c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ldexp_624e0c(); + return; +} + +kernel void compute_main() { + ldexp_624e0c(); + return; +} + diff --git a/test/tint/builtins/gen/var/ldexp/624e0c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/ldexp/624e0c.wgsl.expected.spvasm new file mode 100644 index 0000000000..7fead306b3 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/624e0c.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ldexp_624e0c "ldexp_624e0c" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%ldexp_624e0c = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %arg_1 = OpVariable %_ptr_Function_int Function %21 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %int_1 + %24 = OpLoad %half %arg_0 + %25 = OpLoad %int %arg_1 + %22 = OpExtInst %half %23 Ldexp %24 %25 + OpStore %res %22 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %ldexp_624e0c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %ldexp_624e0c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %39 = OpLabel + %40 = OpFunctionCall %void %ldexp_624e0c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/ldexp/624e0c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/ldexp/624e0c.wgsl.expected.wgsl new file mode 100644 index 0000000000..393f1ba872 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/624e0c.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn ldexp_624e0c() { + var arg_0 = f16(); + var arg_1 = 1; + var res : f16 = ldexp(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_624e0c(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_624e0c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_624e0c(); +} diff --git a/test/tint/builtins/gen/var/ldexp/7485ce.wgsl b/test/tint/builtins/gen/var/ldexp/7485ce.wgsl new file mode 100644 index 0000000000..8904fef899 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/7485ce.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn ldexp(vec<3, f16>, vec<3, i32>) -> vec<3, f16> +fn ldexp_7485ce() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(1); + var res: vec3 = ldexp(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_7485ce(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_7485ce(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_7485ce(); +} diff --git a/test/tint/builtins/gen/var/ldexp/7485ce.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/ldexp/7485ce.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ca8bf2bcac --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/7485ce.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void ldexp_7485ce() { + vector arg_0 = (float16_t(0.0h)).xxx; + int3 arg_1 = (1).xxx; + vector res = ldexp(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_7485ce(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_7485ce(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_7485ce(); + return; +} diff --git a/test/tint/builtins/gen/var/ldexp/7485ce.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/ldexp/7485ce.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fa06333971 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/7485ce.wgsl.expected.fxc.hlsl @@ -0,0 +1,38 @@ +SKIP: FAILED + +void ldexp_7485ce() { + vector arg_0 = (float16_t(0.0h)).xxx; + int3 arg_1 = (1).xxx; + vector res = ldexp(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_7485ce(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_7485ce(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_7485ce(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001553C486F80(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001553C486F80(4,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/ldexp/7485ce.wgsl.expected.glsl b/test/tint/builtins/gen/var/ldexp/7485ce.wgsl.expected.glsl new file mode 100644 index 0000000000..39204f5ac8 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/7485ce.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ldexp_7485ce() { + f16vec3 arg_0 = f16vec3(0.0hf); + ivec3 arg_1 = ivec3(1); + f16vec3 res = ldexp(arg_0, arg_1); +} + +vec4 vertex_main() { + ldexp_7485ce(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void ldexp_7485ce() { + f16vec3 arg_0 = f16vec3(0.0hf); + ivec3 arg_1 = ivec3(1); + f16vec3 res = ldexp(arg_0, arg_1); +} + +void fragment_main() { + ldexp_7485ce(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ldexp_7485ce() { + f16vec3 arg_0 = f16vec3(0.0hf); + ivec3 arg_1 = ivec3(1); + f16vec3 res = ldexp(arg_0, arg_1); +} + +void compute_main() { + ldexp_7485ce(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/ldexp/7485ce.wgsl.expected.msl b/test/tint/builtins/gen/var/ldexp/7485ce.wgsl.expected.msl new file mode 100644 index 0000000000..3475cb2467 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/7485ce.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void ldexp_7485ce() { + half3 arg_0 = half3(0.0h); + int3 arg_1 = int3(1); + half3 res = ldexp(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ldexp_7485ce(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ldexp_7485ce(); + return; +} + +kernel void compute_main() { + ldexp_7485ce(); + return; +} + diff --git a/test/tint/builtins/gen/var/ldexp/7485ce.wgsl.expected.spvasm b/test/tint/builtins/gen/var/ldexp/7485ce.wgsl.expected.spvasm new file mode 100644 index 0000000000..046509c282 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/7485ce.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %26 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ldexp_7485ce "ldexp_7485ce" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_1 = OpConstant %int 1 + %21 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %24 = OpConstantNull %v3int + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%ldexp_7485ce = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %arg_1 = OpVariable %_ptr_Function_v3int Function %24 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %21 + %27 = OpLoad %v3half %arg_0 + %28 = OpLoad %v3int %arg_1 + %25 = OpExtInst %v3half %26 Ldexp %27 %28 + OpStore %res %25 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %ldexp_7485ce + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %39 = OpLabel + %40 = OpFunctionCall %void %ldexp_7485ce + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %42 = OpLabel + %43 = OpFunctionCall %void %ldexp_7485ce + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/ldexp/7485ce.wgsl.expected.wgsl b/test/tint/builtins/gen/var/ldexp/7485ce.wgsl.expected.wgsl new file mode 100644 index 0000000000..004f279727 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/7485ce.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn ldexp_7485ce() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(1); + var res : vec3 = ldexp(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_7485ce(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_7485ce(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_7485ce(); +} diff --git a/test/tint/builtins/gen/var/ldexp/7fa13c.wgsl b/test/tint/builtins/gen/var/ldexp/7fa13c.wgsl new file mode 100644 index 0000000000..b5b562f70b --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/7fa13c.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn ldexp(vec<4, f16>, vec<4, i32>) -> vec<4, f16> +fn ldexp_7fa13c() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(1); + var res: vec4 = ldexp(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_7fa13c(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_7fa13c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_7fa13c(); +} diff --git a/test/tint/builtins/gen/var/ldexp/7fa13c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/ldexp/7fa13c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cd28414385 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/7fa13c.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void ldexp_7fa13c() { + vector arg_0 = (float16_t(0.0h)).xxxx; + int4 arg_1 = (1).xxxx; + vector res = ldexp(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_7fa13c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_7fa13c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_7fa13c(); + return; +} diff --git a/test/tint/builtins/gen/var/ldexp/7fa13c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/ldexp/7fa13c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..07506fca80 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/7fa13c.wgsl.expected.fxc.hlsl @@ -0,0 +1,38 @@ +SKIP: FAILED + +void ldexp_7fa13c() { + vector arg_0 = (float16_t(0.0h)).xxxx; + int4 arg_1 = (1).xxxx; + vector res = ldexp(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_7fa13c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_7fa13c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_7fa13c(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020AEA25D620(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020AEA25D620(4,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/ldexp/7fa13c.wgsl.expected.glsl b/test/tint/builtins/gen/var/ldexp/7fa13c.wgsl.expected.glsl new file mode 100644 index 0000000000..d447a14634 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/7fa13c.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ldexp_7fa13c() { + f16vec4 arg_0 = f16vec4(0.0hf); + ivec4 arg_1 = ivec4(1); + f16vec4 res = ldexp(arg_0, arg_1); +} + +vec4 vertex_main() { + ldexp_7fa13c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void ldexp_7fa13c() { + f16vec4 arg_0 = f16vec4(0.0hf); + ivec4 arg_1 = ivec4(1); + f16vec4 res = ldexp(arg_0, arg_1); +} + +void fragment_main() { + ldexp_7fa13c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ldexp_7fa13c() { + f16vec4 arg_0 = f16vec4(0.0hf); + ivec4 arg_1 = ivec4(1); + f16vec4 res = ldexp(arg_0, arg_1); +} + +void compute_main() { + ldexp_7fa13c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/ldexp/7fa13c.wgsl.expected.msl b/test/tint/builtins/gen/var/ldexp/7fa13c.wgsl.expected.msl new file mode 100644 index 0000000000..b4089fb7ad --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/7fa13c.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void ldexp_7fa13c() { + half4 arg_0 = half4(0.0h); + int4 arg_1 = int4(1); + half4 res = ldexp(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ldexp_7fa13c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ldexp_7fa13c(); + return; +} + +kernel void compute_main() { + ldexp_7fa13c(); + return; +} + diff --git a/test/tint/builtins/gen/var/ldexp/7fa13c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/ldexp/7fa13c.wgsl.expected.spvasm new file mode 100644 index 0000000000..1b6c20a73a --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/7fa13c.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %26 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ldexp_7fa13c "ldexp_7fa13c" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %int_1 = OpConstant %int 1 + %21 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %24 = OpConstantNull %v4int + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%ldexp_7fa13c = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %arg_1 = OpVariable %_ptr_Function_v4int Function %24 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %21 + %27 = OpLoad %v4half %arg_0 + %28 = OpLoad %v4int %arg_1 + %25 = OpExtInst %v4half %26 Ldexp %27 %28 + OpStore %res %25 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %ldexp_7fa13c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %39 = OpLabel + %40 = OpFunctionCall %void %ldexp_7fa13c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %42 = OpLabel + %43 = OpFunctionCall %void %ldexp_7fa13c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/ldexp/7fa13c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/ldexp/7fa13c.wgsl.expected.wgsl new file mode 100644 index 0000000000..350729e0fb --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/7fa13c.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn ldexp_7fa13c() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(1); + var res : vec4 = ldexp(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_7fa13c(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_7fa13c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_7fa13c(); +} diff --git a/test/tint/builtins/gen/var/length/3f0e13.wgsl b/test/tint/builtins/gen/var/length/3f0e13.wgsl new file mode 100644 index 0000000000..6aa251cab7 --- /dev/null +++ b/test/tint/builtins/gen/var/length/3f0e13.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn length(vec<2, f16>) -> f16 +fn length_3f0e13() { + var arg_0 = vec2(f16()); + var res: f16 = length(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_3f0e13(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_3f0e13(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_3f0e13(); +} diff --git a/test/tint/builtins/gen/var/length/3f0e13.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/length/3f0e13.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ef03b061f5 --- /dev/null +++ b/test/tint/builtins/gen/var/length/3f0e13.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void length_3f0e13() { + vector arg_0 = (float16_t(0.0h)).xx; + float16_t res = length(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_3f0e13(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_3f0e13(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_3f0e13(); + return; +} diff --git a/test/tint/builtins/gen/var/length/3f0e13.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/length/3f0e13.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..01eb8511c7 --- /dev/null +++ b/test/tint/builtins/gen/var/length/3f0e13.wgsl.expected.fxc.hlsl @@ -0,0 +1,38 @@ +SKIP: FAILED + +void length_3f0e13() { + vector arg_0 = (float16_t(0.0h)).xx; + float16_t res = length(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_3f0e13(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_3f0e13(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_3f0e13(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020BA93CCC20(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020BA93CCC20(3,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020BA93CCC20(3,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/var/length/3f0e13.wgsl.expected.glsl b/test/tint/builtins/gen/var/length/3f0e13.wgsl.expected.glsl new file mode 100644 index 0000000000..a5f2471c6d --- /dev/null +++ b/test/tint/builtins/gen/var/length/3f0e13.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void length_3f0e13() { + f16vec2 arg_0 = f16vec2(0.0hf); + float16_t res = length(arg_0); +} + +vec4 vertex_main() { + length_3f0e13(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void length_3f0e13() { + f16vec2 arg_0 = f16vec2(0.0hf); + float16_t res = length(arg_0); +} + +void fragment_main() { + length_3f0e13(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void length_3f0e13() { + f16vec2 arg_0 = f16vec2(0.0hf); + float16_t res = length(arg_0); +} + +void compute_main() { + length_3f0e13(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/length/3f0e13.wgsl.expected.msl b/test/tint/builtins/gen/var/length/3f0e13.wgsl.expected.msl new file mode 100644 index 0000000000..797b6fbc4f --- /dev/null +++ b/test/tint/builtins/gen/var/length/3f0e13.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void length_3f0e13() { + half2 arg_0 = half2(0.0h); + half res = length(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + length_3f0e13(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + length_3f0e13(); + return; +} + +kernel void compute_main() { + length_3f0e13(); + return; +} + diff --git a/test/tint/builtins/gen/var/length/3f0e13.wgsl.expected.spvasm b/test/tint/builtins/gen/var/length/3f0e13.wgsl.expected.spvasm new file mode 100644 index 0000000000..a92c3f18b1 --- /dev/null +++ b/test/tint/builtins/gen/var/length/3f0e13.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %length_3f0e13 "length_3f0e13" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half +%_ptr_Function_half = OpTypePointer Function %half + %23 = OpConstantNull %half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%length_3f0e13 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_half Function %23 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %half %19 Length %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %length_3f0e13 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %length_3f0e13 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %length_3f0e13 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/length/3f0e13.wgsl.expected.wgsl b/test/tint/builtins/gen/var/length/3f0e13.wgsl.expected.wgsl new file mode 100644 index 0000000000..317830d360 --- /dev/null +++ b/test/tint/builtins/gen/var/length/3f0e13.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn length_3f0e13() { + var arg_0 = vec2(f16()); + var res : f16 = length(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_3f0e13(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_3f0e13(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_3f0e13(); +} diff --git a/test/tint/builtins/gen/var/length/5b1a9b.wgsl b/test/tint/builtins/gen/var/length/5b1a9b.wgsl new file mode 100644 index 0000000000..9c495a7755 --- /dev/null +++ b/test/tint/builtins/gen/var/length/5b1a9b.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn length(vec<4, f16>) -> f16 +fn length_5b1a9b() { + var arg_0 = vec4(f16()); + var res: f16 = length(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_5b1a9b(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_5b1a9b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_5b1a9b(); +} diff --git a/test/tint/builtins/gen/var/length/5b1a9b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/length/5b1a9b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4865222bf3 --- /dev/null +++ b/test/tint/builtins/gen/var/length/5b1a9b.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void length_5b1a9b() { + vector arg_0 = (float16_t(0.0h)).xxxx; + float16_t res = length(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_5b1a9b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_5b1a9b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_5b1a9b(); + return; +} diff --git a/test/tint/builtins/gen/var/length/5b1a9b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/length/5b1a9b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4ea492e2b4 --- /dev/null +++ b/test/tint/builtins/gen/var/length/5b1a9b.wgsl.expected.fxc.hlsl @@ -0,0 +1,38 @@ +SKIP: FAILED + +void length_5b1a9b() { + vector arg_0 = (float16_t(0.0h)).xxxx; + float16_t res = length(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_5b1a9b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_5b1a9b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_5b1a9b(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001EF153A9D90(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001EF153A9D90(3,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001EF153A9D90(3,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/var/length/5b1a9b.wgsl.expected.glsl b/test/tint/builtins/gen/var/length/5b1a9b.wgsl.expected.glsl new file mode 100644 index 0000000000..75b0701773 --- /dev/null +++ b/test/tint/builtins/gen/var/length/5b1a9b.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void length_5b1a9b() { + f16vec4 arg_0 = f16vec4(0.0hf); + float16_t res = length(arg_0); +} + +vec4 vertex_main() { + length_5b1a9b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void length_5b1a9b() { + f16vec4 arg_0 = f16vec4(0.0hf); + float16_t res = length(arg_0); +} + +void fragment_main() { + length_5b1a9b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void length_5b1a9b() { + f16vec4 arg_0 = f16vec4(0.0hf); + float16_t res = length(arg_0); +} + +void compute_main() { + length_5b1a9b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/length/5b1a9b.wgsl.expected.msl b/test/tint/builtins/gen/var/length/5b1a9b.wgsl.expected.msl new file mode 100644 index 0000000000..885dd6662e --- /dev/null +++ b/test/tint/builtins/gen/var/length/5b1a9b.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void length_5b1a9b() { + half4 arg_0 = half4(0.0h); + half res = length(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + length_5b1a9b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + length_5b1a9b(); + return; +} + +kernel void compute_main() { + length_5b1a9b(); + return; +} + diff --git a/test/tint/builtins/gen/var/length/5b1a9b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/length/5b1a9b.wgsl.expected.spvasm new file mode 100644 index 0000000000..0d97afeb8d --- /dev/null +++ b/test/tint/builtins/gen/var/length/5b1a9b.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %length_5b1a9b "length_5b1a9b" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half +%_ptr_Function_half = OpTypePointer Function %half + %23 = OpConstantNull %half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%length_5b1a9b = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_half Function %23 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %half %19 Length %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %length_5b1a9b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %length_5b1a9b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %length_5b1a9b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/length/5b1a9b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/length/5b1a9b.wgsl.expected.wgsl new file mode 100644 index 0000000000..6e0095b9b4 --- /dev/null +++ b/test/tint/builtins/gen/var/length/5b1a9b.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn length_5b1a9b() { + var arg_0 = vec4(f16()); + var res : f16 = length(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_5b1a9b(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_5b1a9b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_5b1a9b(); +} diff --git a/test/tint/builtins/gen/var/length/ba16d6.wgsl b/test/tint/builtins/gen/var/length/ba16d6.wgsl new file mode 100644 index 0000000000..c45837edff --- /dev/null +++ b/test/tint/builtins/gen/var/length/ba16d6.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn length(vec<3, f16>) -> f16 +fn length_ba16d6() { + var arg_0 = vec3(f16()); + var res: f16 = length(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_ba16d6(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_ba16d6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_ba16d6(); +} diff --git a/test/tint/builtins/gen/var/length/ba16d6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/length/ba16d6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7480de09db --- /dev/null +++ b/test/tint/builtins/gen/var/length/ba16d6.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void length_ba16d6() { + vector arg_0 = (float16_t(0.0h)).xxx; + float16_t res = length(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_ba16d6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_ba16d6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_ba16d6(); + return; +} diff --git a/test/tint/builtins/gen/var/length/ba16d6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/length/ba16d6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1629874098 --- /dev/null +++ b/test/tint/builtins/gen/var/length/ba16d6.wgsl.expected.fxc.hlsl @@ -0,0 +1,38 @@ +SKIP: FAILED + +void length_ba16d6() { + vector arg_0 = (float16_t(0.0h)).xxx; + float16_t res = length(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_ba16d6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_ba16d6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_ba16d6(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002644DC827C0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002644DC827C0(3,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002644DC827C0(3,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/var/length/ba16d6.wgsl.expected.glsl b/test/tint/builtins/gen/var/length/ba16d6.wgsl.expected.glsl new file mode 100644 index 0000000000..ea04f30ef6 --- /dev/null +++ b/test/tint/builtins/gen/var/length/ba16d6.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void length_ba16d6() { + f16vec3 arg_0 = f16vec3(0.0hf); + float16_t res = length(arg_0); +} + +vec4 vertex_main() { + length_ba16d6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void length_ba16d6() { + f16vec3 arg_0 = f16vec3(0.0hf); + float16_t res = length(arg_0); +} + +void fragment_main() { + length_ba16d6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void length_ba16d6() { + f16vec3 arg_0 = f16vec3(0.0hf); + float16_t res = length(arg_0); +} + +void compute_main() { + length_ba16d6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/length/ba16d6.wgsl.expected.msl b/test/tint/builtins/gen/var/length/ba16d6.wgsl.expected.msl new file mode 100644 index 0000000000..54123fcd29 --- /dev/null +++ b/test/tint/builtins/gen/var/length/ba16d6.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void length_ba16d6() { + half3 arg_0 = half3(0.0h); + half res = length(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + length_ba16d6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + length_ba16d6(); + return; +} + +kernel void compute_main() { + length_ba16d6(); + return; +} + diff --git a/test/tint/builtins/gen/var/length/ba16d6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/length/ba16d6.wgsl.expected.spvasm new file mode 100644 index 0000000000..4ec76a0a73 --- /dev/null +++ b/test/tint/builtins/gen/var/length/ba16d6.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %length_ba16d6 "length_ba16d6" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half +%_ptr_Function_half = OpTypePointer Function %half + %23 = OpConstantNull %half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%length_ba16d6 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_half Function %23 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %half %19 Length %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %length_ba16d6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %length_ba16d6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %length_ba16d6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/length/ba16d6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/length/ba16d6.wgsl.expected.wgsl new file mode 100644 index 0000000000..9ad37a931d --- /dev/null +++ b/test/tint/builtins/gen/var/length/ba16d6.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn length_ba16d6() { + var arg_0 = vec3(f16()); + var res : f16 = length(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_ba16d6(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_ba16d6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_ba16d6(); +} diff --git a/test/tint/builtins/gen/var/length/c158da.wgsl b/test/tint/builtins/gen/var/length/c158da.wgsl new file mode 100644 index 0000000000..ce3f91f59f --- /dev/null +++ b/test/tint/builtins/gen/var/length/c158da.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn length(f16) -> f16 +fn length_c158da() { + var arg_0 = f16(); + var res: f16 = length(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_c158da(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_c158da(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_c158da(); +} diff --git a/test/tint/builtins/gen/var/length/c158da.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/length/c158da.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e8ad9f71a0 --- /dev/null +++ b/test/tint/builtins/gen/var/length/c158da.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void length_c158da() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = length(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_c158da(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_c158da(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_c158da(); + return; +} diff --git a/test/tint/builtins/gen/var/length/c158da.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/length/c158da.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ff57d0b231 --- /dev/null +++ b/test/tint/builtins/gen/var/length/c158da.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void length_c158da() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = length(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_c158da(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_c158da(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_c158da(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000229284770C0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000229284770C0(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/length/c158da.wgsl.expected.glsl b/test/tint/builtins/gen/var/length/c158da.wgsl.expected.glsl new file mode 100644 index 0000000000..023690cb16 --- /dev/null +++ b/test/tint/builtins/gen/var/length/c158da.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void length_c158da() { + float16_t arg_0 = 0.0hf; + float16_t res = length(arg_0); +} + +vec4 vertex_main() { + length_c158da(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void length_c158da() { + float16_t arg_0 = 0.0hf; + float16_t res = length(arg_0); +} + +void fragment_main() { + length_c158da(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void length_c158da() { + float16_t arg_0 = 0.0hf; + float16_t res = length(arg_0); +} + +void compute_main() { + length_c158da(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/length/c158da.wgsl.expected.msl b/test/tint/builtins/gen/var/length/c158da.wgsl.expected.msl new file mode 100644 index 0000000000..ea75d99360 --- /dev/null +++ b/test/tint/builtins/gen/var/length/c158da.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void length_c158da() { + half arg_0 = 0.0h; + half res = fabs(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + length_c158da(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + length_c158da(); + return; +} + +kernel void compute_main() { + length_c158da(); + return; +} + diff --git a/test/tint/builtins/gen/var/length/c158da.wgsl.expected.spvasm b/test/tint/builtins/gen/var/length/c158da.wgsl.expected.spvasm new file mode 100644 index 0000000000..5b14574943 --- /dev/null +++ b/test/tint/builtins/gen/var/length/c158da.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %length_c158da "length_c158da" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%length_c158da = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Length %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %length_c158da + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %length_c158da + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %length_c158da + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/length/c158da.wgsl.expected.wgsl b/test/tint/builtins/gen/var/length/c158da.wgsl.expected.wgsl new file mode 100644 index 0000000000..c86993b985 --- /dev/null +++ b/test/tint/builtins/gen/var/length/c158da.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn length_c158da() { + var arg_0 = f16(); + var res : f16 = length(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_c158da(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_c158da(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_c158da(); +} diff --git a/test/tint/builtins/gen/var/log/6ff86f.wgsl b/test/tint/builtins/gen/var/log/6ff86f.wgsl new file mode 100644 index 0000000000..c99e55d5ca --- /dev/null +++ b/test/tint/builtins/gen/var/log/6ff86f.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn log(vec<3, f16>) -> vec<3, f16> +fn log_6ff86f() { + var arg_0 = vec3(f16()); + var res: vec3 = log(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_6ff86f(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_6ff86f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_6ff86f(); +} diff --git a/test/tint/builtins/gen/var/log/6ff86f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/log/6ff86f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..992df89e07 --- /dev/null +++ b/test/tint/builtins/gen/var/log/6ff86f.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void log_6ff86f() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = log(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_6ff86f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_6ff86f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_6ff86f(); + return; +} diff --git a/test/tint/builtins/gen/var/log/6ff86f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/log/6ff86f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0ea573c830 --- /dev/null +++ b/test/tint/builtins/gen/var/log/6ff86f.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void log_6ff86f() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = log(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_6ff86f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_6ff86f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_6ff86f(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000029DD70F8770(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000029DD70F8770(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/log/6ff86f.wgsl.expected.glsl b/test/tint/builtins/gen/var/log/6ff86f.wgsl.expected.glsl new file mode 100644 index 0000000000..f4c8306889 --- /dev/null +++ b/test/tint/builtins/gen/var/log/6ff86f.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log_6ff86f() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = log(arg_0); +} + +vec4 vertex_main() { + log_6ff86f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void log_6ff86f() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = log(arg_0); +} + +void fragment_main() { + log_6ff86f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log_6ff86f() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = log(arg_0); +} + +void compute_main() { + log_6ff86f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/log/6ff86f.wgsl.expected.msl b/test/tint/builtins/gen/var/log/6ff86f.wgsl.expected.msl new file mode 100644 index 0000000000..941fcd6799 --- /dev/null +++ b/test/tint/builtins/gen/var/log/6ff86f.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void log_6ff86f() { + half3 arg_0 = half3(0.0h); + half3 res = log(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log_6ff86f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log_6ff86f(); + return; +} + +kernel void compute_main() { + log_6ff86f(); + return; +} + diff --git a/test/tint/builtins/gen/var/log/6ff86f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/log/6ff86f.wgsl.expected.spvasm new file mode 100644 index 0000000000..bc7f7de9a5 --- /dev/null +++ b/test/tint/builtins/gen/var/log/6ff86f.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log_6ff86f "log_6ff86f" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %log_6ff86f = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Log %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %log_6ff86f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %log_6ff86f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %log_6ff86f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/log/6ff86f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/log/6ff86f.wgsl.expected.wgsl new file mode 100644 index 0000000000..0f1a204fa2 --- /dev/null +++ b/test/tint/builtins/gen/var/log/6ff86f.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn log_6ff86f() { + var arg_0 = vec3(f16()); + var res : vec3 = log(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_6ff86f(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_6ff86f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_6ff86f(); +} diff --git a/test/tint/builtins/gen/var/log/8f0e32.wgsl b/test/tint/builtins/gen/var/log/8f0e32.wgsl new file mode 100644 index 0000000000..02a6f23118 --- /dev/null +++ b/test/tint/builtins/gen/var/log/8f0e32.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn log(vec<2, f16>) -> vec<2, f16> +fn log_8f0e32() { + var arg_0 = vec2(f16()); + var res: vec2 = log(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_8f0e32(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_8f0e32(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_8f0e32(); +} diff --git a/test/tint/builtins/gen/var/log/8f0e32.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/log/8f0e32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f17ddd1ff7 --- /dev/null +++ b/test/tint/builtins/gen/var/log/8f0e32.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void log_8f0e32() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = log(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_8f0e32(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_8f0e32(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_8f0e32(); + return; +} diff --git a/test/tint/builtins/gen/var/log/8f0e32.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/log/8f0e32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5c7cd72626 --- /dev/null +++ b/test/tint/builtins/gen/var/log/8f0e32.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void log_8f0e32() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = log(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_8f0e32(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_8f0e32(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_8f0e32(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002A51B8C05E0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002A51B8C05E0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/log/8f0e32.wgsl.expected.glsl b/test/tint/builtins/gen/var/log/8f0e32.wgsl.expected.glsl new file mode 100644 index 0000000000..5ed7deb5c9 --- /dev/null +++ b/test/tint/builtins/gen/var/log/8f0e32.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log_8f0e32() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = log(arg_0); +} + +vec4 vertex_main() { + log_8f0e32(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void log_8f0e32() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = log(arg_0); +} + +void fragment_main() { + log_8f0e32(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log_8f0e32() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = log(arg_0); +} + +void compute_main() { + log_8f0e32(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/log/8f0e32.wgsl.expected.msl b/test/tint/builtins/gen/var/log/8f0e32.wgsl.expected.msl new file mode 100644 index 0000000000..975ed6d159 --- /dev/null +++ b/test/tint/builtins/gen/var/log/8f0e32.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void log_8f0e32() { + half2 arg_0 = half2(0.0h); + half2 res = log(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log_8f0e32(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log_8f0e32(); + return; +} + +kernel void compute_main() { + log_8f0e32(); + return; +} + diff --git a/test/tint/builtins/gen/var/log/8f0e32.wgsl.expected.spvasm b/test/tint/builtins/gen/var/log/8f0e32.wgsl.expected.spvasm new file mode 100644 index 0000000000..06d9a8af7e --- /dev/null +++ b/test/tint/builtins/gen/var/log/8f0e32.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log_8f0e32 "log_8f0e32" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %log_8f0e32 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Log %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %log_8f0e32 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %log_8f0e32 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %log_8f0e32 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/log/8f0e32.wgsl.expected.wgsl b/test/tint/builtins/gen/var/log/8f0e32.wgsl.expected.wgsl new file mode 100644 index 0000000000..3e83d31132 --- /dev/null +++ b/test/tint/builtins/gen/var/log/8f0e32.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn log_8f0e32() { + var arg_0 = vec2(f16()); + var res : vec2 = log(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_8f0e32(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_8f0e32(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_8f0e32(); +} diff --git a/test/tint/builtins/gen/var/log/c9f489.wgsl b/test/tint/builtins/gen/var/log/c9f489.wgsl new file mode 100644 index 0000000000..cc94795d46 --- /dev/null +++ b/test/tint/builtins/gen/var/log/c9f489.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn log(f16) -> f16 +fn log_c9f489() { + var arg_0 = f16(); + var res: f16 = log(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_c9f489(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_c9f489(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_c9f489(); +} diff --git a/test/tint/builtins/gen/var/log/c9f489.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/log/c9f489.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f56a6b956f --- /dev/null +++ b/test/tint/builtins/gen/var/log/c9f489.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void log_c9f489() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = log(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_c9f489(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_c9f489(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_c9f489(); + return; +} diff --git a/test/tint/builtins/gen/var/log/c9f489.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/log/c9f489.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5929a1c109 --- /dev/null +++ b/test/tint/builtins/gen/var/log/c9f489.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void log_c9f489() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = log(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_c9f489(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_c9f489(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_c9f489(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000242D2E74480(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000242D2E74480(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/log/c9f489.wgsl.expected.glsl b/test/tint/builtins/gen/var/log/c9f489.wgsl.expected.glsl new file mode 100644 index 0000000000..ab6cf71b76 --- /dev/null +++ b/test/tint/builtins/gen/var/log/c9f489.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log_c9f489() { + float16_t arg_0 = 0.0hf; + float16_t res = log(arg_0); +} + +vec4 vertex_main() { + log_c9f489(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void log_c9f489() { + float16_t arg_0 = 0.0hf; + float16_t res = log(arg_0); +} + +void fragment_main() { + log_c9f489(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log_c9f489() { + float16_t arg_0 = 0.0hf; + float16_t res = log(arg_0); +} + +void compute_main() { + log_c9f489(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/log/c9f489.wgsl.expected.msl b/test/tint/builtins/gen/var/log/c9f489.wgsl.expected.msl new file mode 100644 index 0000000000..2f4c5434b2 --- /dev/null +++ b/test/tint/builtins/gen/var/log/c9f489.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void log_c9f489() { + half arg_0 = 0.0h; + half res = log(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log_c9f489(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log_c9f489(); + return; +} + +kernel void compute_main() { + log_c9f489(); + return; +} + diff --git a/test/tint/builtins/gen/var/log/c9f489.wgsl.expected.spvasm b/test/tint/builtins/gen/var/log/c9f489.wgsl.expected.spvasm new file mode 100644 index 0000000000..c2f50ce482 --- /dev/null +++ b/test/tint/builtins/gen/var/log/c9f489.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log_c9f489 "log_c9f489" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %log_c9f489 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Log %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %log_c9f489 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %log_c9f489 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %log_c9f489 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/log/c9f489.wgsl.expected.wgsl b/test/tint/builtins/gen/var/log/c9f489.wgsl.expected.wgsl new file mode 100644 index 0000000000..b4e30a39be --- /dev/null +++ b/test/tint/builtins/gen/var/log/c9f489.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn log_c9f489() { + var arg_0 = f16(); + var res : f16 = log(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_c9f489(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_c9f489(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_c9f489(); +} diff --git a/test/tint/builtins/gen/var/log/cdbdc1.wgsl b/test/tint/builtins/gen/var/log/cdbdc1.wgsl new file mode 100644 index 0000000000..18c4837e1f --- /dev/null +++ b/test/tint/builtins/gen/var/log/cdbdc1.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn log(vec<4, f16>) -> vec<4, f16> +fn log_cdbdc1() { + var arg_0 = vec4(f16()); + var res: vec4 = log(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_cdbdc1(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_cdbdc1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_cdbdc1(); +} diff --git a/test/tint/builtins/gen/var/log/cdbdc1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/log/cdbdc1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4416f3e944 --- /dev/null +++ b/test/tint/builtins/gen/var/log/cdbdc1.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void log_cdbdc1() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = log(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_cdbdc1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_cdbdc1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_cdbdc1(); + return; +} diff --git a/test/tint/builtins/gen/var/log/cdbdc1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/log/cdbdc1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..52bc9ae889 --- /dev/null +++ b/test/tint/builtins/gen/var/log/cdbdc1.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void log_cdbdc1() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = log(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_cdbdc1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_cdbdc1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_cdbdc1(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002F51ED070D0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002F51ED070D0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/log/cdbdc1.wgsl.expected.glsl b/test/tint/builtins/gen/var/log/cdbdc1.wgsl.expected.glsl new file mode 100644 index 0000000000..8f49855ec3 --- /dev/null +++ b/test/tint/builtins/gen/var/log/cdbdc1.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log_cdbdc1() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = log(arg_0); +} + +vec4 vertex_main() { + log_cdbdc1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void log_cdbdc1() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = log(arg_0); +} + +void fragment_main() { + log_cdbdc1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log_cdbdc1() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = log(arg_0); +} + +void compute_main() { + log_cdbdc1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/log/cdbdc1.wgsl.expected.msl b/test/tint/builtins/gen/var/log/cdbdc1.wgsl.expected.msl new file mode 100644 index 0000000000..e2e669ee3a --- /dev/null +++ b/test/tint/builtins/gen/var/log/cdbdc1.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void log_cdbdc1() { + half4 arg_0 = half4(0.0h); + half4 res = log(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log_cdbdc1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log_cdbdc1(); + return; +} + +kernel void compute_main() { + log_cdbdc1(); + return; +} + diff --git a/test/tint/builtins/gen/var/log/cdbdc1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/log/cdbdc1.wgsl.expected.spvasm new file mode 100644 index 0000000000..aebc066dab --- /dev/null +++ b/test/tint/builtins/gen/var/log/cdbdc1.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log_cdbdc1 "log_cdbdc1" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %log_cdbdc1 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Log %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %log_cdbdc1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %log_cdbdc1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %log_cdbdc1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/log/cdbdc1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/log/cdbdc1.wgsl.expected.wgsl new file mode 100644 index 0000000000..0ded9287ea --- /dev/null +++ b/test/tint/builtins/gen/var/log/cdbdc1.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn log_cdbdc1() { + var arg_0 = vec4(f16()); + var res : vec4 = log(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_cdbdc1(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_cdbdc1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_cdbdc1(); +} diff --git a/test/tint/builtins/gen/var/log2/38b478.wgsl b/test/tint/builtins/gen/var/log2/38b478.wgsl new file mode 100644 index 0000000000..9be143857b --- /dev/null +++ b/test/tint/builtins/gen/var/log2/38b478.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn log2(vec<3, f16>) -> vec<3, f16> +fn log2_38b478() { + var arg_0 = vec3(f16()); + var res: vec3 = log2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_38b478(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_38b478(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_38b478(); +} diff --git a/test/tint/builtins/gen/var/log2/38b478.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/log2/38b478.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..78a5e05291 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/38b478.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void log2_38b478() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = log2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_38b478(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_38b478(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_38b478(); + return; +} diff --git a/test/tint/builtins/gen/var/log2/38b478.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/log2/38b478.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2bdd2898a1 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/38b478.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void log2_38b478() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = log2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_38b478(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_38b478(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_38b478(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021830188770(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021830188770(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/log2/38b478.wgsl.expected.glsl b/test/tint/builtins/gen/var/log2/38b478.wgsl.expected.glsl new file mode 100644 index 0000000000..3b440c8085 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/38b478.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log2_38b478() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = log2(arg_0); +} + +vec4 vertex_main() { + log2_38b478(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void log2_38b478() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = log2(arg_0); +} + +void fragment_main() { + log2_38b478(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log2_38b478() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = log2(arg_0); +} + +void compute_main() { + log2_38b478(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/log2/38b478.wgsl.expected.msl b/test/tint/builtins/gen/var/log2/38b478.wgsl.expected.msl new file mode 100644 index 0000000000..86941bfb1f --- /dev/null +++ b/test/tint/builtins/gen/var/log2/38b478.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void log2_38b478() { + half3 arg_0 = half3(0.0h); + half3 res = log2(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log2_38b478(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log2_38b478(); + return; +} + +kernel void compute_main() { + log2_38b478(); + return; +} + diff --git a/test/tint/builtins/gen/var/log2/38b478.wgsl.expected.spvasm b/test/tint/builtins/gen/var/log2/38b478.wgsl.expected.spvasm new file mode 100644 index 0000000000..f44bd997c1 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/38b478.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log2_38b478 "log2_38b478" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%log2_38b478 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Log2 %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %log2_38b478 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %log2_38b478 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %log2_38b478 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/log2/38b478.wgsl.expected.wgsl b/test/tint/builtins/gen/var/log2/38b478.wgsl.expected.wgsl new file mode 100644 index 0000000000..5564f08cb1 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/38b478.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn log2_38b478() { + var arg_0 = vec3(f16()); + var res : vec3 = log2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_38b478(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_38b478(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_38b478(); +} diff --git a/test/tint/builtins/gen/var/log2/776088.wgsl b/test/tint/builtins/gen/var/log2/776088.wgsl new file mode 100644 index 0000000000..cff82b7344 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/776088.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn log2(vec<4, f16>) -> vec<4, f16> +fn log2_776088() { + var arg_0 = vec4(f16()); + var res: vec4 = log2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_776088(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_776088(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_776088(); +} diff --git a/test/tint/builtins/gen/var/log2/776088.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/log2/776088.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ddbb999d45 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/776088.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void log2_776088() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = log2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_776088(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_776088(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_776088(); + return; +} diff --git a/test/tint/builtins/gen/var/log2/776088.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/log2/776088.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..64e5e4a2f0 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/776088.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void log2_776088() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = log2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_776088(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_776088(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_776088(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001FF2A6D2B50(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001FF2A6D2B50(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/log2/776088.wgsl.expected.glsl b/test/tint/builtins/gen/var/log2/776088.wgsl.expected.glsl new file mode 100644 index 0000000000..a4c554489e --- /dev/null +++ b/test/tint/builtins/gen/var/log2/776088.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log2_776088() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = log2(arg_0); +} + +vec4 vertex_main() { + log2_776088(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void log2_776088() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = log2(arg_0); +} + +void fragment_main() { + log2_776088(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log2_776088() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = log2(arg_0); +} + +void compute_main() { + log2_776088(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/log2/776088.wgsl.expected.msl b/test/tint/builtins/gen/var/log2/776088.wgsl.expected.msl new file mode 100644 index 0000000000..856c87bf55 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/776088.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void log2_776088() { + half4 arg_0 = half4(0.0h); + half4 res = log2(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log2_776088(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log2_776088(); + return; +} + +kernel void compute_main() { + log2_776088(); + return; +} + diff --git a/test/tint/builtins/gen/var/log2/776088.wgsl.expected.spvasm b/test/tint/builtins/gen/var/log2/776088.wgsl.expected.spvasm new file mode 100644 index 0000000000..0ed06cd53e --- /dev/null +++ b/test/tint/builtins/gen/var/log2/776088.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log2_776088 "log2_776088" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%log2_776088 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Log2 %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %log2_776088 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %log2_776088 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %log2_776088 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/log2/776088.wgsl.expected.wgsl b/test/tint/builtins/gen/var/log2/776088.wgsl.expected.wgsl new file mode 100644 index 0000000000..63b699d474 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/776088.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn log2_776088() { + var arg_0 = vec4(f16()); + var res : vec4 = log2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_776088(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_776088(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_776088(); +} diff --git a/test/tint/builtins/gen/var/log2/8c10b3.wgsl b/test/tint/builtins/gen/var/log2/8c10b3.wgsl new file mode 100644 index 0000000000..7a838bdb98 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/8c10b3.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn log2(f16) -> f16 +fn log2_8c10b3() { + var arg_0 = f16(); + var res: f16 = log2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_8c10b3(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_8c10b3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_8c10b3(); +} diff --git a/test/tint/builtins/gen/var/log2/8c10b3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/log2/8c10b3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..538dbfcdfd --- /dev/null +++ b/test/tint/builtins/gen/var/log2/8c10b3.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void log2_8c10b3() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = log2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_8c10b3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_8c10b3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_8c10b3(); + return; +} diff --git a/test/tint/builtins/gen/var/log2/8c10b3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/log2/8c10b3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d5a8f482e0 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/8c10b3.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void log2_8c10b3() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = log2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_8c10b3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_8c10b3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_8c10b3(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002320D6B2E20(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002320D6B2E20(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/log2/8c10b3.wgsl.expected.glsl b/test/tint/builtins/gen/var/log2/8c10b3.wgsl.expected.glsl new file mode 100644 index 0000000000..dc3f0f7a38 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/8c10b3.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log2_8c10b3() { + float16_t arg_0 = 0.0hf; + float16_t res = log2(arg_0); +} + +vec4 vertex_main() { + log2_8c10b3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void log2_8c10b3() { + float16_t arg_0 = 0.0hf; + float16_t res = log2(arg_0); +} + +void fragment_main() { + log2_8c10b3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log2_8c10b3() { + float16_t arg_0 = 0.0hf; + float16_t res = log2(arg_0); +} + +void compute_main() { + log2_8c10b3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/log2/8c10b3.wgsl.expected.msl b/test/tint/builtins/gen/var/log2/8c10b3.wgsl.expected.msl new file mode 100644 index 0000000000..4f7aa2e066 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/8c10b3.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void log2_8c10b3() { + half arg_0 = 0.0h; + half res = log2(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log2_8c10b3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log2_8c10b3(); + return; +} + +kernel void compute_main() { + log2_8c10b3(); + return; +} + diff --git a/test/tint/builtins/gen/var/log2/8c10b3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/log2/8c10b3.wgsl.expected.spvasm new file mode 100644 index 0000000000..f280c63a73 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/8c10b3.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log2_8c10b3 "log2_8c10b3" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%log2_8c10b3 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Log2 %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %log2_8c10b3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %log2_8c10b3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %log2_8c10b3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/log2/8c10b3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/log2/8c10b3.wgsl.expected.wgsl new file mode 100644 index 0000000000..8deaff1a00 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/8c10b3.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn log2_8c10b3() { + var arg_0 = f16(); + var res : f16 = log2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_8c10b3(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_8c10b3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_8c10b3(); +} diff --git a/test/tint/builtins/gen/var/log2/fb9f0b.wgsl b/test/tint/builtins/gen/var/log2/fb9f0b.wgsl new file mode 100644 index 0000000000..48d01f651f --- /dev/null +++ b/test/tint/builtins/gen/var/log2/fb9f0b.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn log2(vec<2, f16>) -> vec<2, f16> +fn log2_fb9f0b() { + var arg_0 = vec2(f16()); + var res: vec2 = log2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_fb9f0b(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_fb9f0b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_fb9f0b(); +} diff --git a/test/tint/builtins/gen/var/log2/fb9f0b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/log2/fb9f0b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f99f7bfaaf --- /dev/null +++ b/test/tint/builtins/gen/var/log2/fb9f0b.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void log2_fb9f0b() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = log2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_fb9f0b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_fb9f0b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_fb9f0b(); + return; +} diff --git a/test/tint/builtins/gen/var/log2/fb9f0b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/log2/fb9f0b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c6e2e2b382 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/fb9f0b.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void log2_fb9f0b() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = log2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_fb9f0b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_fb9f0b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_fb9f0b(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000196C422E8F0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000196C422E8F0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/log2/fb9f0b.wgsl.expected.glsl b/test/tint/builtins/gen/var/log2/fb9f0b.wgsl.expected.glsl new file mode 100644 index 0000000000..0676b9f646 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/fb9f0b.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log2_fb9f0b() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = log2(arg_0); +} + +vec4 vertex_main() { + log2_fb9f0b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void log2_fb9f0b() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = log2(arg_0); +} + +void fragment_main() { + log2_fb9f0b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log2_fb9f0b() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = log2(arg_0); +} + +void compute_main() { + log2_fb9f0b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/log2/fb9f0b.wgsl.expected.msl b/test/tint/builtins/gen/var/log2/fb9f0b.wgsl.expected.msl new file mode 100644 index 0000000000..dc1c78f701 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/fb9f0b.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void log2_fb9f0b() { + half2 arg_0 = half2(0.0h); + half2 res = log2(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log2_fb9f0b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log2_fb9f0b(); + return; +} + +kernel void compute_main() { + log2_fb9f0b(); + return; +} + diff --git a/test/tint/builtins/gen/var/log2/fb9f0b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/log2/fb9f0b.wgsl.expected.spvasm new file mode 100644 index 0000000000..35cba68846 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/fb9f0b.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log2_fb9f0b "log2_fb9f0b" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%log2_fb9f0b = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Log2 %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %log2_fb9f0b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %log2_fb9f0b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %log2_fb9f0b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/log2/fb9f0b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/log2/fb9f0b.wgsl.expected.wgsl new file mode 100644 index 0000000000..fe9342f278 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/fb9f0b.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn log2_fb9f0b() { + var arg_0 = vec2(f16()); + var res : vec2 = log2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_fb9f0b(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_fb9f0b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_fb9f0b(); +} diff --git a/test/tint/builtins/gen/var/max/111ac0.wgsl b/test/tint/builtins/gen/var/max/111ac0.wgsl new file mode 100644 index 0000000000..95fe46e5b4 --- /dev/null +++ b/test/tint/builtins/gen/var/max/111ac0.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn max(f16, f16) -> f16 +fn max_111ac0() { + var arg_0 = f16(); + var arg_1 = f16(); + var res: f16 = max(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_111ac0(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_111ac0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_111ac0(); +} diff --git a/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..96099f3b67 --- /dev/null +++ b/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void max_111ac0() { + float16_t arg_0 = float16_t(0.0h); + float16_t arg_1 = float16_t(0.0h); + float16_t res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_111ac0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_111ac0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_111ac0(); + return; +} diff --git a/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..15b4bffc5d --- /dev/null +++ b/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.fxc.hlsl @@ -0,0 +1,38 @@ +SKIP: FAILED + +void max_111ac0() { + float16_t arg_0 = float16_t(0.0h); + float16_t arg_1 = float16_t(0.0h); + float16_t res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_111ac0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_111ac0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_111ac0(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000261ECC86E70(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000261ECC86E70(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.glsl new file mode 100644 index 0000000000..e765053e29 --- /dev/null +++ b/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void max_111ac0() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t res = max(arg_0, arg_1); +} + +vec4 vertex_main() { + max_111ac0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void max_111ac0() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t res = max(arg_0, arg_1); +} + +void fragment_main() { + max_111ac0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void max_111ac0() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t res = max(arg_0, arg_1); +} + +void compute_main() { + max_111ac0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.msl b/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.msl new file mode 100644 index 0000000000..429db67325 --- /dev/null +++ b/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void max_111ac0() { + half arg_0 = 0.0h; + half arg_1 = 0.0h; + half res = fmax(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_111ac0(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_111ac0(); + return; +} + +kernel void compute_main() { + max_111ac0(); + return; +} + diff --git a/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.spvasm new file mode 100644 index 0000000000..379f8c7c33 --- /dev/null +++ b/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_111ac0 "max_111ac0" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %max_111ac0 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %arg_1 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + %20 = OpLoad %half %arg_0 + %21 = OpLoad %half %arg_1 + %18 = OpExtInst %half %19 NMax %20 %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %max_111ac0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %max_111ac0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %max_111ac0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.wgsl new file mode 100644 index 0000000000..b91b325904 --- /dev/null +++ b/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn max_111ac0() { + var arg_0 = f16(); + var arg_1 = f16(); + var res : f16 = max(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_111ac0(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_111ac0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_111ac0(); +} diff --git a/test/tint/builtins/gen/var/max/34956e.wgsl b/test/tint/builtins/gen/var/max/34956e.wgsl new file mode 100644 index 0000000000..600a3eb34a --- /dev/null +++ b/test/tint/builtins/gen/var/max/34956e.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn max(vec<2, f16>, vec<2, f16>) -> vec<2, f16> +fn max_34956e() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var res: vec2 = max(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_34956e(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_34956e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_34956e(); +} diff --git a/test/tint/builtins/gen/var/max/34956e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/max/34956e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..60c2e2f19f --- /dev/null +++ b/test/tint/builtins/gen/var/max/34956e.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void max_34956e() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + vector res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_34956e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_34956e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_34956e(); + return; +} diff --git a/test/tint/builtins/gen/var/max/34956e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/max/34956e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6402eb7fff --- /dev/null +++ b/test/tint/builtins/gen/var/max/34956e.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void max_34956e() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + vector res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_34956e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_34956e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_34956e(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024F90CA9900(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024F90CA9900(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024F90CA9900(4,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/max/34956e.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/34956e.wgsl.expected.glsl new file mode 100644 index 0000000000..93be2e6c61 --- /dev/null +++ b/test/tint/builtins/gen/var/max/34956e.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void max_34956e() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 res = max(arg_0, arg_1); +} + +vec4 vertex_main() { + max_34956e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void max_34956e() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 res = max(arg_0, arg_1); +} + +void fragment_main() { + max_34956e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void max_34956e() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 res = max(arg_0, arg_1); +} + +void compute_main() { + max_34956e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/max/34956e.wgsl.expected.msl b/test/tint/builtins/gen/var/max/34956e.wgsl.expected.msl new file mode 100644 index 0000000000..c90bfebda7 --- /dev/null +++ b/test/tint/builtins/gen/var/max/34956e.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void max_34956e() { + half2 arg_0 = half2(0.0h); + half2 arg_1 = half2(0.0h); + half2 res = fmax(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_34956e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_34956e(); + return; +} + +kernel void compute_main() { + max_34956e(); + return; +} + diff --git a/test/tint/builtins/gen/var/max/34956e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/34956e.wgsl.expected.spvasm new file mode 100644 index 0000000000..f63b8cd689 --- /dev/null +++ b/test/tint/builtins/gen/var/max/34956e.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_34956e "max_34956e" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %max_34956e = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %arg_1 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v2half %arg_0 + %22 = OpLoad %v2half %arg_1 + %19 = OpExtInst %v2half %20 NMax %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %max_34956e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %max_34956e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %max_34956e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/max/34956e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/34956e.wgsl.expected.wgsl new file mode 100644 index 0000000000..69327a8f55 --- /dev/null +++ b/test/tint/builtins/gen/var/max/34956e.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn max_34956e() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var res : vec2 = max(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_34956e(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_34956e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_34956e(); +} diff --git a/test/tint/builtins/gen/var/max/445169.wgsl b/test/tint/builtins/gen/var/max/445169.wgsl new file mode 100644 index 0000000000..24aad6114a --- /dev/null +++ b/test/tint/builtins/gen/var/max/445169.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn max(vec<3, f16>, vec<3, f16>) -> vec<3, f16> +fn max_445169() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var res: vec3 = max(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_445169(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_445169(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_445169(); +} diff --git a/test/tint/builtins/gen/var/max/445169.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/max/445169.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4b65af3400 --- /dev/null +++ b/test/tint/builtins/gen/var/max/445169.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void max_445169() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_445169(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_445169(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_445169(); + return; +} diff --git a/test/tint/builtins/gen/var/max/445169.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/max/445169.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3f48199b30 --- /dev/null +++ b/test/tint/builtins/gen/var/max/445169.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void max_445169() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_445169(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_445169(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_445169(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001DB65BB6D70(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001DB65BB6D70(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001DB65BB6D70(4,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/max/445169.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/445169.wgsl.expected.glsl new file mode 100644 index 0000000000..a524e0f279 --- /dev/null +++ b/test/tint/builtins/gen/var/max/445169.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void max_445169() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 res = max(arg_0, arg_1); +} + +vec4 vertex_main() { + max_445169(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void max_445169() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 res = max(arg_0, arg_1); +} + +void fragment_main() { + max_445169(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void max_445169() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 res = max(arg_0, arg_1); +} + +void compute_main() { + max_445169(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/max/445169.wgsl.expected.msl b/test/tint/builtins/gen/var/max/445169.wgsl.expected.msl new file mode 100644 index 0000000000..3f2fe1ea2a --- /dev/null +++ b/test/tint/builtins/gen/var/max/445169.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void max_445169() { + half3 arg_0 = half3(0.0h); + half3 arg_1 = half3(0.0h); + half3 res = fmax(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_445169(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_445169(); + return; +} + +kernel void compute_main() { + max_445169(); + return; +} + diff --git a/test/tint/builtins/gen/var/max/445169.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/445169.wgsl.expected.spvasm new file mode 100644 index 0000000000..5a3366ef32 --- /dev/null +++ b/test/tint/builtins/gen/var/max/445169.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_445169 "max_445169" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %max_445169 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %arg_1 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v3half %arg_0 + %22 = OpLoad %v3half %arg_1 + %19 = OpExtInst %v3half %20 NMax %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %max_445169 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %max_445169 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %max_445169 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/max/445169.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/445169.wgsl.expected.wgsl new file mode 100644 index 0000000000..e21636f485 --- /dev/null +++ b/test/tint/builtins/gen/var/max/445169.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn max_445169() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var res : vec3 = max(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_445169(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_445169(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_445169(); +} diff --git a/test/tint/builtins/gen/var/max/e14f2b.wgsl b/test/tint/builtins/gen/var/max/e14f2b.wgsl new file mode 100644 index 0000000000..12fd3d9a48 --- /dev/null +++ b/test/tint/builtins/gen/var/max/e14f2b.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn max(vec<4, f16>, vec<4, f16>) -> vec<4, f16> +fn max_e14f2b() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var res: vec4 = max(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_e14f2b(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_e14f2b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_e14f2b(); +} diff --git a/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c0f6659fd2 --- /dev/null +++ b/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void max_e14f2b() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + vector res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_e14f2b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_e14f2b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_e14f2b(); + return; +} diff --git a/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1251ca9005 --- /dev/null +++ b/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void max_e14f2b() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + vector res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_e14f2b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_e14f2b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_e14f2b(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000026D512195F0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000026D512195F0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000026D512195F0(4,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.glsl new file mode 100644 index 0000000000..9c13143714 --- /dev/null +++ b/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void max_e14f2b() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 res = max(arg_0, arg_1); +} + +vec4 vertex_main() { + max_e14f2b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void max_e14f2b() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 res = max(arg_0, arg_1); +} + +void fragment_main() { + max_e14f2b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void max_e14f2b() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 res = max(arg_0, arg_1); +} + +void compute_main() { + max_e14f2b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.msl b/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.msl new file mode 100644 index 0000000000..4410e6fff5 --- /dev/null +++ b/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void max_e14f2b() { + half4 arg_0 = half4(0.0h); + half4 arg_1 = half4(0.0h); + half4 res = fmax(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_e14f2b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_e14f2b(); + return; +} + +kernel void compute_main() { + max_e14f2b(); + return; +} + diff --git a/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.spvasm new file mode 100644 index 0000000000..99fc971989 --- /dev/null +++ b/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_e14f2b "max_e14f2b" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %max_e14f2b = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %arg_1 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v4half %arg_0 + %22 = OpLoad %v4half %arg_1 + %19 = OpExtInst %v4half %20 NMax %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %max_e14f2b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %max_e14f2b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %max_e14f2b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.wgsl new file mode 100644 index 0000000000..446f509ff3 --- /dev/null +++ b/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn max_e14f2b() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var res : vec4 = max(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_e14f2b(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_e14f2b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_e14f2b(); +} diff --git a/test/tint/builtins/gen/var/min/7c710a.wgsl b/test/tint/builtins/gen/var/min/7c710a.wgsl new file mode 100644 index 0000000000..1ccd54e62c --- /dev/null +++ b/test/tint/builtins/gen/var/min/7c710a.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn min(vec<4, f16>, vec<4, f16>) -> vec<4, f16> +fn min_7c710a() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var res: vec4 = min(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_7c710a(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_7c710a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_7c710a(); +} diff --git a/test/tint/builtins/gen/var/min/7c710a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/min/7c710a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c47899a2ae --- /dev/null +++ b/test/tint/builtins/gen/var/min/7c710a.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void min_7c710a() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + vector res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_7c710a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_7c710a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_7c710a(); + return; +} diff --git a/test/tint/builtins/gen/var/min/7c710a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/min/7c710a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1e7afd77ca --- /dev/null +++ b/test/tint/builtins/gen/var/min/7c710a.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void min_7c710a() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + vector res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_7c710a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_7c710a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_7c710a(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000019DCD0014A0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000019DCD0014A0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000019DCD0014A0(4,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/min/7c710a.wgsl.expected.glsl b/test/tint/builtins/gen/var/min/7c710a.wgsl.expected.glsl new file mode 100644 index 0000000000..e7acfb3b56 --- /dev/null +++ b/test/tint/builtins/gen/var/min/7c710a.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void min_7c710a() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 res = min(arg_0, arg_1); +} + +vec4 vertex_main() { + min_7c710a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void min_7c710a() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 res = min(arg_0, arg_1); +} + +void fragment_main() { + min_7c710a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void min_7c710a() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 res = min(arg_0, arg_1); +} + +void compute_main() { + min_7c710a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/min/7c710a.wgsl.expected.msl b/test/tint/builtins/gen/var/min/7c710a.wgsl.expected.msl new file mode 100644 index 0000000000..c3ccbdc0af --- /dev/null +++ b/test/tint/builtins/gen/var/min/7c710a.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void min_7c710a() { + half4 arg_0 = half4(0.0h); + half4 arg_1 = half4(0.0h); + half4 res = fmin(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_7c710a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_7c710a(); + return; +} + +kernel void compute_main() { + min_7c710a(); + return; +} + diff --git a/test/tint/builtins/gen/var/min/7c710a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/min/7c710a.wgsl.expected.spvasm new file mode 100644 index 0000000000..d8aff45213 --- /dev/null +++ b/test/tint/builtins/gen/var/min/7c710a.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_7c710a "min_7c710a" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %min_7c710a = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %arg_1 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v4half %arg_0 + %22 = OpLoad %v4half %arg_1 + %19 = OpExtInst %v4half %20 NMin %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %min_7c710a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %min_7c710a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %min_7c710a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/min/7c710a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/min/7c710a.wgsl.expected.wgsl new file mode 100644 index 0000000000..24aba2c2e4 --- /dev/null +++ b/test/tint/builtins/gen/var/min/7c710a.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn min_7c710a() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var res : vec4 = min(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_7c710a(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_7c710a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_7c710a(); +} diff --git a/test/tint/builtins/gen/var/min/ab0acd.wgsl b/test/tint/builtins/gen/var/min/ab0acd.wgsl new file mode 100644 index 0000000000..ea0e29c650 --- /dev/null +++ b/test/tint/builtins/gen/var/min/ab0acd.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn min(vec<3, f16>, vec<3, f16>) -> vec<3, f16> +fn min_ab0acd() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var res: vec3 = min(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_ab0acd(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_ab0acd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_ab0acd(); +} diff --git a/test/tint/builtins/gen/var/min/ab0acd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/min/ab0acd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..10c5fadb0c --- /dev/null +++ b/test/tint/builtins/gen/var/min/ab0acd.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void min_ab0acd() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_ab0acd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_ab0acd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_ab0acd(); + return; +} diff --git a/test/tint/builtins/gen/var/min/ab0acd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/min/ab0acd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5da4fb593f --- /dev/null +++ b/test/tint/builtins/gen/var/min/ab0acd.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void min_ab0acd() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_ab0acd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_ab0acd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_ab0acd(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000019AECEC2DB0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000019AECEC2DB0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000019AECEC2DB0(4,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/min/ab0acd.wgsl.expected.glsl b/test/tint/builtins/gen/var/min/ab0acd.wgsl.expected.glsl new file mode 100644 index 0000000000..a8dfcfc241 --- /dev/null +++ b/test/tint/builtins/gen/var/min/ab0acd.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void min_ab0acd() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 res = min(arg_0, arg_1); +} + +vec4 vertex_main() { + min_ab0acd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void min_ab0acd() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 res = min(arg_0, arg_1); +} + +void fragment_main() { + min_ab0acd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void min_ab0acd() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 res = min(arg_0, arg_1); +} + +void compute_main() { + min_ab0acd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/min/ab0acd.wgsl.expected.msl b/test/tint/builtins/gen/var/min/ab0acd.wgsl.expected.msl new file mode 100644 index 0000000000..ecf13e6f4b --- /dev/null +++ b/test/tint/builtins/gen/var/min/ab0acd.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void min_ab0acd() { + half3 arg_0 = half3(0.0h); + half3 arg_1 = half3(0.0h); + half3 res = fmin(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_ab0acd(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_ab0acd(); + return; +} + +kernel void compute_main() { + min_ab0acd(); + return; +} + diff --git a/test/tint/builtins/gen/var/min/ab0acd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/min/ab0acd.wgsl.expected.spvasm new file mode 100644 index 0000000000..c3695bc6c4 --- /dev/null +++ b/test/tint/builtins/gen/var/min/ab0acd.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_ab0acd "min_ab0acd" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %min_ab0acd = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %arg_1 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v3half %arg_0 + %22 = OpLoad %v3half %arg_1 + %19 = OpExtInst %v3half %20 NMin %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %min_ab0acd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %min_ab0acd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %min_ab0acd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/min/ab0acd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/min/ab0acd.wgsl.expected.wgsl new file mode 100644 index 0000000000..2c941443dc --- /dev/null +++ b/test/tint/builtins/gen/var/min/ab0acd.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn min_ab0acd() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var res : vec3 = min(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_ab0acd(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_ab0acd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_ab0acd(); +} diff --git a/test/tint/builtins/gen/var/min/ac84d6.wgsl b/test/tint/builtins/gen/var/min/ac84d6.wgsl new file mode 100644 index 0000000000..8166c17b83 --- /dev/null +++ b/test/tint/builtins/gen/var/min/ac84d6.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn min(f16, f16) -> f16 +fn min_ac84d6() { + var arg_0 = f16(); + var arg_1 = f16(); + var res: f16 = min(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_ac84d6(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_ac84d6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_ac84d6(); +} diff --git a/test/tint/builtins/gen/var/min/ac84d6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/min/ac84d6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..62864ef558 --- /dev/null +++ b/test/tint/builtins/gen/var/min/ac84d6.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void min_ac84d6() { + float16_t arg_0 = float16_t(0.0h); + float16_t arg_1 = float16_t(0.0h); + float16_t res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_ac84d6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_ac84d6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_ac84d6(); + return; +} diff --git a/test/tint/builtins/gen/var/min/ac84d6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/min/ac84d6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..77aa23fffe --- /dev/null +++ b/test/tint/builtins/gen/var/min/ac84d6.wgsl.expected.fxc.hlsl @@ -0,0 +1,38 @@ +SKIP: FAILED + +void min_ac84d6() { + float16_t arg_0 = float16_t(0.0h); + float16_t arg_1 = float16_t(0.0h); + float16_t res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_ac84d6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_ac84d6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_ac84d6(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000216706F6E70(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000216706F6E70(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/min/ac84d6.wgsl.expected.glsl b/test/tint/builtins/gen/var/min/ac84d6.wgsl.expected.glsl new file mode 100644 index 0000000000..e0ca81b8c2 --- /dev/null +++ b/test/tint/builtins/gen/var/min/ac84d6.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void min_ac84d6() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t res = min(arg_0, arg_1); +} + +vec4 vertex_main() { + min_ac84d6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void min_ac84d6() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t res = min(arg_0, arg_1); +} + +void fragment_main() { + min_ac84d6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void min_ac84d6() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t res = min(arg_0, arg_1); +} + +void compute_main() { + min_ac84d6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/min/ac84d6.wgsl.expected.msl b/test/tint/builtins/gen/var/min/ac84d6.wgsl.expected.msl new file mode 100644 index 0000000000..c8f31e2327 --- /dev/null +++ b/test/tint/builtins/gen/var/min/ac84d6.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void min_ac84d6() { + half arg_0 = 0.0h; + half arg_1 = 0.0h; + half res = fmin(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_ac84d6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_ac84d6(); + return; +} + +kernel void compute_main() { + min_ac84d6(); + return; +} + diff --git a/test/tint/builtins/gen/var/min/ac84d6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/min/ac84d6.wgsl.expected.spvasm new file mode 100644 index 0000000000..3f048ea8c7 --- /dev/null +++ b/test/tint/builtins/gen/var/min/ac84d6.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_ac84d6 "min_ac84d6" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %min_ac84d6 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %arg_1 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + %20 = OpLoad %half %arg_0 + %21 = OpLoad %half %arg_1 + %18 = OpExtInst %half %19 NMin %20 %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %min_ac84d6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %min_ac84d6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %min_ac84d6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/min/ac84d6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/min/ac84d6.wgsl.expected.wgsl new file mode 100644 index 0000000000..508794c237 --- /dev/null +++ b/test/tint/builtins/gen/var/min/ac84d6.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn min_ac84d6() { + var arg_0 = f16(); + var arg_1 = f16(); + var res : f16 = min(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_ac84d6(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_ac84d6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_ac84d6(); +} diff --git a/test/tint/builtins/gen/var/min/e780f9.wgsl b/test/tint/builtins/gen/var/min/e780f9.wgsl new file mode 100644 index 0000000000..58e70eb280 --- /dev/null +++ b/test/tint/builtins/gen/var/min/e780f9.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn min(vec<2, f16>, vec<2, f16>) -> vec<2, f16> +fn min_e780f9() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var res: vec2 = min(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_e780f9(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_e780f9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_e780f9(); +} diff --git a/test/tint/builtins/gen/var/min/e780f9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/min/e780f9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b2b207d346 --- /dev/null +++ b/test/tint/builtins/gen/var/min/e780f9.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void min_e780f9() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + vector res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_e780f9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_e780f9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_e780f9(); + return; +} diff --git a/test/tint/builtins/gen/var/min/e780f9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/min/e780f9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7a24d5deb5 --- /dev/null +++ b/test/tint/builtins/gen/var/min/e780f9.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void min_e780f9() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + vector res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_e780f9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_e780f9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_e780f9(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C199F46BD0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C199F46BD0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C199F46BD0(4,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/min/e780f9.wgsl.expected.glsl b/test/tint/builtins/gen/var/min/e780f9.wgsl.expected.glsl new file mode 100644 index 0000000000..7942c5eae6 --- /dev/null +++ b/test/tint/builtins/gen/var/min/e780f9.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void min_e780f9() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 res = min(arg_0, arg_1); +} + +vec4 vertex_main() { + min_e780f9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void min_e780f9() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 res = min(arg_0, arg_1); +} + +void fragment_main() { + min_e780f9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void min_e780f9() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 res = min(arg_0, arg_1); +} + +void compute_main() { + min_e780f9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/min/e780f9.wgsl.expected.msl b/test/tint/builtins/gen/var/min/e780f9.wgsl.expected.msl new file mode 100644 index 0000000000..49649a3c4f --- /dev/null +++ b/test/tint/builtins/gen/var/min/e780f9.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void min_e780f9() { + half2 arg_0 = half2(0.0h); + half2 arg_1 = half2(0.0h); + half2 res = fmin(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_e780f9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_e780f9(); + return; +} + +kernel void compute_main() { + min_e780f9(); + return; +} + diff --git a/test/tint/builtins/gen/var/min/e780f9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/min/e780f9.wgsl.expected.spvasm new file mode 100644 index 0000000000..aac4bd1ecc --- /dev/null +++ b/test/tint/builtins/gen/var/min/e780f9.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_e780f9 "min_e780f9" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %min_e780f9 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %arg_1 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v2half %arg_0 + %22 = OpLoad %v2half %arg_1 + %19 = OpExtInst %v2half %20 NMin %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %min_e780f9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %min_e780f9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %min_e780f9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/min/e780f9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/min/e780f9.wgsl.expected.wgsl new file mode 100644 index 0000000000..ce1ac48788 --- /dev/null +++ b/test/tint/builtins/gen/var/min/e780f9.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn min_e780f9() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var res : vec2 = min(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_e780f9(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_e780f9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_e780f9(); +} diff --git a/test/tint/builtins/gen/var/mix/38cbbb.wgsl b/test/tint/builtins/gen/var/mix/38cbbb.wgsl new file mode 100644 index 0000000000..c319eeae80 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/38cbbb.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn mix(f16, f16, f16) -> f16 +fn mix_38cbbb() { + var arg_0 = f16(); + var arg_1 = f16(); + var arg_2 = f16(); + var res: f16 = mix(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_38cbbb(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_38cbbb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_38cbbb(); +} diff --git a/test/tint/builtins/gen/var/mix/38cbbb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/mix/38cbbb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a0edd4a44c --- /dev/null +++ b/test/tint/builtins/gen/var/mix/38cbbb.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void mix_38cbbb() { + float16_t arg_0 = float16_t(0.0h); + float16_t arg_1 = float16_t(0.0h); + float16_t arg_2 = float16_t(0.0h); + float16_t res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_38cbbb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_38cbbb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_38cbbb(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/38cbbb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/mix/38cbbb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f7267d243c --- /dev/null +++ b/test/tint/builtins/gen/var/mix/38cbbb.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void mix_38cbbb() { + float16_t arg_0 = float16_t(0.0h); + float16_t arg_1 = float16_t(0.0h); + float16_t arg_2 = float16_t(0.0h); + float16_t res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_38cbbb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_38cbbb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_38cbbb(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000265C36E19E0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000265C36E19E0(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/mix/38cbbb.wgsl.expected.glsl b/test/tint/builtins/gen/var/mix/38cbbb.wgsl.expected.glsl new file mode 100644 index 0000000000..c5da8564ad --- /dev/null +++ b/test/tint/builtins/gen/var/mix/38cbbb.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_38cbbb() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t arg_2 = 0.0hf; + float16_t res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + mix_38cbbb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void mix_38cbbb() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t arg_2 = 0.0hf; + float16_t res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + mix_38cbbb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_38cbbb() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t arg_2 = 0.0hf; + float16_t res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + mix_38cbbb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/38cbbb.wgsl.expected.msl b/test/tint/builtins/gen/var/mix/38cbbb.wgsl.expected.msl new file mode 100644 index 0000000000..45b6845d57 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/38cbbb.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void mix_38cbbb() { + half arg_0 = 0.0h; + half arg_1 = 0.0h; + half arg_2 = 0.0h; + half res = mix(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_38cbbb(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_38cbbb(); + return; +} + +kernel void compute_main() { + mix_38cbbb(); + return; +} + diff --git a/test/tint/builtins/gen/var/mix/38cbbb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/mix/38cbbb.wgsl.expected.spvasm new file mode 100644 index 0000000000..601a4f8eab --- /dev/null +++ b/test/tint/builtins/gen/var/mix/38cbbb.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_38cbbb "mix_38cbbb" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %mix_38cbbb = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %arg_1 = OpVariable %_ptr_Function_half Function %14 + %arg_2 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + OpStore %arg_2 %14 + %21 = OpLoad %half %arg_0 + %22 = OpLoad %half %arg_1 + %23 = OpLoad %half %arg_2 + %19 = OpExtInst %half %20 FMix %21 %22 %23 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %mix_38cbbb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %mix_38cbbb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %mix_38cbbb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/mix/38cbbb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/mix/38cbbb.wgsl.expected.wgsl new file mode 100644 index 0000000000..89050575f2 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/38cbbb.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn mix_38cbbb() { + var arg_0 = f16(); + var arg_1 = f16(); + var arg_2 = f16(); + var res : f16 = mix(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_38cbbb(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_38cbbb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_38cbbb(); +} diff --git a/test/tint/builtins/gen/var/mix/63f2fd.wgsl b/test/tint/builtins/gen/var/mix/63f2fd.wgsl new file mode 100644 index 0000000000..b68ae29f2a --- /dev/null +++ b/test/tint/builtins/gen/var/mix/63f2fd.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn mix(vec<3, f16>, vec<3, f16>, vec<3, f16>) -> vec<3, f16> +fn mix_63f2fd() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var arg_2 = vec3(f16()); + var res: vec3 = mix(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_63f2fd(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_63f2fd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_63f2fd(); +} diff --git a/test/tint/builtins/gen/var/mix/63f2fd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/mix/63f2fd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..64200d6d08 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/63f2fd.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void mix_63f2fd() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector arg_2 = (float16_t(0.0h)).xxx; + vector res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_63f2fd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_63f2fd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_63f2fd(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/63f2fd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/mix/63f2fd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a54e8bdc53 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/63f2fd.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +SKIP: FAILED + +void mix_63f2fd() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector arg_2 = (float16_t(0.0h)).xxx; + vector res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_63f2fd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_63f2fd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_63f2fd(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021DB787B5D0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021DB787B5D0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021DB787B5D0(4,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021DB787B5D0(5,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/mix/63f2fd.wgsl.expected.glsl b/test/tint/builtins/gen/var/mix/63f2fd.wgsl.expected.glsl new file mode 100644 index 0000000000..21b513d39b --- /dev/null +++ b/test/tint/builtins/gen/var/mix/63f2fd.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_63f2fd() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 arg_2 = f16vec3(0.0hf); + f16vec3 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + mix_63f2fd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void mix_63f2fd() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 arg_2 = f16vec3(0.0hf); + f16vec3 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + mix_63f2fd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_63f2fd() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 arg_2 = f16vec3(0.0hf); + f16vec3 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + mix_63f2fd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/63f2fd.wgsl.expected.msl b/test/tint/builtins/gen/var/mix/63f2fd.wgsl.expected.msl new file mode 100644 index 0000000000..434d37abf8 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/63f2fd.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void mix_63f2fd() { + half3 arg_0 = half3(0.0h); + half3 arg_1 = half3(0.0h); + half3 arg_2 = half3(0.0h); + half3 res = mix(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_63f2fd(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_63f2fd(); + return; +} + +kernel void compute_main() { + mix_63f2fd(); + return; +} + diff --git a/test/tint/builtins/gen/var/mix/63f2fd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/mix/63f2fd.wgsl.expected.spvasm new file mode 100644 index 0000000000..44f6f950c1 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/63f2fd.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_63f2fd "mix_63f2fd" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %mix_63f2fd = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %arg_1 = OpVariable %_ptr_Function_v3half Function %15 + %arg_2 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %22 = OpLoad %v3half %arg_0 + %23 = OpLoad %v3half %arg_1 + %24 = OpLoad %v3half %arg_2 + %20 = OpExtInst %v3half %21 FMix %22 %23 %24 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %mix_63f2fd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %mix_63f2fd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %mix_63f2fd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/mix/63f2fd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/mix/63f2fd.wgsl.expected.wgsl new file mode 100644 index 0000000000..803966f310 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/63f2fd.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn mix_63f2fd() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var arg_2 = vec3(f16()); + var res : vec3 = mix(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_63f2fd(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_63f2fd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_63f2fd(); +} diff --git a/test/tint/builtins/gen/var/mix/98ee3e.wgsl b/test/tint/builtins/gen/var/mix/98ee3e.wgsl new file mode 100644 index 0000000000..4ad0e03b51 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/98ee3e.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn mix(vec<2, f16>, vec<2, f16>, vec<2, f16>) -> vec<2, f16> +fn mix_98ee3e() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var arg_2 = vec2(f16()); + var res: vec2 = mix(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_98ee3e(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_98ee3e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_98ee3e(); +} diff --git a/test/tint/builtins/gen/var/mix/98ee3e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/mix/98ee3e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4c9b6cd1a9 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/98ee3e.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void mix_98ee3e() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + vector arg_2 = (float16_t(0.0h)).xx; + vector res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_98ee3e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_98ee3e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_98ee3e(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/98ee3e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/mix/98ee3e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..034d0366be --- /dev/null +++ b/test/tint/builtins/gen/var/mix/98ee3e.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +SKIP: FAILED + +void mix_98ee3e() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + vector arg_2 = (float16_t(0.0h)).xx; + vector res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_98ee3e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_98ee3e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_98ee3e(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000261CFF10B50(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000261CFF10B50(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000261CFF10B50(4,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000261CFF10B50(5,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/mix/98ee3e.wgsl.expected.glsl b/test/tint/builtins/gen/var/mix/98ee3e.wgsl.expected.glsl new file mode 100644 index 0000000000..4fe64a06d4 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/98ee3e.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_98ee3e() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 arg_2 = f16vec2(0.0hf); + f16vec2 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + mix_98ee3e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void mix_98ee3e() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 arg_2 = f16vec2(0.0hf); + f16vec2 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + mix_98ee3e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_98ee3e() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 arg_2 = f16vec2(0.0hf); + f16vec2 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + mix_98ee3e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/98ee3e.wgsl.expected.msl b/test/tint/builtins/gen/var/mix/98ee3e.wgsl.expected.msl new file mode 100644 index 0000000000..6dab70bbfe --- /dev/null +++ b/test/tint/builtins/gen/var/mix/98ee3e.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void mix_98ee3e() { + half2 arg_0 = half2(0.0h); + half2 arg_1 = half2(0.0h); + half2 arg_2 = half2(0.0h); + half2 res = mix(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_98ee3e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_98ee3e(); + return; +} + +kernel void compute_main() { + mix_98ee3e(); + return; +} + diff --git a/test/tint/builtins/gen/var/mix/98ee3e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/mix/98ee3e.wgsl.expected.spvasm new file mode 100644 index 0000000000..94ac72eb65 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/98ee3e.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_98ee3e "mix_98ee3e" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %mix_98ee3e = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %arg_1 = OpVariable %_ptr_Function_v2half Function %15 + %arg_2 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %22 = OpLoad %v2half %arg_0 + %23 = OpLoad %v2half %arg_1 + %24 = OpLoad %v2half %arg_2 + %20 = OpExtInst %v2half %21 FMix %22 %23 %24 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %mix_98ee3e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %mix_98ee3e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %mix_98ee3e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/mix/98ee3e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/mix/98ee3e.wgsl.expected.wgsl new file mode 100644 index 0000000000..28738df928 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/98ee3e.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn mix_98ee3e() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var arg_2 = vec2(f16()); + var res : vec2 = mix(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_98ee3e(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_98ee3e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_98ee3e(); +} diff --git a/test/tint/builtins/gen/var/mix/c1aec6.wgsl b/test/tint/builtins/gen/var/mix/c1aec6.wgsl new file mode 100644 index 0000000000..6eabaff9fa --- /dev/null +++ b/test/tint/builtins/gen/var/mix/c1aec6.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn mix(vec<3, f16>, vec<3, f16>, f16) -> vec<3, f16> +fn mix_c1aec6() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var arg_2 = f16(); + var res: vec3 = mix(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_c1aec6(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_c1aec6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_c1aec6(); +} diff --git a/test/tint/builtins/gen/var/mix/c1aec6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/mix/c1aec6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fae485c639 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/c1aec6.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void mix_c1aec6() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + float16_t arg_2 = float16_t(0.0h); + vector res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_c1aec6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_c1aec6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_c1aec6(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/c1aec6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/mix/c1aec6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c8b6210430 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/c1aec6.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +SKIP: FAILED + +void mix_c1aec6() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + float16_t arg_2 = float16_t(0.0h); + vector res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_c1aec6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_c1aec6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_c1aec6(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002489FE7D9C0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002489FE7D9C0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002489FE7D9C0(4,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002489FE7D9C0(4,13-17): error X3000: unrecognized identifier 'arg_2' + diff --git a/test/tint/builtins/gen/var/mix/c1aec6.wgsl.expected.glsl b/test/tint/builtins/gen/var/mix/c1aec6.wgsl.expected.glsl new file mode 100644 index 0000000000..8eba39093f --- /dev/null +++ b/test/tint/builtins/gen/var/mix/c1aec6.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_c1aec6() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + float16_t arg_2 = 0.0hf; + f16vec3 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + mix_c1aec6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void mix_c1aec6() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + float16_t arg_2 = 0.0hf; + f16vec3 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + mix_c1aec6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_c1aec6() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + float16_t arg_2 = 0.0hf; + f16vec3 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + mix_c1aec6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/c1aec6.wgsl.expected.msl b/test/tint/builtins/gen/var/mix/c1aec6.wgsl.expected.msl new file mode 100644 index 0000000000..c8161a6c39 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/c1aec6.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void mix_c1aec6() { + half3 arg_0 = half3(0.0h); + half3 arg_1 = half3(0.0h); + half arg_2 = 0.0h; + half3 res = mix(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_c1aec6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_c1aec6(); + return; +} + +kernel void compute_main() { + mix_c1aec6(); + return; +} + diff --git a/test/tint/builtins/gen/var/mix/c1aec6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/mix/c1aec6.wgsl.expected.spvasm new file mode 100644 index 0000000000..e20acfdde2 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/c1aec6.wgsl.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_c1aec6 "mix_c1aec6" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %19 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %mix_c1aec6 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %arg_1 = OpVariable %_ptr_Function_v3half Function %15 + %arg_2 = OpVariable %_ptr_Function_half Function %19 + %27 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %19 + %24 = OpLoad %v3half %arg_0 + %25 = OpLoad %v3half %arg_1 + %26 = OpLoad %half %arg_2 + %28 = OpCompositeConstruct %v3half %26 %26 %26 + %22 = OpExtInst %v3half %23 FMix %24 %25 %28 + OpStore %res %22 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %mix_c1aec6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %39 = OpLabel + %40 = OpFunctionCall %void %mix_c1aec6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %42 = OpLabel + %43 = OpFunctionCall %void %mix_c1aec6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/mix/c1aec6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/mix/c1aec6.wgsl.expected.wgsl new file mode 100644 index 0000000000..a66c0bc6b2 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/c1aec6.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn mix_c1aec6() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var arg_2 = f16(); + var res : vec3 = mix(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_c1aec6(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_c1aec6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_c1aec6(); +} diff --git a/test/tint/builtins/gen/var/mix/e46a83.wgsl b/test/tint/builtins/gen/var/mix/e46a83.wgsl new file mode 100644 index 0000000000..2dc7e65c5f --- /dev/null +++ b/test/tint/builtins/gen/var/mix/e46a83.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn mix(vec<2, f16>, vec<2, f16>, f16) -> vec<2, f16> +fn mix_e46a83() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var arg_2 = f16(); + var res: vec2 = mix(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_e46a83(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_e46a83(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_e46a83(); +} diff --git a/test/tint/builtins/gen/var/mix/e46a83.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/mix/e46a83.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f857864601 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/e46a83.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void mix_e46a83() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + float16_t arg_2 = float16_t(0.0h); + vector res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_e46a83(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_e46a83(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_e46a83(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/e46a83.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/mix/e46a83.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..088d87963a --- /dev/null +++ b/test/tint/builtins/gen/var/mix/e46a83.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +SKIP: FAILED + +void mix_e46a83() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + float16_t arg_2 = float16_t(0.0h); + vector res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_e46a83(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_e46a83(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_e46a83(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F3F7264500(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F3F7264500(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F3F7264500(4,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F3F7264500(4,13-17): error X3000: unrecognized identifier 'arg_2' + diff --git a/test/tint/builtins/gen/var/mix/e46a83.wgsl.expected.glsl b/test/tint/builtins/gen/var/mix/e46a83.wgsl.expected.glsl new file mode 100644 index 0000000000..63c9a84d04 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/e46a83.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_e46a83() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + float16_t arg_2 = 0.0hf; + f16vec2 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + mix_e46a83(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void mix_e46a83() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + float16_t arg_2 = 0.0hf; + f16vec2 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + mix_e46a83(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_e46a83() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + float16_t arg_2 = 0.0hf; + f16vec2 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + mix_e46a83(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/e46a83.wgsl.expected.msl b/test/tint/builtins/gen/var/mix/e46a83.wgsl.expected.msl new file mode 100644 index 0000000000..8fdd8f3869 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/e46a83.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void mix_e46a83() { + half2 arg_0 = half2(0.0h); + half2 arg_1 = half2(0.0h); + half arg_2 = 0.0h; + half2 res = mix(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_e46a83(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_e46a83(); + return; +} + +kernel void compute_main() { + mix_e46a83(); + return; +} + diff --git a/test/tint/builtins/gen/var/mix/e46a83.wgsl.expected.spvasm b/test/tint/builtins/gen/var/mix/e46a83.wgsl.expected.spvasm new file mode 100644 index 0000000000..228e018447 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/e46a83.wgsl.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_e46a83 "mix_e46a83" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %19 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %mix_e46a83 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %arg_1 = OpVariable %_ptr_Function_v2half Function %15 + %arg_2 = OpVariable %_ptr_Function_half Function %19 + %27 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %19 + %24 = OpLoad %v2half %arg_0 + %25 = OpLoad %v2half %arg_1 + %26 = OpLoad %half %arg_2 + %28 = OpCompositeConstruct %v2half %26 %26 + %22 = OpExtInst %v2half %23 FMix %24 %25 %28 + OpStore %res %22 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %mix_e46a83 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %39 = OpLabel + %40 = OpFunctionCall %void %mix_e46a83 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %42 = OpLabel + %43 = OpFunctionCall %void %mix_e46a83 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/mix/e46a83.wgsl.expected.wgsl b/test/tint/builtins/gen/var/mix/e46a83.wgsl.expected.wgsl new file mode 100644 index 0000000000..f08146ccc2 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/e46a83.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn mix_e46a83() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var arg_2 = f16(); + var res : vec2 = mix(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_e46a83(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_e46a83(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_e46a83(); +} diff --git a/test/tint/builtins/gen/var/mix/ee2468.wgsl b/test/tint/builtins/gen/var/mix/ee2468.wgsl new file mode 100644 index 0000000000..63a60750a9 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/ee2468.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn mix(vec<4, f16>, vec<4, f16>, vec<4, f16>) -> vec<4, f16> +fn mix_ee2468() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var arg_2 = vec4(f16()); + var res: vec4 = mix(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_ee2468(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_ee2468(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_ee2468(); +} diff --git a/test/tint/builtins/gen/var/mix/ee2468.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/mix/ee2468.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7ddd927daa --- /dev/null +++ b/test/tint/builtins/gen/var/mix/ee2468.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void mix_ee2468() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + vector arg_2 = (float16_t(0.0h)).xxxx; + vector res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_ee2468(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_ee2468(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_ee2468(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/ee2468.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/mix/ee2468.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7e6e6f0c53 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/ee2468.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +SKIP: FAILED + +void mix_ee2468() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + vector arg_2 = (float16_t(0.0h)).xxxx; + vector res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_ee2468(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_ee2468(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_ee2468(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000122D9269150(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000122D9269150(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000122D9269150(4,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000122D9269150(5,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/mix/ee2468.wgsl.expected.glsl b/test/tint/builtins/gen/var/mix/ee2468.wgsl.expected.glsl new file mode 100644 index 0000000000..7ca5dd01b4 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/ee2468.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_ee2468() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 arg_2 = f16vec4(0.0hf); + f16vec4 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + mix_ee2468(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void mix_ee2468() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 arg_2 = f16vec4(0.0hf); + f16vec4 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + mix_ee2468(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_ee2468() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 arg_2 = f16vec4(0.0hf); + f16vec4 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + mix_ee2468(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/ee2468.wgsl.expected.msl b/test/tint/builtins/gen/var/mix/ee2468.wgsl.expected.msl new file mode 100644 index 0000000000..f08697a96b --- /dev/null +++ b/test/tint/builtins/gen/var/mix/ee2468.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void mix_ee2468() { + half4 arg_0 = half4(0.0h); + half4 arg_1 = half4(0.0h); + half4 arg_2 = half4(0.0h); + half4 res = mix(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_ee2468(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_ee2468(); + return; +} + +kernel void compute_main() { + mix_ee2468(); + return; +} + diff --git a/test/tint/builtins/gen/var/mix/ee2468.wgsl.expected.spvasm b/test/tint/builtins/gen/var/mix/ee2468.wgsl.expected.spvasm new file mode 100644 index 0000000000..57a262cddd --- /dev/null +++ b/test/tint/builtins/gen/var/mix/ee2468.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_ee2468 "mix_ee2468" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %mix_ee2468 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %arg_1 = OpVariable %_ptr_Function_v4half Function %15 + %arg_2 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %22 = OpLoad %v4half %arg_0 + %23 = OpLoad %v4half %arg_1 + %24 = OpLoad %v4half %arg_2 + %20 = OpExtInst %v4half %21 FMix %22 %23 %24 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %mix_ee2468 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %mix_ee2468 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %mix_ee2468 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/mix/ee2468.wgsl.expected.wgsl b/test/tint/builtins/gen/var/mix/ee2468.wgsl.expected.wgsl new file mode 100644 index 0000000000..1ab03948ba --- /dev/null +++ b/test/tint/builtins/gen/var/mix/ee2468.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn mix_ee2468() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var arg_2 = vec4(f16()); + var res : vec4 = mix(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_ee2468(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_ee2468(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_ee2468(); +} diff --git a/test/tint/builtins/gen/var/mix/f1a543.wgsl b/test/tint/builtins/gen/var/mix/f1a543.wgsl new file mode 100644 index 0000000000..fc47f42d8d --- /dev/null +++ b/test/tint/builtins/gen/var/mix/f1a543.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn mix(vec<4, f16>, vec<4, f16>, f16) -> vec<4, f16> +fn mix_f1a543() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var arg_2 = f16(); + var res: vec4 = mix(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_f1a543(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_f1a543(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_f1a543(); +} diff --git a/test/tint/builtins/gen/var/mix/f1a543.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/mix/f1a543.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e21963a103 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/f1a543.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void mix_f1a543() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + float16_t arg_2 = float16_t(0.0h); + vector res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_f1a543(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_f1a543(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_f1a543(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/f1a543.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/mix/f1a543.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..97176f96ae --- /dev/null +++ b/test/tint/builtins/gen/var/mix/f1a543.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +SKIP: FAILED + +void mix_f1a543() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + float16_t arg_2 = float16_t(0.0h); + vector res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_f1a543(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_f1a543(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_f1a543(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000027B644EDA60(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000027B644EDA60(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000027B644EDA60(4,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000027B644EDA60(4,13-17): error X3000: unrecognized identifier 'arg_2' + diff --git a/test/tint/builtins/gen/var/mix/f1a543.wgsl.expected.glsl b/test/tint/builtins/gen/var/mix/f1a543.wgsl.expected.glsl new file mode 100644 index 0000000000..4b023e5eb9 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/f1a543.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_f1a543() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + float16_t arg_2 = 0.0hf; + f16vec4 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + mix_f1a543(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void mix_f1a543() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + float16_t arg_2 = 0.0hf; + f16vec4 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + mix_f1a543(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_f1a543() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + float16_t arg_2 = 0.0hf; + f16vec4 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + mix_f1a543(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/f1a543.wgsl.expected.msl b/test/tint/builtins/gen/var/mix/f1a543.wgsl.expected.msl new file mode 100644 index 0000000000..2f8163dacc --- /dev/null +++ b/test/tint/builtins/gen/var/mix/f1a543.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void mix_f1a543() { + half4 arg_0 = half4(0.0h); + half4 arg_1 = half4(0.0h); + half arg_2 = 0.0h; + half4 res = mix(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_f1a543(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_f1a543(); + return; +} + +kernel void compute_main() { + mix_f1a543(); + return; +} + diff --git a/test/tint/builtins/gen/var/mix/f1a543.wgsl.expected.spvasm b/test/tint/builtins/gen/var/mix/f1a543.wgsl.expected.spvasm new file mode 100644 index 0000000000..cd6d0099ca --- /dev/null +++ b/test/tint/builtins/gen/var/mix/f1a543.wgsl.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_f1a543 "mix_f1a543" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %19 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %mix_f1a543 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %arg_1 = OpVariable %_ptr_Function_v4half Function %15 + %arg_2 = OpVariable %_ptr_Function_half Function %19 + %27 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %19 + %24 = OpLoad %v4half %arg_0 + %25 = OpLoad %v4half %arg_1 + %26 = OpLoad %half %arg_2 + %28 = OpCompositeConstruct %v4half %26 %26 %26 %26 + %22 = OpExtInst %v4half %23 FMix %24 %25 %28 + OpStore %res %22 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %mix_f1a543 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %39 = OpLabel + %40 = OpFunctionCall %void %mix_f1a543 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %42 = OpLabel + %43 = OpFunctionCall %void %mix_f1a543 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/mix/f1a543.wgsl.expected.wgsl b/test/tint/builtins/gen/var/mix/f1a543.wgsl.expected.wgsl new file mode 100644 index 0000000000..ee4f14c8bd --- /dev/null +++ b/test/tint/builtins/gen/var/mix/f1a543.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn mix_f1a543() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var arg_2 = f16(); + var res : vec4 = mix(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_f1a543(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_f1a543(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_f1a543(); +} diff --git a/test/tint/builtins/gen/var/modf/45005f.wgsl b/test/tint/builtins/gen/var/modf/45005f.wgsl new file mode 100644 index 0000000000..7576567658 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/45005f.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn modf(vec<3, f16>) -> __modf_result_vec<3, f16> +fn modf_45005f() { + var arg_0 = vec3(f16()); + var res = modf(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_45005f(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_45005f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_45005f(); +} diff --git a/test/tint/builtins/gen/var/modf/45005f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/modf/45005f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e6631d340d --- /dev/null +++ b/test/tint/builtins/gen/var/modf/45005f.wgsl.expected.dxc.hlsl @@ -0,0 +1,41 @@ +struct modf_result_vec3_f16 { + vector fract; + vector whole; +}; +modf_result_vec3_f16 tint_modf(vector param_0) { + modf_result_vec3_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_45005f() { + vector arg_0 = (float16_t(0.0h)).xxx; + modf_result_vec3_f16 res = tint_modf(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_45005f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_45005f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_45005f(); + return; +} diff --git a/test/tint/builtins/gen/var/modf/45005f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/modf/45005f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..64e0fc49a5 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/45005f.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +SKIP: FAILED + +struct modf_result_vec3_f16 { + vector fract; + vector whole; +}; +modf_result_vec3_f16 tint_modf(vector param_0) { + modf_result_vec3_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_45005f() { + vector arg_0 = (float16_t(0.0h)).xxx; + modf_result_vec3_f16 res = tint_modf(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_45005f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_45005f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_45005f(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022A03927740(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/modf/45005f.wgsl.expected.glsl b/test/tint/builtins/gen/var/modf/45005f.wgsl.expected.glsl new file mode 100644 index 0000000000..238c3c2682 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/45005f.wgsl.expected.glsl @@ -0,0 +1,91 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct modf_result_vec3_f16 { + f16vec3 fract; + f16vec3 whole; +}; + +modf_result_vec3_f16 tint_modf(f16vec3 param_0) { + modf_result_vec3_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_45005f() { + f16vec3 arg_0 = f16vec3(0.0hf); + modf_result_vec3_f16 res = tint_modf(arg_0); +} + +vec4 vertex_main() { + modf_45005f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +struct modf_result_vec3_f16 { + f16vec3 fract; + f16vec3 whole; +}; + +modf_result_vec3_f16 tint_modf(f16vec3 param_0) { + modf_result_vec3_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_45005f() { + f16vec3 arg_0 = f16vec3(0.0hf); + modf_result_vec3_f16 res = tint_modf(arg_0); +} + +void fragment_main() { + modf_45005f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct modf_result_vec3_f16 { + f16vec3 fract; + f16vec3 whole; +}; + +modf_result_vec3_f16 tint_modf(f16vec3 param_0) { + modf_result_vec3_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_45005f() { + f16vec3 arg_0 = f16vec3(0.0hf); + modf_result_vec3_f16 res = tint_modf(arg_0); +} + +void compute_main() { + modf_45005f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/modf/45005f.wgsl.expected.msl b/test/tint/builtins/gen/var/modf/45005f.wgsl.expected.msl new file mode 100644 index 0000000000..736c945edb --- /dev/null +++ b/test/tint/builtins/gen/var/modf/45005f.wgsl.expected.msl @@ -0,0 +1,45 @@ +#include + +using namespace metal; + +struct modf_result_vec3_f16 { + half3 fract; + half3 whole; +}; +modf_result_vec3_f16 tint_modf(half3 param_0) { + modf_result_vec3_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_45005f() { + half3 arg_0 = half3(0.0h); + modf_result_vec3_f16 res = tint_modf(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + modf_45005f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + modf_45005f(); + return; +} + +kernel void compute_main() { + modf_45005f(); + return; +} + diff --git a/test/tint/builtins/gen/var/modf/45005f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/modf/45005f.wgsl.expected.spvasm new file mode 100644 index 0000000000..ff3de45e07 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/45005f.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %modf_45005f "modf_45005f" + OpName %arg_0 "arg_0" + OpName %__modf_result_vec3_f16 "__modf_result_vec3_f16" + OpMemberName %__modf_result_vec3_f16 0 "fract" + OpMemberName %__modf_result_vec3_f16 1 "whole" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__modf_result_vec3_f16 0 Offset 0 + OpMemberDecorate %__modf_result_vec3_f16 1 Offset 8 + %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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half +%__modf_result_vec3_f16 = OpTypeStruct %v3half %v3half +%_ptr_Function___modf_result_vec3_f16 = OpTypePointer Function %__modf_result_vec3_f16 + %24 = OpConstantNull %__modf_result_vec3_f16 + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%modf_45005f = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function___modf_result_vec3_f16 Function %24 + OpStore %arg_0 %15 + %21 = OpLoad %v3half %arg_0 + %18 = OpExtInst %__modf_result_vec3_f16 %20 ModfStruct %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %modf_45005f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %modf_45005f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %modf_45005f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/modf/45005f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/modf/45005f.wgsl.expected.wgsl new file mode 100644 index 0000000000..987ba8ad11 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/45005f.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn modf_45005f() { + var arg_0 = vec3(f16()); + var res = modf(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_45005f(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_45005f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_45005f(); +} diff --git a/test/tint/builtins/gen/var/modf/8dbbbf.wgsl b/test/tint/builtins/gen/var/modf/8dbbbf.wgsl new file mode 100644 index 0000000000..057c908b43 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/8dbbbf.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn modf(f16) -> __modf_result +fn modf_8dbbbf() { + var arg_0 = f16(); + var res = modf(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_8dbbbf(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_8dbbbf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_8dbbbf(); +} diff --git a/test/tint/builtins/gen/var/modf/8dbbbf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/modf/8dbbbf.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..53bf292be9 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/8dbbbf.wgsl.expected.dxc.hlsl @@ -0,0 +1,41 @@ +struct modf_result_f16 { + float16_t fract; + float16_t whole; +}; +modf_result_f16 tint_modf(float16_t param_0) { + modf_result_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_8dbbbf() { + float16_t arg_0 = float16_t(0.0h); + modf_result_f16 res = tint_modf(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_8dbbbf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_8dbbbf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_8dbbbf(); + return; +} diff --git a/test/tint/builtins/gen/var/modf/8dbbbf.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/modf/8dbbbf.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..db80c1f543 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/8dbbbf.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +SKIP: FAILED + +struct modf_result_f16 { + float16_t fract; + float16_t whole; +}; +modf_result_f16 tint_modf(float16_t param_0) { + modf_result_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_8dbbbf() { + float16_t arg_0 = float16_t(0.0h); + modf_result_f16 res = tint_modf(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_8dbbbf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_8dbbbf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_8dbbbf(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001A838D20100(2,3-11): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/builtins/gen/var/modf/8dbbbf.wgsl.expected.glsl b/test/tint/builtins/gen/var/modf/8dbbbf.wgsl.expected.glsl new file mode 100644 index 0000000000..38e8cf6fbc --- /dev/null +++ b/test/tint/builtins/gen/var/modf/8dbbbf.wgsl.expected.glsl @@ -0,0 +1,91 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct modf_result_f16 { + float16_t fract; + float16_t whole; +}; + +modf_result_f16 tint_modf(float16_t param_0) { + modf_result_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_8dbbbf() { + float16_t arg_0 = 0.0hf; + modf_result_f16 res = tint_modf(arg_0); +} + +vec4 vertex_main() { + modf_8dbbbf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +struct modf_result_f16 { + float16_t fract; + float16_t whole; +}; + +modf_result_f16 tint_modf(float16_t param_0) { + modf_result_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_8dbbbf() { + float16_t arg_0 = 0.0hf; + modf_result_f16 res = tint_modf(arg_0); +} + +void fragment_main() { + modf_8dbbbf(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct modf_result_f16 { + float16_t fract; + float16_t whole; +}; + +modf_result_f16 tint_modf(float16_t param_0) { + modf_result_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_8dbbbf() { + float16_t arg_0 = 0.0hf; + modf_result_f16 res = tint_modf(arg_0); +} + +void compute_main() { + modf_8dbbbf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/modf/8dbbbf.wgsl.expected.msl b/test/tint/builtins/gen/var/modf/8dbbbf.wgsl.expected.msl new file mode 100644 index 0000000000..feb162130f --- /dev/null +++ b/test/tint/builtins/gen/var/modf/8dbbbf.wgsl.expected.msl @@ -0,0 +1,45 @@ +#include + +using namespace metal; + +struct modf_result_f16 { + half fract; + half whole; +}; +modf_result_f16 tint_modf(half param_0) { + modf_result_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_8dbbbf() { + half arg_0 = 0.0h; + modf_result_f16 res = tint_modf(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + modf_8dbbbf(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + modf_8dbbbf(); + return; +} + +kernel void compute_main() { + modf_8dbbbf(); + return; +} + diff --git a/test/tint/builtins/gen/var/modf/8dbbbf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/modf/8dbbbf.wgsl.expected.spvasm new file mode 100644 index 0000000000..d4ab1c8367 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/8dbbbf.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %modf_8dbbbf "modf_8dbbbf" + OpName %arg_0 "arg_0" + OpName %__modf_result_f16 "__modf_result_f16" + OpMemberName %__modf_result_f16 0 "fract" + OpMemberName %__modf_result_f16 1 "whole" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__modf_result_f16 0 Offset 0 + OpMemberDecorate %__modf_result_f16 1 Offset 2 + %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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half +%__modf_result_f16 = OpTypeStruct %half %half +%_ptr_Function___modf_result_f16 = OpTypePointer Function %__modf_result_f16 + %23 = OpConstantNull %__modf_result_f16 + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%modf_8dbbbf = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function___modf_result_f16 Function %23 + OpStore %arg_0 %14 + %20 = OpLoad %half %arg_0 + %17 = OpExtInst %__modf_result_f16 %19 ModfStruct %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %modf_8dbbbf + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %modf_8dbbbf + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %modf_8dbbbf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/modf/8dbbbf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/modf/8dbbbf.wgsl.expected.wgsl new file mode 100644 index 0000000000..5e076874c4 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/8dbbbf.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn modf_8dbbbf() { + var arg_0 = f16(); + var res = modf(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_8dbbbf(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_8dbbbf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_8dbbbf(); +} diff --git a/test/tint/builtins/gen/var/modf/995934.wgsl b/test/tint/builtins/gen/var/modf/995934.wgsl new file mode 100644 index 0000000000..b981c28d1f --- /dev/null +++ b/test/tint/builtins/gen/var/modf/995934.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn modf(vec<4, f16>) -> __modf_result_vec<4, f16> +fn modf_995934() { + var arg_0 = vec4(f16()); + var res = modf(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_995934(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_995934(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_995934(); +} diff --git a/test/tint/builtins/gen/var/modf/995934.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/modf/995934.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ee6f076b6a --- /dev/null +++ b/test/tint/builtins/gen/var/modf/995934.wgsl.expected.dxc.hlsl @@ -0,0 +1,41 @@ +struct modf_result_vec4_f16 { + vector fract; + vector whole; +}; +modf_result_vec4_f16 tint_modf(vector param_0) { + modf_result_vec4_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_995934() { + vector arg_0 = (float16_t(0.0h)).xxxx; + modf_result_vec4_f16 res = tint_modf(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_995934(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_995934(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_995934(); + return; +} diff --git a/test/tint/builtins/gen/var/modf/995934.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/modf/995934.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d2a213746e --- /dev/null +++ b/test/tint/builtins/gen/var/modf/995934.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +SKIP: FAILED + +struct modf_result_vec4_f16 { + vector fract; + vector whole; +}; +modf_result_vec4_f16 tint_modf(vector param_0) { + modf_result_vec4_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_995934() { + vector arg_0 = (float16_t(0.0h)).xxxx; + modf_result_vec4_f16 res = tint_modf(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_995934(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_995934(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_995934(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022D4D8C17A0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/modf/995934.wgsl.expected.glsl b/test/tint/builtins/gen/var/modf/995934.wgsl.expected.glsl new file mode 100644 index 0000000000..8bef4a7846 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/995934.wgsl.expected.glsl @@ -0,0 +1,91 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct modf_result_vec4_f16 { + f16vec4 fract; + f16vec4 whole; +}; + +modf_result_vec4_f16 tint_modf(f16vec4 param_0) { + modf_result_vec4_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_995934() { + f16vec4 arg_0 = f16vec4(0.0hf); + modf_result_vec4_f16 res = tint_modf(arg_0); +} + +vec4 vertex_main() { + modf_995934(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +struct modf_result_vec4_f16 { + f16vec4 fract; + f16vec4 whole; +}; + +modf_result_vec4_f16 tint_modf(f16vec4 param_0) { + modf_result_vec4_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_995934() { + f16vec4 arg_0 = f16vec4(0.0hf); + modf_result_vec4_f16 res = tint_modf(arg_0); +} + +void fragment_main() { + modf_995934(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct modf_result_vec4_f16 { + f16vec4 fract; + f16vec4 whole; +}; + +modf_result_vec4_f16 tint_modf(f16vec4 param_0) { + modf_result_vec4_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_995934() { + f16vec4 arg_0 = f16vec4(0.0hf); + modf_result_vec4_f16 res = tint_modf(arg_0); +} + +void compute_main() { + modf_995934(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/modf/995934.wgsl.expected.msl b/test/tint/builtins/gen/var/modf/995934.wgsl.expected.msl new file mode 100644 index 0000000000..8f32c42606 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/995934.wgsl.expected.msl @@ -0,0 +1,45 @@ +#include + +using namespace metal; + +struct modf_result_vec4_f16 { + half4 fract; + half4 whole; +}; +modf_result_vec4_f16 tint_modf(half4 param_0) { + modf_result_vec4_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_995934() { + half4 arg_0 = half4(0.0h); + modf_result_vec4_f16 res = tint_modf(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + modf_995934(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + modf_995934(); + return; +} + +kernel void compute_main() { + modf_995934(); + return; +} + diff --git a/test/tint/builtins/gen/var/modf/995934.wgsl.expected.spvasm b/test/tint/builtins/gen/var/modf/995934.wgsl.expected.spvasm new file mode 100644 index 0000000000..ddb7405322 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/995934.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %modf_995934 "modf_995934" + OpName %arg_0 "arg_0" + OpName %__modf_result_vec4_f16 "__modf_result_vec4_f16" + OpMemberName %__modf_result_vec4_f16 0 "fract" + OpMemberName %__modf_result_vec4_f16 1 "whole" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__modf_result_vec4_f16 0 Offset 0 + OpMemberDecorate %__modf_result_vec4_f16 1 Offset 8 + %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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half +%__modf_result_vec4_f16 = OpTypeStruct %v4half %v4half +%_ptr_Function___modf_result_vec4_f16 = OpTypePointer Function %__modf_result_vec4_f16 + %24 = OpConstantNull %__modf_result_vec4_f16 + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%modf_995934 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function___modf_result_vec4_f16 Function %24 + OpStore %arg_0 %15 + %21 = OpLoad %v4half %arg_0 + %18 = OpExtInst %__modf_result_vec4_f16 %20 ModfStruct %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %modf_995934 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %modf_995934 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %modf_995934 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/modf/995934.wgsl.expected.wgsl b/test/tint/builtins/gen/var/modf/995934.wgsl.expected.wgsl new file mode 100644 index 0000000000..a1ed549b10 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/995934.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn modf_995934() { + var arg_0 = vec4(f16()); + var res = modf(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_995934(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_995934(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_995934(); +} diff --git a/test/tint/builtins/gen/var/modf/a545b9.wgsl b/test/tint/builtins/gen/var/modf/a545b9.wgsl new file mode 100644 index 0000000000..891108626c --- /dev/null +++ b/test/tint/builtins/gen/var/modf/a545b9.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn modf(vec<2, f16>) -> __modf_result_vec<2, f16> +fn modf_a545b9() { + var arg_0 = vec2(f16()); + var res = modf(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_a545b9(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_a545b9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_a545b9(); +} diff --git a/test/tint/builtins/gen/var/modf/a545b9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/modf/a545b9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..66e40ec11d --- /dev/null +++ b/test/tint/builtins/gen/var/modf/a545b9.wgsl.expected.dxc.hlsl @@ -0,0 +1,41 @@ +struct modf_result_vec2_f16 { + vector fract; + vector whole; +}; +modf_result_vec2_f16 tint_modf(vector param_0) { + modf_result_vec2_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_a545b9() { + vector arg_0 = (float16_t(0.0h)).xx; + modf_result_vec2_f16 res = tint_modf(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_a545b9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_a545b9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_a545b9(); + return; +} diff --git a/test/tint/builtins/gen/var/modf/a545b9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/modf/a545b9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..412c83d765 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/a545b9.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +SKIP: FAILED + +struct modf_result_vec2_f16 { + vector fract; + vector whole; +}; +modf_result_vec2_f16 tint_modf(vector param_0) { + modf_result_vec2_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_a545b9() { + vector arg_0 = (float16_t(0.0h)).xx; + modf_result_vec2_f16 res = tint_modf(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_a545b9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_a545b9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_a545b9(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F329190D80(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/modf/a545b9.wgsl.expected.glsl b/test/tint/builtins/gen/var/modf/a545b9.wgsl.expected.glsl new file mode 100644 index 0000000000..3d59c415ec --- /dev/null +++ b/test/tint/builtins/gen/var/modf/a545b9.wgsl.expected.glsl @@ -0,0 +1,91 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct modf_result_vec2_f16 { + f16vec2 fract; + f16vec2 whole; +}; + +modf_result_vec2_f16 tint_modf(f16vec2 param_0) { + modf_result_vec2_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_a545b9() { + f16vec2 arg_0 = f16vec2(0.0hf); + modf_result_vec2_f16 res = tint_modf(arg_0); +} + +vec4 vertex_main() { + modf_a545b9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +struct modf_result_vec2_f16 { + f16vec2 fract; + f16vec2 whole; +}; + +modf_result_vec2_f16 tint_modf(f16vec2 param_0) { + modf_result_vec2_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_a545b9() { + f16vec2 arg_0 = f16vec2(0.0hf); + modf_result_vec2_f16 res = tint_modf(arg_0); +} + +void fragment_main() { + modf_a545b9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct modf_result_vec2_f16 { + f16vec2 fract; + f16vec2 whole; +}; + +modf_result_vec2_f16 tint_modf(f16vec2 param_0) { + modf_result_vec2_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_a545b9() { + f16vec2 arg_0 = f16vec2(0.0hf); + modf_result_vec2_f16 res = tint_modf(arg_0); +} + +void compute_main() { + modf_a545b9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/modf/a545b9.wgsl.expected.msl b/test/tint/builtins/gen/var/modf/a545b9.wgsl.expected.msl new file mode 100644 index 0000000000..7330f6bd03 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/a545b9.wgsl.expected.msl @@ -0,0 +1,45 @@ +#include + +using namespace metal; + +struct modf_result_vec2_f16 { + half2 fract; + half2 whole; +}; +modf_result_vec2_f16 tint_modf(half2 param_0) { + modf_result_vec2_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_a545b9() { + half2 arg_0 = half2(0.0h); + modf_result_vec2_f16 res = tint_modf(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + modf_a545b9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + modf_a545b9(); + return; +} + +kernel void compute_main() { + modf_a545b9(); + return; +} + diff --git a/test/tint/builtins/gen/var/modf/a545b9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/modf/a545b9.wgsl.expected.spvasm new file mode 100644 index 0000000000..a862a6cdab --- /dev/null +++ b/test/tint/builtins/gen/var/modf/a545b9.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %modf_a545b9 "modf_a545b9" + OpName %arg_0 "arg_0" + OpName %__modf_result_vec2_f16 "__modf_result_vec2_f16" + OpMemberName %__modf_result_vec2_f16 0 "fract" + OpMemberName %__modf_result_vec2_f16 1 "whole" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__modf_result_vec2_f16 0 Offset 0 + OpMemberDecorate %__modf_result_vec2_f16 1 Offset 4 + %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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half +%__modf_result_vec2_f16 = OpTypeStruct %v2half %v2half +%_ptr_Function___modf_result_vec2_f16 = OpTypePointer Function %__modf_result_vec2_f16 + %24 = OpConstantNull %__modf_result_vec2_f16 + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%modf_a545b9 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function___modf_result_vec2_f16 Function %24 + OpStore %arg_0 %15 + %21 = OpLoad %v2half %arg_0 + %18 = OpExtInst %__modf_result_vec2_f16 %20 ModfStruct %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %modf_a545b9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %modf_a545b9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %modf_a545b9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/modf/a545b9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/modf/a545b9.wgsl.expected.wgsl new file mode 100644 index 0000000000..9016659d56 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/a545b9.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn modf_a545b9() { + var arg_0 = vec2(f16()); + var res = modf(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_a545b9(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_a545b9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_a545b9(); +} diff --git a/test/tint/builtins/gen/var/normalize/39d5ec.wgsl b/test/tint/builtins/gen/var/normalize/39d5ec.wgsl new file mode 100644 index 0000000000..9d4465ddfe --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/39d5ec.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn normalize(vec<3, f16>) -> vec<3, f16> +fn normalize_39d5ec() { + var arg_0 = vec3(f16()); + var res: vec3 = normalize(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + normalize_39d5ec(); + return vec4(); +} + +@fragment +fn fragment_main() { + normalize_39d5ec(); +} + +@compute @workgroup_size(1) +fn compute_main() { + normalize_39d5ec(); +} diff --git a/test/tint/builtins/gen/var/normalize/39d5ec.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/normalize/39d5ec.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..27279be055 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/39d5ec.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void normalize_39d5ec() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = normalize(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + normalize_39d5ec(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + normalize_39d5ec(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + normalize_39d5ec(); + return; +} diff --git a/test/tint/builtins/gen/var/normalize/39d5ec.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/normalize/39d5ec.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0515aa9636 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/39d5ec.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void normalize_39d5ec() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = normalize(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + normalize_39d5ec(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + normalize_39d5ec(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + normalize_39d5ec(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000026F4DE48920(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000026F4DE48920(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/normalize/39d5ec.wgsl.expected.glsl b/test/tint/builtins/gen/var/normalize/39d5ec.wgsl.expected.glsl new file mode 100644 index 0000000000..cac08b0b15 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/39d5ec.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void normalize_39d5ec() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = normalize(arg_0); +} + +vec4 vertex_main() { + normalize_39d5ec(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void normalize_39d5ec() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = normalize(arg_0); +} + +void fragment_main() { + normalize_39d5ec(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void normalize_39d5ec() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = normalize(arg_0); +} + +void compute_main() { + normalize_39d5ec(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/normalize/39d5ec.wgsl.expected.msl b/test/tint/builtins/gen/var/normalize/39d5ec.wgsl.expected.msl new file mode 100644 index 0000000000..b39c9b3b05 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/39d5ec.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void normalize_39d5ec() { + half3 arg_0 = half3(0.0h); + half3 res = normalize(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + normalize_39d5ec(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + normalize_39d5ec(); + return; +} + +kernel void compute_main() { + normalize_39d5ec(); + return; +} + diff --git a/test/tint/builtins/gen/var/normalize/39d5ec.wgsl.expected.spvasm b/test/tint/builtins/gen/var/normalize/39d5ec.wgsl.expected.spvasm new file mode 100644 index 0000000000..7ee6ac0a7d --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/39d5ec.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %normalize_39d5ec "normalize_39d5ec" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%normalize_39d5ec = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Normalize %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %normalize_39d5ec + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %normalize_39d5ec + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %normalize_39d5ec + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/normalize/39d5ec.wgsl.expected.wgsl b/test/tint/builtins/gen/var/normalize/39d5ec.wgsl.expected.wgsl new file mode 100644 index 0000000000..a1dddf10b0 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/39d5ec.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn normalize_39d5ec() { + var arg_0 = vec3(f16()); + var res : vec3 = normalize(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + normalize_39d5ec(); + return vec4(); +} + +@fragment +fn fragment_main() { + normalize_39d5ec(); +} + +@compute @workgroup_size(1) +fn compute_main() { + normalize_39d5ec(); +} diff --git a/test/tint/builtins/gen/var/normalize/7990f3.wgsl b/test/tint/builtins/gen/var/normalize/7990f3.wgsl new file mode 100644 index 0000000000..46bb41b667 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/7990f3.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn normalize(vec<2, f16>) -> vec<2, f16> +fn normalize_7990f3() { + var arg_0 = vec2(f16()); + var res: vec2 = normalize(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + normalize_7990f3(); + return vec4(); +} + +@fragment +fn fragment_main() { + normalize_7990f3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + normalize_7990f3(); +} diff --git a/test/tint/builtins/gen/var/normalize/7990f3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/normalize/7990f3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5609e8b8e1 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/7990f3.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void normalize_7990f3() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = normalize(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + normalize_7990f3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + normalize_7990f3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + normalize_7990f3(); + return; +} diff --git a/test/tint/builtins/gen/var/normalize/7990f3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/normalize/7990f3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ef29d8400a --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/7990f3.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void normalize_7990f3() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = normalize(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + normalize_7990f3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + normalize_7990f3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + normalize_7990f3(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000234A30F1570(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000234A30F1570(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/normalize/7990f3.wgsl.expected.glsl b/test/tint/builtins/gen/var/normalize/7990f3.wgsl.expected.glsl new file mode 100644 index 0000000000..f5baf36837 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/7990f3.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void normalize_7990f3() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = normalize(arg_0); +} + +vec4 vertex_main() { + normalize_7990f3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void normalize_7990f3() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = normalize(arg_0); +} + +void fragment_main() { + normalize_7990f3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void normalize_7990f3() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = normalize(arg_0); +} + +void compute_main() { + normalize_7990f3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/normalize/7990f3.wgsl.expected.msl b/test/tint/builtins/gen/var/normalize/7990f3.wgsl.expected.msl new file mode 100644 index 0000000000..92d318abe5 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/7990f3.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void normalize_7990f3() { + half2 arg_0 = half2(0.0h); + half2 res = normalize(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + normalize_7990f3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + normalize_7990f3(); + return; +} + +kernel void compute_main() { + normalize_7990f3(); + return; +} + diff --git a/test/tint/builtins/gen/var/normalize/7990f3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/normalize/7990f3.wgsl.expected.spvasm new file mode 100644 index 0000000000..1df719a285 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/7990f3.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %normalize_7990f3 "normalize_7990f3" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%normalize_7990f3 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Normalize %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %normalize_7990f3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %normalize_7990f3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %normalize_7990f3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/normalize/7990f3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/normalize/7990f3.wgsl.expected.wgsl new file mode 100644 index 0000000000..3629918c89 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/7990f3.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn normalize_7990f3() { + var arg_0 = vec2(f16()); + var res : vec2 = normalize(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + normalize_7990f3(); + return vec4(); +} + +@fragment +fn fragment_main() { + normalize_7990f3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + normalize_7990f3(); +} diff --git a/test/tint/builtins/gen/var/normalize/b8cb8d.wgsl b/test/tint/builtins/gen/var/normalize/b8cb8d.wgsl new file mode 100644 index 0000000000..ef4811dbed --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/b8cb8d.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn normalize(vec<4, f16>) -> vec<4, f16> +fn normalize_b8cb8d() { + var arg_0 = vec4(f16()); + var res: vec4 = normalize(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + normalize_b8cb8d(); + return vec4(); +} + +@fragment +fn fragment_main() { + normalize_b8cb8d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + normalize_b8cb8d(); +} diff --git a/test/tint/builtins/gen/var/normalize/b8cb8d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/normalize/b8cb8d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7a7baeadf1 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/b8cb8d.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void normalize_b8cb8d() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = normalize(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + normalize_b8cb8d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + normalize_b8cb8d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + normalize_b8cb8d(); + return; +} diff --git a/test/tint/builtins/gen/var/normalize/b8cb8d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/normalize/b8cb8d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..04068803dd --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/b8cb8d.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void normalize_b8cb8d() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = normalize(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + normalize_b8cb8d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + normalize_b8cb8d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + normalize_b8cb8d(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021732CD97D0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021732CD97D0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/normalize/b8cb8d.wgsl.expected.glsl b/test/tint/builtins/gen/var/normalize/b8cb8d.wgsl.expected.glsl new file mode 100644 index 0000000000..d578fb1db0 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/b8cb8d.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void normalize_b8cb8d() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = normalize(arg_0); +} + +vec4 vertex_main() { + normalize_b8cb8d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void normalize_b8cb8d() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = normalize(arg_0); +} + +void fragment_main() { + normalize_b8cb8d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void normalize_b8cb8d() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = normalize(arg_0); +} + +void compute_main() { + normalize_b8cb8d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/normalize/b8cb8d.wgsl.expected.msl b/test/tint/builtins/gen/var/normalize/b8cb8d.wgsl.expected.msl new file mode 100644 index 0000000000..0534833030 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/b8cb8d.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void normalize_b8cb8d() { + half4 arg_0 = half4(0.0h); + half4 res = normalize(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + normalize_b8cb8d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + normalize_b8cb8d(); + return; +} + +kernel void compute_main() { + normalize_b8cb8d(); + return; +} + diff --git a/test/tint/builtins/gen/var/normalize/b8cb8d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/normalize/b8cb8d.wgsl.expected.spvasm new file mode 100644 index 0000000000..f904ec0486 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/b8cb8d.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %normalize_b8cb8d "normalize_b8cb8d" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%normalize_b8cb8d = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Normalize %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %normalize_b8cb8d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %normalize_b8cb8d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %normalize_b8cb8d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/normalize/b8cb8d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/normalize/b8cb8d.wgsl.expected.wgsl new file mode 100644 index 0000000000..b4793ae29c --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/b8cb8d.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn normalize_b8cb8d() { + var arg_0 = vec4(f16()); + var res : vec4 = normalize(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + normalize_b8cb8d(); + return vec4(); +} + +@fragment +fn fragment_main() { + normalize_b8cb8d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + normalize_b8cb8d(); +} diff --git a/test/tint/builtins/gen/var/pow/4f33b2.wgsl b/test/tint/builtins/gen/var/pow/4f33b2.wgsl new file mode 100644 index 0000000000..86f18ee4f4 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/4f33b2.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn pow(vec<4, f16>, vec<4, f16>) -> vec<4, f16> +fn pow_4f33b2() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var res: vec4 = pow(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_4f33b2(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_4f33b2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_4f33b2(); +} diff --git a/test/tint/builtins/gen/var/pow/4f33b2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/pow/4f33b2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..227638c329 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/4f33b2.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void pow_4f33b2() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + vector res = pow(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_4f33b2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_4f33b2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_4f33b2(); + return; +} diff --git a/test/tint/builtins/gen/var/pow/4f33b2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/pow/4f33b2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..11cb081673 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/4f33b2.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void pow_4f33b2() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + vector res = pow(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_4f33b2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_4f33b2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_4f33b2(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C8CA6D2360(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C8CA6D2360(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C8CA6D2360(4,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/pow/4f33b2.wgsl.expected.glsl b/test/tint/builtins/gen/var/pow/4f33b2.wgsl.expected.glsl new file mode 100644 index 0000000000..5986ecac24 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/4f33b2.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void pow_4f33b2() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 res = pow(arg_0, arg_1); +} + +vec4 vertex_main() { + pow_4f33b2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void pow_4f33b2() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 res = pow(arg_0, arg_1); +} + +void fragment_main() { + pow_4f33b2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void pow_4f33b2() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 res = pow(arg_0, arg_1); +} + +void compute_main() { + pow_4f33b2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/pow/4f33b2.wgsl.expected.msl b/test/tint/builtins/gen/var/pow/4f33b2.wgsl.expected.msl new file mode 100644 index 0000000000..c9055df449 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/4f33b2.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void pow_4f33b2() { + half4 arg_0 = half4(0.0h); + half4 arg_1 = half4(0.0h); + half4 res = pow(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + pow_4f33b2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + pow_4f33b2(); + return; +} + +kernel void compute_main() { + pow_4f33b2(); + return; +} + diff --git a/test/tint/builtins/gen/var/pow/4f33b2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/pow/4f33b2.wgsl.expected.spvasm new file mode 100644 index 0000000000..ab794c7609 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/4f33b2.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %pow_4f33b2 "pow_4f33b2" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %pow_4f33b2 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %arg_1 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v4half %arg_0 + %22 = OpLoad %v4half %arg_1 + %19 = OpExtInst %v4half %20 Pow %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %pow_4f33b2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %pow_4f33b2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %pow_4f33b2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/pow/4f33b2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/pow/4f33b2.wgsl.expected.wgsl new file mode 100644 index 0000000000..3ae3aa1407 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/4f33b2.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn pow_4f33b2() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var res : vec4 = pow(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_4f33b2(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_4f33b2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_4f33b2(); +} diff --git a/test/tint/builtins/gen/var/pow/ce9ef5.wgsl b/test/tint/builtins/gen/var/pow/ce9ef5.wgsl new file mode 100644 index 0000000000..8ce27eb070 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/ce9ef5.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn pow(f16, f16) -> f16 +fn pow_ce9ef5() { + var arg_0 = f16(); + var arg_1 = f16(); + var res: f16 = pow(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_ce9ef5(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_ce9ef5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_ce9ef5(); +} diff --git a/test/tint/builtins/gen/var/pow/ce9ef5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/pow/ce9ef5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..648dc41a6a --- /dev/null +++ b/test/tint/builtins/gen/var/pow/ce9ef5.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void pow_ce9ef5() { + float16_t arg_0 = float16_t(0.0h); + float16_t arg_1 = float16_t(0.0h); + float16_t res = pow(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_ce9ef5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_ce9ef5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_ce9ef5(); + return; +} diff --git a/test/tint/builtins/gen/var/pow/ce9ef5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/pow/ce9ef5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a893034d27 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/ce9ef5.wgsl.expected.fxc.hlsl @@ -0,0 +1,38 @@ +SKIP: FAILED + +void pow_ce9ef5() { + float16_t arg_0 = float16_t(0.0h); + float16_t arg_1 = float16_t(0.0h); + float16_t res = pow(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_ce9ef5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_ce9ef5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_ce9ef5(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001987C544730(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001987C544730(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/pow/ce9ef5.wgsl.expected.glsl b/test/tint/builtins/gen/var/pow/ce9ef5.wgsl.expected.glsl new file mode 100644 index 0000000000..204e570aed --- /dev/null +++ b/test/tint/builtins/gen/var/pow/ce9ef5.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void pow_ce9ef5() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t res = pow(arg_0, arg_1); +} + +vec4 vertex_main() { + pow_ce9ef5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void pow_ce9ef5() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t res = pow(arg_0, arg_1); +} + +void fragment_main() { + pow_ce9ef5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void pow_ce9ef5() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t res = pow(arg_0, arg_1); +} + +void compute_main() { + pow_ce9ef5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/pow/ce9ef5.wgsl.expected.msl b/test/tint/builtins/gen/var/pow/ce9ef5.wgsl.expected.msl new file mode 100644 index 0000000000..53588ac847 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/ce9ef5.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void pow_ce9ef5() { + half arg_0 = 0.0h; + half arg_1 = 0.0h; + half res = pow(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + pow_ce9ef5(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + pow_ce9ef5(); + return; +} + +kernel void compute_main() { + pow_ce9ef5(); + return; +} + diff --git a/test/tint/builtins/gen/var/pow/ce9ef5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/pow/ce9ef5.wgsl.expected.spvasm new file mode 100644 index 0000000000..740fe21306 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/ce9ef5.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %pow_ce9ef5 "pow_ce9ef5" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %pow_ce9ef5 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %arg_1 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + %20 = OpLoad %half %arg_0 + %21 = OpLoad %half %arg_1 + %18 = OpExtInst %half %19 Pow %20 %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %pow_ce9ef5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %pow_ce9ef5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %pow_ce9ef5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/pow/ce9ef5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/pow/ce9ef5.wgsl.expected.wgsl new file mode 100644 index 0000000000..da1a0f3c8c --- /dev/null +++ b/test/tint/builtins/gen/var/pow/ce9ef5.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn pow_ce9ef5() { + var arg_0 = f16(); + var arg_1 = f16(); + var res : f16 = pow(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_ce9ef5(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_ce9ef5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_ce9ef5(); +} diff --git a/test/tint/builtins/gen/var/pow/f37b25.wgsl b/test/tint/builtins/gen/var/pow/f37b25.wgsl new file mode 100644 index 0000000000..cdaa364b20 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/f37b25.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn pow(vec<2, f16>, vec<2, f16>) -> vec<2, f16> +fn pow_f37b25() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var res: vec2 = pow(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_f37b25(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_f37b25(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_f37b25(); +} diff --git a/test/tint/builtins/gen/var/pow/f37b25.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/pow/f37b25.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1656a090d9 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/f37b25.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void pow_f37b25() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + vector res = pow(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_f37b25(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_f37b25(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_f37b25(); + return; +} diff --git a/test/tint/builtins/gen/var/pow/f37b25.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/pow/f37b25.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..49f883ce2b --- /dev/null +++ b/test/tint/builtins/gen/var/pow/f37b25.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void pow_f37b25() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + vector res = pow(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_f37b25(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_f37b25(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_f37b25(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018483F919C0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018483F919C0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018483F919C0(4,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/pow/f37b25.wgsl.expected.glsl b/test/tint/builtins/gen/var/pow/f37b25.wgsl.expected.glsl new file mode 100644 index 0000000000..c6667068da --- /dev/null +++ b/test/tint/builtins/gen/var/pow/f37b25.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void pow_f37b25() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 res = pow(arg_0, arg_1); +} + +vec4 vertex_main() { + pow_f37b25(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void pow_f37b25() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 res = pow(arg_0, arg_1); +} + +void fragment_main() { + pow_f37b25(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void pow_f37b25() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 res = pow(arg_0, arg_1); +} + +void compute_main() { + pow_f37b25(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/pow/f37b25.wgsl.expected.msl b/test/tint/builtins/gen/var/pow/f37b25.wgsl.expected.msl new file mode 100644 index 0000000000..d608b91740 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/f37b25.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void pow_f37b25() { + half2 arg_0 = half2(0.0h); + half2 arg_1 = half2(0.0h); + half2 res = pow(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + pow_f37b25(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + pow_f37b25(); + return; +} + +kernel void compute_main() { + pow_f37b25(); + return; +} + diff --git a/test/tint/builtins/gen/var/pow/f37b25.wgsl.expected.spvasm b/test/tint/builtins/gen/var/pow/f37b25.wgsl.expected.spvasm new file mode 100644 index 0000000000..34746c576c --- /dev/null +++ b/test/tint/builtins/gen/var/pow/f37b25.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %pow_f37b25 "pow_f37b25" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %pow_f37b25 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %arg_1 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v2half %arg_0 + %22 = OpLoad %v2half %arg_1 + %19 = OpExtInst %v2half %20 Pow %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %pow_f37b25 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %pow_f37b25 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %pow_f37b25 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/pow/f37b25.wgsl.expected.wgsl b/test/tint/builtins/gen/var/pow/f37b25.wgsl.expected.wgsl new file mode 100644 index 0000000000..9c2e6fc210 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/f37b25.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn pow_f37b25() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var res : vec2 = pow(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_f37b25(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_f37b25(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_f37b25(); +} diff --git a/test/tint/builtins/gen/var/pow/fa5429.wgsl b/test/tint/builtins/gen/var/pow/fa5429.wgsl new file mode 100644 index 0000000000..2a6ad1191c --- /dev/null +++ b/test/tint/builtins/gen/var/pow/fa5429.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn pow(vec<3, f16>, vec<3, f16>) -> vec<3, f16> +fn pow_fa5429() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var res: vec3 = pow(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_fa5429(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_fa5429(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_fa5429(); +} diff --git a/test/tint/builtins/gen/var/pow/fa5429.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/pow/fa5429.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fd9cab2337 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/fa5429.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void pow_fa5429() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector res = pow(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_fa5429(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_fa5429(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_fa5429(); + return; +} diff --git a/test/tint/builtins/gen/var/pow/fa5429.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/pow/fa5429.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9bad326636 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/fa5429.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void pow_fa5429() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector res = pow(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_fa5429(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_fa5429(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_fa5429(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E461739570(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E461739570(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E461739570(4,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/pow/fa5429.wgsl.expected.glsl b/test/tint/builtins/gen/var/pow/fa5429.wgsl.expected.glsl new file mode 100644 index 0000000000..c57ea280bb --- /dev/null +++ b/test/tint/builtins/gen/var/pow/fa5429.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void pow_fa5429() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 res = pow(arg_0, arg_1); +} + +vec4 vertex_main() { + pow_fa5429(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void pow_fa5429() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 res = pow(arg_0, arg_1); +} + +void fragment_main() { + pow_fa5429(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void pow_fa5429() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 res = pow(arg_0, arg_1); +} + +void compute_main() { + pow_fa5429(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/pow/fa5429.wgsl.expected.msl b/test/tint/builtins/gen/var/pow/fa5429.wgsl.expected.msl new file mode 100644 index 0000000000..34042bc3a3 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/fa5429.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void pow_fa5429() { + half3 arg_0 = half3(0.0h); + half3 arg_1 = half3(0.0h); + half3 res = pow(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + pow_fa5429(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + pow_fa5429(); + return; +} + +kernel void compute_main() { + pow_fa5429(); + return; +} + diff --git a/test/tint/builtins/gen/var/pow/fa5429.wgsl.expected.spvasm b/test/tint/builtins/gen/var/pow/fa5429.wgsl.expected.spvasm new file mode 100644 index 0000000000..88b8df2dc7 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/fa5429.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %pow_fa5429 "pow_fa5429" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %pow_fa5429 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %arg_1 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v3half %arg_0 + %22 = OpLoad %v3half %arg_1 + %19 = OpExtInst %v3half %20 Pow %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %pow_fa5429 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %pow_fa5429 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %pow_fa5429 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/pow/fa5429.wgsl.expected.wgsl b/test/tint/builtins/gen/var/pow/fa5429.wgsl.expected.wgsl new file mode 100644 index 0000000000..41114c9302 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/fa5429.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn pow_fa5429() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var res : vec3 = pow(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_fa5429(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_fa5429(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_fa5429(); +} diff --git a/test/tint/builtins/gen/var/radians/208fd9.wgsl b/test/tint/builtins/gen/var/radians/208fd9.wgsl new file mode 100644 index 0000000000..5bf9902339 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/208fd9.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn radians(f16) -> f16 +fn radians_208fd9() { + var arg_0 = f16(); + var res: f16 = radians(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_208fd9(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_208fd9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_208fd9(); +} diff --git a/test/tint/builtins/gen/var/radians/208fd9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/radians/208fd9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..627ac2c15c --- /dev/null +++ b/test/tint/builtins/gen/var/radians/208fd9.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +float16_t tint_radians(float16_t param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_208fd9() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = tint_radians(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_208fd9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_208fd9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_208fd9(); + return; +} diff --git a/test/tint/builtins/gen/var/radians/208fd9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/radians/208fd9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d26e91ecaa --- /dev/null +++ b/test/tint/builtins/gen/var/radians/208fd9.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +float16_t tint_radians(float16_t param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_208fd9() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = tint_radians(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_208fd9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_208fd9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_208fd9(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000025E7A643540(1,1-9): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/builtins/gen/var/radians/208fd9.wgsl.expected.glsl b/test/tint/builtins/gen/var/radians/208fd9.wgsl.expected.glsl new file mode 100644 index 0000000000..d22a648619 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/208fd9.wgsl.expected.glsl @@ -0,0 +1,70 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +float16_t tint_radians(float16_t param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_208fd9() { + float16_t arg_0 = 0.0hf; + float16_t res = tint_radians(arg_0); +} + +vec4 vertex_main() { + radians_208fd9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +float16_t tint_radians(float16_t param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_208fd9() { + float16_t arg_0 = 0.0hf; + float16_t res = tint_radians(arg_0); +} + +void fragment_main() { + radians_208fd9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +float16_t tint_radians(float16_t param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_208fd9() { + float16_t arg_0 = 0.0hf; + float16_t res = tint_radians(arg_0); +} + +void compute_main() { + radians_208fd9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/radians/208fd9.wgsl.expected.msl b/test/tint/builtins/gen/var/radians/208fd9.wgsl.expected.msl new file mode 100644 index 0000000000..936220398c --- /dev/null +++ b/test/tint/builtins/gen/var/radians/208fd9.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; + +half tint_radians(half param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_208fd9() { + half arg_0 = 0.0h; + half res = tint_radians(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + radians_208fd9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + radians_208fd9(); + return; +} + +kernel void compute_main() { + radians_208fd9(); + return; +} + diff --git a/test/tint/builtins/gen/var/radians/208fd9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/radians/208fd9.wgsl.expected.spvasm new file mode 100644 index 0000000000..40920c5a43 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/208fd9.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %radians_208fd9 "radians_208fd9" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%radians_208fd9 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Radians %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %radians_208fd9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %radians_208fd9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %radians_208fd9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/radians/208fd9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/radians/208fd9.wgsl.expected.wgsl new file mode 100644 index 0000000000..9c78c61300 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/208fd9.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn radians_208fd9() { + var arg_0 = f16(); + var res : f16 = radians(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_208fd9(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_208fd9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_208fd9(); +} diff --git a/test/tint/builtins/gen/var/radians/44f20b.wgsl b/test/tint/builtins/gen/var/radians/44f20b.wgsl new file mode 100644 index 0000000000..0cfd5005cf --- /dev/null +++ b/test/tint/builtins/gen/var/radians/44f20b.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn radians(vec<4, f16>) -> vec<4, f16> +fn radians_44f20b() { + var arg_0 = vec4(f16()); + var res: vec4 = radians(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_44f20b(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_44f20b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_44f20b(); +} diff --git a/test/tint/builtins/gen/var/radians/44f20b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/radians/44f20b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..81c50d08b6 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/44f20b.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +vector tint_radians(vector param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_44f20b() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = tint_radians(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_44f20b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_44f20b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_44f20b(); + return; +} diff --git a/test/tint/builtins/gen/var/radians/44f20b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/radians/44f20b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e58dd03ea3 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/44f20b.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +vector tint_radians(vector param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_44f20b() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = tint_radians(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_44f20b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_44f20b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_44f20b(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F25F161620(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/radians/44f20b.wgsl.expected.glsl b/test/tint/builtins/gen/var/radians/44f20b.wgsl.expected.glsl new file mode 100644 index 0000000000..ef2074733e --- /dev/null +++ b/test/tint/builtins/gen/var/radians/44f20b.wgsl.expected.glsl @@ -0,0 +1,70 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec4 tint_radians(f16vec4 param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_44f20b() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = tint_radians(arg_0); +} + +vec4 vertex_main() { + radians_44f20b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec4 tint_radians(f16vec4 param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_44f20b() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = tint_radians(arg_0); +} + +void fragment_main() { + radians_44f20b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec4 tint_radians(f16vec4 param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_44f20b() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = tint_radians(arg_0); +} + +void compute_main() { + radians_44f20b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/radians/44f20b.wgsl.expected.msl b/test/tint/builtins/gen/var/radians/44f20b.wgsl.expected.msl new file mode 100644 index 0000000000..d2f6566e91 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/44f20b.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; + +half4 tint_radians(half4 param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_44f20b() { + half4 arg_0 = half4(0.0h); + half4 res = tint_radians(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + radians_44f20b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + radians_44f20b(); + return; +} + +kernel void compute_main() { + radians_44f20b(); + return; +} + diff --git a/test/tint/builtins/gen/var/radians/44f20b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/radians/44f20b.wgsl.expected.spvasm new file mode 100644 index 0000000000..f11ab7a5cc --- /dev/null +++ b/test/tint/builtins/gen/var/radians/44f20b.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %radians_44f20b "radians_44f20b" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%radians_44f20b = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Radians %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %radians_44f20b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %radians_44f20b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %radians_44f20b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/radians/44f20b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/radians/44f20b.wgsl.expected.wgsl new file mode 100644 index 0000000000..96830d7379 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/44f20b.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn radians_44f20b() { + var arg_0 = vec4(f16()); + var res : vec4 = radians(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_44f20b(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_44f20b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_44f20b(); +} diff --git a/test/tint/builtins/gen/var/radians/7ea4c7.wgsl b/test/tint/builtins/gen/var/radians/7ea4c7.wgsl new file mode 100644 index 0000000000..693ec90dd9 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/7ea4c7.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn radians(vec<3, f16>) -> vec<3, f16> +fn radians_7ea4c7() { + var arg_0 = vec3(f16()); + var res: vec3 = radians(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_7ea4c7(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_7ea4c7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_7ea4c7(); +} diff --git a/test/tint/builtins/gen/var/radians/7ea4c7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/radians/7ea4c7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3367a757c5 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/7ea4c7.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +vector tint_radians(vector param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_7ea4c7() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = tint_radians(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_7ea4c7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_7ea4c7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_7ea4c7(); + return; +} diff --git a/test/tint/builtins/gen/var/radians/7ea4c7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/radians/7ea4c7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ca0996d2b6 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/7ea4c7.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +vector tint_radians(vector param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_7ea4c7() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = tint_radians(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_7ea4c7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_7ea4c7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_7ea4c7(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020CCED30150(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/radians/7ea4c7.wgsl.expected.glsl b/test/tint/builtins/gen/var/radians/7ea4c7.wgsl.expected.glsl new file mode 100644 index 0000000000..8d3f103373 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/7ea4c7.wgsl.expected.glsl @@ -0,0 +1,70 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec3 tint_radians(f16vec3 param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_7ea4c7() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = tint_radians(arg_0); +} + +vec4 vertex_main() { + radians_7ea4c7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec3 tint_radians(f16vec3 param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_7ea4c7() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = tint_radians(arg_0); +} + +void fragment_main() { + radians_7ea4c7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec3 tint_radians(f16vec3 param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_7ea4c7() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = tint_radians(arg_0); +} + +void compute_main() { + radians_7ea4c7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/radians/7ea4c7.wgsl.expected.msl b/test/tint/builtins/gen/var/radians/7ea4c7.wgsl.expected.msl new file mode 100644 index 0000000000..a77294f448 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/7ea4c7.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; + +half3 tint_radians(half3 param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_7ea4c7() { + half3 arg_0 = half3(0.0h); + half3 res = tint_radians(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + radians_7ea4c7(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + radians_7ea4c7(); + return; +} + +kernel void compute_main() { + radians_7ea4c7(); + return; +} + diff --git a/test/tint/builtins/gen/var/radians/7ea4c7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/radians/7ea4c7.wgsl.expected.spvasm new file mode 100644 index 0000000000..51771841af --- /dev/null +++ b/test/tint/builtins/gen/var/radians/7ea4c7.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %radians_7ea4c7 "radians_7ea4c7" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%radians_7ea4c7 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Radians %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %radians_7ea4c7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %radians_7ea4c7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %radians_7ea4c7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/radians/7ea4c7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/radians/7ea4c7.wgsl.expected.wgsl new file mode 100644 index 0000000000..2107e43ab2 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/7ea4c7.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn radians_7ea4c7() { + var arg_0 = vec3(f16()); + var res : vec3 = radians(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_7ea4c7(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_7ea4c7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_7ea4c7(); +} diff --git a/test/tint/builtins/gen/var/radians/fbacf0.wgsl b/test/tint/builtins/gen/var/radians/fbacf0.wgsl new file mode 100644 index 0000000000..87814c0bd6 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/fbacf0.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn radians(vec<2, f16>) -> vec<2, f16> +fn radians_fbacf0() { + var arg_0 = vec2(f16()); + var res: vec2 = radians(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_fbacf0(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_fbacf0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_fbacf0(); +} diff --git a/test/tint/builtins/gen/var/radians/fbacf0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/radians/fbacf0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8316865280 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/fbacf0.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +vector tint_radians(vector param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_fbacf0() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = tint_radians(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_fbacf0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_fbacf0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_fbacf0(); + return; +} diff --git a/test/tint/builtins/gen/var/radians/fbacf0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/radians/fbacf0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0ea92aba93 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/fbacf0.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +vector tint_radians(vector param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_fbacf0() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = tint_radians(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_fbacf0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_fbacf0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_fbacf0(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002290DE021A0(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/radians/fbacf0.wgsl.expected.glsl b/test/tint/builtins/gen/var/radians/fbacf0.wgsl.expected.glsl new file mode 100644 index 0000000000..f53a087d9c --- /dev/null +++ b/test/tint/builtins/gen/var/radians/fbacf0.wgsl.expected.glsl @@ -0,0 +1,70 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec2 tint_radians(f16vec2 param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_fbacf0() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = tint_radians(arg_0); +} + +vec4 vertex_main() { + radians_fbacf0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec2 tint_radians(f16vec2 param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_fbacf0() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = tint_radians(arg_0); +} + +void fragment_main() { + radians_fbacf0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec2 tint_radians(f16vec2 param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_fbacf0() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = tint_radians(arg_0); +} + +void compute_main() { + radians_fbacf0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/radians/fbacf0.wgsl.expected.msl b/test/tint/builtins/gen/var/radians/fbacf0.wgsl.expected.msl new file mode 100644 index 0000000000..6dcfa5b572 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/fbacf0.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; + +half2 tint_radians(half2 param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_fbacf0() { + half2 arg_0 = half2(0.0h); + half2 res = tint_radians(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + radians_fbacf0(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + radians_fbacf0(); + return; +} + +kernel void compute_main() { + radians_fbacf0(); + return; +} + diff --git a/test/tint/builtins/gen/var/radians/fbacf0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/radians/fbacf0.wgsl.expected.spvasm new file mode 100644 index 0000000000..aa11ee5a6e --- /dev/null +++ b/test/tint/builtins/gen/var/radians/fbacf0.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %radians_fbacf0 "radians_fbacf0" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%radians_fbacf0 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Radians %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %radians_fbacf0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %radians_fbacf0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %radians_fbacf0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/radians/fbacf0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/radians/fbacf0.wgsl.expected.wgsl new file mode 100644 index 0000000000..d463eb9224 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/fbacf0.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn radians_fbacf0() { + var arg_0 = vec2(f16()); + var res : vec2 = radians(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_fbacf0(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_fbacf0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_fbacf0(); +} diff --git a/test/tint/builtins/gen/var/reflect/310de5.wgsl b/test/tint/builtins/gen/var/reflect/310de5.wgsl new file mode 100644 index 0000000000..6fd29f5a4e --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/310de5.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn reflect(vec<4, f16>, vec<4, f16>) -> vec<4, f16> +fn reflect_310de5() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var res: vec4 = reflect(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reflect_310de5(); + return vec4(); +} + +@fragment +fn fragment_main() { + reflect_310de5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reflect_310de5(); +} diff --git a/test/tint/builtins/gen/var/reflect/310de5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/reflect/310de5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..42cc8e6fb4 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/310de5.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void reflect_310de5() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + vector res = reflect(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reflect_310de5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reflect_310de5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reflect_310de5(); + return; +} diff --git a/test/tint/builtins/gen/var/reflect/310de5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/reflect/310de5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..30317a441e --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/310de5.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void reflect_310de5() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + vector res = reflect(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reflect_310de5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reflect_310de5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reflect_310de5(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001A447B2CCB0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001A447B2CCB0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001A447B2CCB0(4,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/reflect/310de5.wgsl.expected.glsl b/test/tint/builtins/gen/var/reflect/310de5.wgsl.expected.glsl new file mode 100644 index 0000000000..1b9cab0bfa --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/310de5.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void reflect_310de5() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 res = reflect(arg_0, arg_1); +} + +vec4 vertex_main() { + reflect_310de5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void reflect_310de5() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 res = reflect(arg_0, arg_1); +} + +void fragment_main() { + reflect_310de5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void reflect_310de5() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 res = reflect(arg_0, arg_1); +} + +void compute_main() { + reflect_310de5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/reflect/310de5.wgsl.expected.msl b/test/tint/builtins/gen/var/reflect/310de5.wgsl.expected.msl new file mode 100644 index 0000000000..bc73148543 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/310de5.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void reflect_310de5() { + half4 arg_0 = half4(0.0h); + half4 arg_1 = half4(0.0h); + half4 res = reflect(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + reflect_310de5(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + reflect_310de5(); + return; +} + +kernel void compute_main() { + reflect_310de5(); + return; +} + diff --git a/test/tint/builtins/gen/var/reflect/310de5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/reflect/310de5.wgsl.expected.spvasm new file mode 100644 index 0000000000..bcace4f63c --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/310de5.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %reflect_310de5 "reflect_310de5" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%reflect_310de5 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %arg_1 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v4half %arg_0 + %22 = OpLoad %v4half %arg_1 + %19 = OpExtInst %v4half %20 Reflect %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %reflect_310de5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %reflect_310de5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %reflect_310de5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/reflect/310de5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/reflect/310de5.wgsl.expected.wgsl new file mode 100644 index 0000000000..09432f5762 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/310de5.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn reflect_310de5() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var res : vec4 = reflect(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reflect_310de5(); + return vec4(); +} + +@fragment +fn fragment_main() { + reflect_310de5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reflect_310de5(); +} diff --git a/test/tint/builtins/gen/var/reflect/61ca21.wgsl b/test/tint/builtins/gen/var/reflect/61ca21.wgsl new file mode 100644 index 0000000000..f7ae376437 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/61ca21.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn reflect(vec<3, f16>, vec<3, f16>) -> vec<3, f16> +fn reflect_61ca21() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var res: vec3 = reflect(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reflect_61ca21(); + return vec4(); +} + +@fragment +fn fragment_main() { + reflect_61ca21(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reflect_61ca21(); +} diff --git a/test/tint/builtins/gen/var/reflect/61ca21.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/reflect/61ca21.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..75d40079a0 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/61ca21.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void reflect_61ca21() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector res = reflect(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reflect_61ca21(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reflect_61ca21(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reflect_61ca21(); + return; +} diff --git a/test/tint/builtins/gen/var/reflect/61ca21.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/reflect/61ca21.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7f3977ef31 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/61ca21.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void reflect_61ca21() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector res = reflect(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reflect_61ca21(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reflect_61ca21(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reflect_61ca21(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002B6431BD140(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002B6431BD140(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002B6431BD140(4,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/reflect/61ca21.wgsl.expected.glsl b/test/tint/builtins/gen/var/reflect/61ca21.wgsl.expected.glsl new file mode 100644 index 0000000000..ab22f2d094 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/61ca21.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void reflect_61ca21() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 res = reflect(arg_0, arg_1); +} + +vec4 vertex_main() { + reflect_61ca21(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void reflect_61ca21() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 res = reflect(arg_0, arg_1); +} + +void fragment_main() { + reflect_61ca21(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void reflect_61ca21() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 res = reflect(arg_0, arg_1); +} + +void compute_main() { + reflect_61ca21(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/reflect/61ca21.wgsl.expected.msl b/test/tint/builtins/gen/var/reflect/61ca21.wgsl.expected.msl new file mode 100644 index 0000000000..7ffb26a1a6 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/61ca21.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void reflect_61ca21() { + half3 arg_0 = half3(0.0h); + half3 arg_1 = half3(0.0h); + half3 res = reflect(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + reflect_61ca21(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + reflect_61ca21(); + return; +} + +kernel void compute_main() { + reflect_61ca21(); + return; +} + diff --git a/test/tint/builtins/gen/var/reflect/61ca21.wgsl.expected.spvasm b/test/tint/builtins/gen/var/reflect/61ca21.wgsl.expected.spvasm new file mode 100644 index 0000000000..ad8f002a5d --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/61ca21.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %reflect_61ca21 "reflect_61ca21" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%reflect_61ca21 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %arg_1 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v3half %arg_0 + %22 = OpLoad %v3half %arg_1 + %19 = OpExtInst %v3half %20 Reflect %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %reflect_61ca21 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %reflect_61ca21 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %reflect_61ca21 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/reflect/61ca21.wgsl.expected.wgsl b/test/tint/builtins/gen/var/reflect/61ca21.wgsl.expected.wgsl new file mode 100644 index 0000000000..c7e04a80ad --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/61ca21.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn reflect_61ca21() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var res : vec3 = reflect(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reflect_61ca21(); + return vec4(); +} + +@fragment +fn fragment_main() { + reflect_61ca21(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reflect_61ca21(); +} diff --git a/test/tint/builtins/gen/var/reflect/bb15ac.wgsl b/test/tint/builtins/gen/var/reflect/bb15ac.wgsl new file mode 100644 index 0000000000..ae704f43b3 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/bb15ac.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn reflect(vec<2, f16>, vec<2, f16>) -> vec<2, f16> +fn reflect_bb15ac() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var res: vec2 = reflect(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reflect_bb15ac(); + return vec4(); +} + +@fragment +fn fragment_main() { + reflect_bb15ac(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reflect_bb15ac(); +} diff --git a/test/tint/builtins/gen/var/reflect/bb15ac.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/reflect/bb15ac.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..445e4f2b99 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/bb15ac.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void reflect_bb15ac() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + vector res = reflect(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reflect_bb15ac(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reflect_bb15ac(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reflect_bb15ac(); + return; +} diff --git a/test/tint/builtins/gen/var/reflect/bb15ac.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/reflect/bb15ac.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..797983714b --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/bb15ac.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void reflect_bb15ac() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + vector res = reflect(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reflect_bb15ac(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reflect_bb15ac(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reflect_bb15ac(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D1F2206F80(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D1F2206F80(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D1F2206F80(4,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/reflect/bb15ac.wgsl.expected.glsl b/test/tint/builtins/gen/var/reflect/bb15ac.wgsl.expected.glsl new file mode 100644 index 0000000000..a52e6db055 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/bb15ac.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void reflect_bb15ac() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 res = reflect(arg_0, arg_1); +} + +vec4 vertex_main() { + reflect_bb15ac(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void reflect_bb15ac() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 res = reflect(arg_0, arg_1); +} + +void fragment_main() { + reflect_bb15ac(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void reflect_bb15ac() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 res = reflect(arg_0, arg_1); +} + +void compute_main() { + reflect_bb15ac(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/reflect/bb15ac.wgsl.expected.msl b/test/tint/builtins/gen/var/reflect/bb15ac.wgsl.expected.msl new file mode 100644 index 0000000000..bee45f3640 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/bb15ac.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void reflect_bb15ac() { + half2 arg_0 = half2(0.0h); + half2 arg_1 = half2(0.0h); + half2 res = reflect(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + reflect_bb15ac(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + reflect_bb15ac(); + return; +} + +kernel void compute_main() { + reflect_bb15ac(); + return; +} + diff --git a/test/tint/builtins/gen/var/reflect/bb15ac.wgsl.expected.spvasm b/test/tint/builtins/gen/var/reflect/bb15ac.wgsl.expected.spvasm new file mode 100644 index 0000000000..9af402ba42 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/bb15ac.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %reflect_bb15ac "reflect_bb15ac" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%reflect_bb15ac = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %arg_1 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v2half %arg_0 + %22 = OpLoad %v2half %arg_1 + %19 = OpExtInst %v2half %20 Reflect %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %reflect_bb15ac + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %reflect_bb15ac + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %reflect_bb15ac + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/reflect/bb15ac.wgsl.expected.wgsl b/test/tint/builtins/gen/var/reflect/bb15ac.wgsl.expected.wgsl new file mode 100644 index 0000000000..68a49b217f --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/bb15ac.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn reflect_bb15ac() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var res : vec2 = reflect(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reflect_bb15ac(); + return vec4(); +} + +@fragment +fn fragment_main() { + reflect_bb15ac(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reflect_bb15ac(); +} diff --git a/test/tint/builtins/gen/var/refract/0594ba.wgsl b/test/tint/builtins/gen/var/refract/0594ba.wgsl new file mode 100644 index 0000000000..f6833015fd --- /dev/null +++ b/test/tint/builtins/gen/var/refract/0594ba.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn refract(vec<4, f16>, vec<4, f16>, f16) -> vec<4, f16> +fn refract_0594ba() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var arg_2 = f16(); + var res: vec4 = refract(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + refract_0594ba(); + return vec4(); +} + +@fragment +fn fragment_main() { + refract_0594ba(); +} + +@compute @workgroup_size(1) +fn compute_main() { + refract_0594ba(); +} diff --git a/test/tint/builtins/gen/var/refract/0594ba.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/refract/0594ba.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..463d65f125 --- /dev/null +++ b/test/tint/builtins/gen/var/refract/0594ba.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void refract_0594ba() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + float16_t arg_2 = float16_t(0.0h); + vector res = refract(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + refract_0594ba(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + refract_0594ba(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + refract_0594ba(); + return; +} diff --git a/test/tint/builtins/gen/var/refract/0594ba.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/refract/0594ba.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9201cef51c --- /dev/null +++ b/test/tint/builtins/gen/var/refract/0594ba.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +SKIP: FAILED + +void refract_0594ba() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + float16_t arg_2 = float16_t(0.0h); + vector res = refract(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + refract_0594ba(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + refract_0594ba(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + refract_0594ba(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D61952A880(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D61952A880(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D61952A880(4,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D61952A880(4,13-17): error X3000: unrecognized identifier 'arg_2' + diff --git a/test/tint/builtins/gen/var/refract/0594ba.wgsl.expected.glsl b/test/tint/builtins/gen/var/refract/0594ba.wgsl.expected.glsl new file mode 100644 index 0000000000..cd98e8619a --- /dev/null +++ b/test/tint/builtins/gen/var/refract/0594ba.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void refract_0594ba() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + float16_t arg_2 = 0.0hf; + f16vec4 res = refract(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + refract_0594ba(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void refract_0594ba() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + float16_t arg_2 = 0.0hf; + f16vec4 res = refract(arg_0, arg_1, arg_2); +} + +void fragment_main() { + refract_0594ba(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void refract_0594ba() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + float16_t arg_2 = 0.0hf; + f16vec4 res = refract(arg_0, arg_1, arg_2); +} + +void compute_main() { + refract_0594ba(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/refract/0594ba.wgsl.expected.msl b/test/tint/builtins/gen/var/refract/0594ba.wgsl.expected.msl new file mode 100644 index 0000000000..d0cb126000 --- /dev/null +++ b/test/tint/builtins/gen/var/refract/0594ba.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void refract_0594ba() { + half4 arg_0 = half4(0.0h); + half4 arg_1 = half4(0.0h); + half arg_2 = 0.0h; + half4 res = refract(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + refract_0594ba(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + refract_0594ba(); + return; +} + +kernel void compute_main() { + refract_0594ba(); + return; +} + diff --git a/test/tint/builtins/gen/var/refract/0594ba.wgsl.expected.spvasm b/test/tint/builtins/gen/var/refract/0594ba.wgsl.expected.spvasm new file mode 100644 index 0000000000..c8b16c60e2 --- /dev/null +++ b/test/tint/builtins/gen/var/refract/0594ba.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %refract_0594ba "refract_0594ba" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %19 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %28 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%refract_0594ba = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %arg_1 = OpVariable %_ptr_Function_v4half Function %15 + %arg_2 = OpVariable %_ptr_Function_half Function %19 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %19 + %24 = OpLoad %v4half %arg_0 + %25 = OpLoad %v4half %arg_1 + %26 = OpLoad %half %arg_2 + %22 = OpExtInst %v4half %23 Refract %24 %25 %26 + OpStore %res %22 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %refract_0594ba + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %refract_0594ba + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %void %refract_0594ba + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/refract/0594ba.wgsl.expected.wgsl b/test/tint/builtins/gen/var/refract/0594ba.wgsl.expected.wgsl new file mode 100644 index 0000000000..d015c26289 --- /dev/null +++ b/test/tint/builtins/gen/var/refract/0594ba.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn refract_0594ba() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var arg_2 = f16(); + var res : vec4 = refract(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + refract_0594ba(); + return vec4(); +} + +@fragment +fn fragment_main() { + refract_0594ba(); +} + +@compute @workgroup_size(1) +fn compute_main() { + refract_0594ba(); +} diff --git a/test/tint/builtins/gen/var/refract/570cb3.wgsl b/test/tint/builtins/gen/var/refract/570cb3.wgsl new file mode 100644 index 0000000000..1c5b9539d3 --- /dev/null +++ b/test/tint/builtins/gen/var/refract/570cb3.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn refract(vec<2, f16>, vec<2, f16>, f16) -> vec<2, f16> +fn refract_570cb3() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var arg_2 = f16(); + var res: vec2 = refract(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + refract_570cb3(); + return vec4(); +} + +@fragment +fn fragment_main() { + refract_570cb3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + refract_570cb3(); +} diff --git a/test/tint/builtins/gen/var/refract/570cb3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/refract/570cb3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..63ce95b63c --- /dev/null +++ b/test/tint/builtins/gen/var/refract/570cb3.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void refract_570cb3() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + float16_t arg_2 = float16_t(0.0h); + vector res = refract(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + refract_570cb3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + refract_570cb3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + refract_570cb3(); + return; +} diff --git a/test/tint/builtins/gen/var/refract/570cb3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/refract/570cb3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7d3be7dd88 --- /dev/null +++ b/test/tint/builtins/gen/var/refract/570cb3.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +SKIP: FAILED + +void refract_570cb3() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + float16_t arg_2 = float16_t(0.0h); + vector res = refract(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + refract_570cb3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + refract_570cb3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + refract_570cb3(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001BAD82D3A70(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001BAD82D3A70(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001BAD82D3A70(4,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001BAD82D3A70(4,13-17): error X3000: unrecognized identifier 'arg_2' + diff --git a/test/tint/builtins/gen/var/refract/570cb3.wgsl.expected.glsl b/test/tint/builtins/gen/var/refract/570cb3.wgsl.expected.glsl new file mode 100644 index 0000000000..16ff162f9a --- /dev/null +++ b/test/tint/builtins/gen/var/refract/570cb3.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void refract_570cb3() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + float16_t arg_2 = 0.0hf; + f16vec2 res = refract(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + refract_570cb3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void refract_570cb3() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + float16_t arg_2 = 0.0hf; + f16vec2 res = refract(arg_0, arg_1, arg_2); +} + +void fragment_main() { + refract_570cb3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void refract_570cb3() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + float16_t arg_2 = 0.0hf; + f16vec2 res = refract(arg_0, arg_1, arg_2); +} + +void compute_main() { + refract_570cb3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/refract/570cb3.wgsl.expected.msl b/test/tint/builtins/gen/var/refract/570cb3.wgsl.expected.msl new file mode 100644 index 0000000000..2051a9cffe --- /dev/null +++ b/test/tint/builtins/gen/var/refract/570cb3.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void refract_570cb3() { + half2 arg_0 = half2(0.0h); + half2 arg_1 = half2(0.0h); + half arg_2 = 0.0h; + half2 res = refract(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + refract_570cb3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + refract_570cb3(); + return; +} + +kernel void compute_main() { + refract_570cb3(); + return; +} + diff --git a/test/tint/builtins/gen/var/refract/570cb3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/refract/570cb3.wgsl.expected.spvasm new file mode 100644 index 0000000000..d7c52d7933 --- /dev/null +++ b/test/tint/builtins/gen/var/refract/570cb3.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %refract_570cb3 "refract_570cb3" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %19 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %28 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%refract_570cb3 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %arg_1 = OpVariable %_ptr_Function_v2half Function %15 + %arg_2 = OpVariable %_ptr_Function_half Function %19 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %19 + %24 = OpLoad %v2half %arg_0 + %25 = OpLoad %v2half %arg_1 + %26 = OpLoad %half %arg_2 + %22 = OpExtInst %v2half %23 Refract %24 %25 %26 + OpStore %res %22 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %refract_570cb3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %refract_570cb3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %void %refract_570cb3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/refract/570cb3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/refract/570cb3.wgsl.expected.wgsl new file mode 100644 index 0000000000..8e2895ca7f --- /dev/null +++ b/test/tint/builtins/gen/var/refract/570cb3.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn refract_570cb3() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var arg_2 = f16(); + var res : vec2 = refract(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + refract_570cb3(); + return vec4(); +} + +@fragment +fn fragment_main() { + refract_570cb3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + refract_570cb3(); +} diff --git a/test/tint/builtins/gen/var/refract/8984af.wgsl b/test/tint/builtins/gen/var/refract/8984af.wgsl new file mode 100644 index 0000000000..1aa6ded8b3 --- /dev/null +++ b/test/tint/builtins/gen/var/refract/8984af.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn refract(vec<3, f16>, vec<3, f16>, f16) -> vec<3, f16> +fn refract_8984af() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var arg_2 = f16(); + var res: vec3 = refract(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + refract_8984af(); + return vec4(); +} + +@fragment +fn fragment_main() { + refract_8984af(); +} + +@compute @workgroup_size(1) +fn compute_main() { + refract_8984af(); +} diff --git a/test/tint/builtins/gen/var/refract/8984af.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/refract/8984af.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4c8b3e40a8 --- /dev/null +++ b/test/tint/builtins/gen/var/refract/8984af.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void refract_8984af() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + float16_t arg_2 = float16_t(0.0h); + vector res = refract(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + refract_8984af(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + refract_8984af(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + refract_8984af(); + return; +} diff --git a/test/tint/builtins/gen/var/refract/8984af.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/refract/8984af.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..260d085120 --- /dev/null +++ b/test/tint/builtins/gen/var/refract/8984af.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +SKIP: FAILED + +void refract_8984af() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + float16_t arg_2 = float16_t(0.0h); + vector res = refract(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + refract_8984af(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + refract_8984af(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + refract_8984af(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001BED048A880(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001BED048A880(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001BED048A880(4,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001BED048A880(4,13-17): error X3000: unrecognized identifier 'arg_2' + diff --git a/test/tint/builtins/gen/var/refract/8984af.wgsl.expected.glsl b/test/tint/builtins/gen/var/refract/8984af.wgsl.expected.glsl new file mode 100644 index 0000000000..c44741ede1 --- /dev/null +++ b/test/tint/builtins/gen/var/refract/8984af.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void refract_8984af() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + float16_t arg_2 = 0.0hf; + f16vec3 res = refract(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + refract_8984af(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void refract_8984af() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + float16_t arg_2 = 0.0hf; + f16vec3 res = refract(arg_0, arg_1, arg_2); +} + +void fragment_main() { + refract_8984af(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void refract_8984af() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + float16_t arg_2 = 0.0hf; + f16vec3 res = refract(arg_0, arg_1, arg_2); +} + +void compute_main() { + refract_8984af(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/refract/8984af.wgsl.expected.msl b/test/tint/builtins/gen/var/refract/8984af.wgsl.expected.msl new file mode 100644 index 0000000000..8394944213 --- /dev/null +++ b/test/tint/builtins/gen/var/refract/8984af.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void refract_8984af() { + half3 arg_0 = half3(0.0h); + half3 arg_1 = half3(0.0h); + half arg_2 = 0.0h; + half3 res = refract(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + refract_8984af(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + refract_8984af(); + return; +} + +kernel void compute_main() { + refract_8984af(); + return; +} + diff --git a/test/tint/builtins/gen/var/refract/8984af.wgsl.expected.spvasm b/test/tint/builtins/gen/var/refract/8984af.wgsl.expected.spvasm new file mode 100644 index 0000000000..4fd9ba81bb --- /dev/null +++ b/test/tint/builtins/gen/var/refract/8984af.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %refract_8984af "refract_8984af" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %19 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %28 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%refract_8984af = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %arg_1 = OpVariable %_ptr_Function_v3half Function %15 + %arg_2 = OpVariable %_ptr_Function_half Function %19 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %19 + %24 = OpLoad %v3half %arg_0 + %25 = OpLoad %v3half %arg_1 + %26 = OpLoad %half %arg_2 + %22 = OpExtInst %v3half %23 Refract %24 %25 %26 + OpStore %res %22 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %refract_8984af + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %refract_8984af + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %void %refract_8984af + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/refract/8984af.wgsl.expected.wgsl b/test/tint/builtins/gen/var/refract/8984af.wgsl.expected.wgsl new file mode 100644 index 0000000000..69d2b2f9ab --- /dev/null +++ b/test/tint/builtins/gen/var/refract/8984af.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn refract_8984af() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var arg_2 = f16(); + var res : vec3 = refract(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + refract_8984af(); + return vec4(); +} + +@fragment +fn fragment_main() { + refract_8984af(); +} + +@compute @workgroup_size(1) +fn compute_main() { + refract_8984af(); +} diff --git a/test/tint/builtins/gen/var/round/9078ef.wgsl b/test/tint/builtins/gen/var/round/9078ef.wgsl new file mode 100644 index 0000000000..e52a222781 --- /dev/null +++ b/test/tint/builtins/gen/var/round/9078ef.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn round(f16) -> f16 +fn round_9078ef() { + var arg_0 = f16(); + var res: f16 = round(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_9078ef(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_9078ef(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_9078ef(); +} diff --git a/test/tint/builtins/gen/var/round/9078ef.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/round/9078ef.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cc87dbb813 --- /dev/null +++ b/test/tint/builtins/gen/var/round/9078ef.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void round_9078ef() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = round(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_9078ef(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_9078ef(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_9078ef(); + return; +} diff --git a/test/tint/builtins/gen/var/round/9078ef.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/round/9078ef.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b1f7b10bb9 --- /dev/null +++ b/test/tint/builtins/gen/var/round/9078ef.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void round_9078ef() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = round(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_9078ef(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_9078ef(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_9078ef(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021E2DBC1640(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021E2DBC1640(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/round/9078ef.wgsl.expected.glsl b/test/tint/builtins/gen/var/round/9078ef.wgsl.expected.glsl new file mode 100644 index 0000000000..0c0cd16e3c --- /dev/null +++ b/test/tint/builtins/gen/var/round/9078ef.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void round_9078ef() { + float16_t arg_0 = 0.0hf; + float16_t res = round(arg_0); +} + +vec4 vertex_main() { + round_9078ef(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void round_9078ef() { + float16_t arg_0 = 0.0hf; + float16_t res = round(arg_0); +} + +void fragment_main() { + round_9078ef(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void round_9078ef() { + float16_t arg_0 = 0.0hf; + float16_t res = round(arg_0); +} + +void compute_main() { + round_9078ef(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/round/9078ef.wgsl.expected.msl b/test/tint/builtins/gen/var/round/9078ef.wgsl.expected.msl new file mode 100644 index 0000000000..c7e44da66f --- /dev/null +++ b/test/tint/builtins/gen/var/round/9078ef.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void round_9078ef() { + half arg_0 = 0.0h; + half res = rint(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + round_9078ef(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + round_9078ef(); + return; +} + +kernel void compute_main() { + round_9078ef(); + return; +} + diff --git a/test/tint/builtins/gen/var/round/9078ef.wgsl.expected.spvasm b/test/tint/builtins/gen/var/round/9078ef.wgsl.expected.spvasm new file mode 100644 index 0000000000..a5304a4466 --- /dev/null +++ b/test/tint/builtins/gen/var/round/9078ef.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %round_9078ef "round_9078ef" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%round_9078ef = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 RoundEven %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %round_9078ef + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %round_9078ef + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %round_9078ef + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/round/9078ef.wgsl.expected.wgsl b/test/tint/builtins/gen/var/round/9078ef.wgsl.expected.wgsl new file mode 100644 index 0000000000..9a6439d3d8 --- /dev/null +++ b/test/tint/builtins/gen/var/round/9078ef.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn round_9078ef() { + var arg_0 = f16(); + var res : f16 = round(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_9078ef(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_9078ef(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_9078ef(); +} diff --git a/test/tint/builtins/gen/var/round/d87e84.wgsl b/test/tint/builtins/gen/var/round/d87e84.wgsl new file mode 100644 index 0000000000..d130d9568d --- /dev/null +++ b/test/tint/builtins/gen/var/round/d87e84.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn round(vec<2, f16>) -> vec<2, f16> +fn round_d87e84() { + var arg_0 = vec2(f16()); + var res: vec2 = round(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_d87e84(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_d87e84(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_d87e84(); +} diff --git a/test/tint/builtins/gen/var/round/d87e84.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/round/d87e84.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0c4ec1d073 --- /dev/null +++ b/test/tint/builtins/gen/var/round/d87e84.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void round_d87e84() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = round(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_d87e84(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_d87e84(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_d87e84(); + return; +} diff --git a/test/tint/builtins/gen/var/round/d87e84.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/round/d87e84.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..95b83e2b2e --- /dev/null +++ b/test/tint/builtins/gen/var/round/d87e84.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void round_d87e84() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = round(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_d87e84(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_d87e84(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_d87e84(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000013FF5D11570(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000013FF5D11570(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/round/d87e84.wgsl.expected.glsl b/test/tint/builtins/gen/var/round/d87e84.wgsl.expected.glsl new file mode 100644 index 0000000000..bb031c30e3 --- /dev/null +++ b/test/tint/builtins/gen/var/round/d87e84.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void round_d87e84() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = round(arg_0); +} + +vec4 vertex_main() { + round_d87e84(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void round_d87e84() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = round(arg_0); +} + +void fragment_main() { + round_d87e84(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void round_d87e84() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = round(arg_0); +} + +void compute_main() { + round_d87e84(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/round/d87e84.wgsl.expected.msl b/test/tint/builtins/gen/var/round/d87e84.wgsl.expected.msl new file mode 100644 index 0000000000..70a4f41b19 --- /dev/null +++ b/test/tint/builtins/gen/var/round/d87e84.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void round_d87e84() { + half2 arg_0 = half2(0.0h); + half2 res = rint(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + round_d87e84(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + round_d87e84(); + return; +} + +kernel void compute_main() { + round_d87e84(); + return; +} + diff --git a/test/tint/builtins/gen/var/round/d87e84.wgsl.expected.spvasm b/test/tint/builtins/gen/var/round/d87e84.wgsl.expected.spvasm new file mode 100644 index 0000000000..a6956ed787 --- /dev/null +++ b/test/tint/builtins/gen/var/round/d87e84.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %round_d87e84 "round_d87e84" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%round_d87e84 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 RoundEven %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %round_d87e84 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %round_d87e84 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %round_d87e84 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/round/d87e84.wgsl.expected.wgsl b/test/tint/builtins/gen/var/round/d87e84.wgsl.expected.wgsl new file mode 100644 index 0000000000..8911fc3586 --- /dev/null +++ b/test/tint/builtins/gen/var/round/d87e84.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn round_d87e84() { + var arg_0 = vec2(f16()); + var res : vec2 = round(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_d87e84(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_d87e84(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_d87e84(); +} diff --git a/test/tint/builtins/gen/var/round/e1bba2.wgsl b/test/tint/builtins/gen/var/round/e1bba2.wgsl new file mode 100644 index 0000000000..a4494e276b --- /dev/null +++ b/test/tint/builtins/gen/var/round/e1bba2.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn round(vec<3, f16>) -> vec<3, f16> +fn round_e1bba2() { + var arg_0 = vec3(f16()); + var res: vec3 = round(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_e1bba2(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_e1bba2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_e1bba2(); +} diff --git a/test/tint/builtins/gen/var/round/e1bba2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/round/e1bba2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..073bbfd68f --- /dev/null +++ b/test/tint/builtins/gen/var/round/e1bba2.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void round_e1bba2() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = round(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_e1bba2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_e1bba2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_e1bba2(); + return; +} diff --git a/test/tint/builtins/gen/var/round/e1bba2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/round/e1bba2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..64c5a88a65 --- /dev/null +++ b/test/tint/builtins/gen/var/round/e1bba2.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void round_e1bba2() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = round(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_e1bba2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_e1bba2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_e1bba2(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002DBC8633250(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002DBC8633250(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/round/e1bba2.wgsl.expected.glsl b/test/tint/builtins/gen/var/round/e1bba2.wgsl.expected.glsl new file mode 100644 index 0000000000..421df9b05b --- /dev/null +++ b/test/tint/builtins/gen/var/round/e1bba2.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void round_e1bba2() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = round(arg_0); +} + +vec4 vertex_main() { + round_e1bba2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void round_e1bba2() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = round(arg_0); +} + +void fragment_main() { + round_e1bba2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void round_e1bba2() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = round(arg_0); +} + +void compute_main() { + round_e1bba2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/round/e1bba2.wgsl.expected.msl b/test/tint/builtins/gen/var/round/e1bba2.wgsl.expected.msl new file mode 100644 index 0000000000..06bb618516 --- /dev/null +++ b/test/tint/builtins/gen/var/round/e1bba2.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void round_e1bba2() { + half3 arg_0 = half3(0.0h); + half3 res = rint(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + round_e1bba2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + round_e1bba2(); + return; +} + +kernel void compute_main() { + round_e1bba2(); + return; +} + diff --git a/test/tint/builtins/gen/var/round/e1bba2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/round/e1bba2.wgsl.expected.spvasm new file mode 100644 index 0000000000..31be1c9d9f --- /dev/null +++ b/test/tint/builtins/gen/var/round/e1bba2.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %round_e1bba2 "round_e1bba2" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%round_e1bba2 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 RoundEven %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %round_e1bba2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %round_e1bba2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %round_e1bba2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/round/e1bba2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/round/e1bba2.wgsl.expected.wgsl new file mode 100644 index 0000000000..bd41b19fa9 --- /dev/null +++ b/test/tint/builtins/gen/var/round/e1bba2.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn round_e1bba2() { + var arg_0 = vec3(f16()); + var res : vec3 = round(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_e1bba2(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_e1bba2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_e1bba2(); +} diff --git a/test/tint/builtins/gen/var/round/f665b5.wgsl b/test/tint/builtins/gen/var/round/f665b5.wgsl new file mode 100644 index 0000000000..8297439e87 --- /dev/null +++ b/test/tint/builtins/gen/var/round/f665b5.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn round(vec<4, f16>) -> vec<4, f16> +fn round_f665b5() { + var arg_0 = vec4(f16()); + var res: vec4 = round(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_f665b5(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_f665b5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_f665b5(); +} diff --git a/test/tint/builtins/gen/var/round/f665b5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/round/f665b5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..360cf4ae09 --- /dev/null +++ b/test/tint/builtins/gen/var/round/f665b5.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void round_f665b5() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = round(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_f665b5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_f665b5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_f665b5(); + return; +} diff --git a/test/tint/builtins/gen/var/round/f665b5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/round/f665b5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b1bdd81434 --- /dev/null +++ b/test/tint/builtins/gen/var/round/f665b5.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void round_f665b5() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = round(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_f665b5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_f665b5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_f665b5(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000023EB7FA70D0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000023EB7FA70D0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/round/f665b5.wgsl.expected.glsl b/test/tint/builtins/gen/var/round/f665b5.wgsl.expected.glsl new file mode 100644 index 0000000000..d78cc6aae6 --- /dev/null +++ b/test/tint/builtins/gen/var/round/f665b5.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void round_f665b5() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = round(arg_0); +} + +vec4 vertex_main() { + round_f665b5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void round_f665b5() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = round(arg_0); +} + +void fragment_main() { + round_f665b5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void round_f665b5() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = round(arg_0); +} + +void compute_main() { + round_f665b5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/round/f665b5.wgsl.expected.msl b/test/tint/builtins/gen/var/round/f665b5.wgsl.expected.msl new file mode 100644 index 0000000000..fb7f28ae5e --- /dev/null +++ b/test/tint/builtins/gen/var/round/f665b5.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void round_f665b5() { + half4 arg_0 = half4(0.0h); + half4 res = rint(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + round_f665b5(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + round_f665b5(); + return; +} + +kernel void compute_main() { + round_f665b5(); + return; +} + diff --git a/test/tint/builtins/gen/var/round/f665b5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/round/f665b5.wgsl.expected.spvasm new file mode 100644 index 0000000000..7eea88452a --- /dev/null +++ b/test/tint/builtins/gen/var/round/f665b5.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %round_f665b5 "round_f665b5" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%round_f665b5 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 RoundEven %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %round_f665b5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %round_f665b5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %round_f665b5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/round/f665b5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/round/f665b5.wgsl.expected.wgsl new file mode 100644 index 0000000000..b6afe2b58e --- /dev/null +++ b/test/tint/builtins/gen/var/round/f665b5.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn round_f665b5() { + var arg_0 = vec4(f16()); + var res : vec4 = round(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_f665b5(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_f665b5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_f665b5(); +} diff --git a/test/tint/builtins/gen/var/select/10e73b.wgsl b/test/tint/builtins/gen/var/select/10e73b.wgsl new file mode 100644 index 0000000000..9362b80fbd --- /dev/null +++ b/test/tint/builtins/gen/var/select/10e73b.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn select(f16, f16, bool) -> f16 +fn select_10e73b() { + var arg_0 = f16(); + var arg_1 = f16(); + var arg_2 = true; + var res: f16 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_10e73b(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_10e73b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_10e73b(); +} diff --git a/test/tint/builtins/gen/var/select/10e73b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/select/10e73b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..db83290038 --- /dev/null +++ b/test/tint/builtins/gen/var/select/10e73b.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void select_10e73b() { + float16_t arg_0 = float16_t(0.0h); + float16_t arg_1 = float16_t(0.0h); + bool arg_2 = true; + float16_t res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_10e73b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_10e73b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_10e73b(); + return; +} diff --git a/test/tint/builtins/gen/var/select/10e73b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/select/10e73b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e8c0804870 --- /dev/null +++ b/test/tint/builtins/gen/var/select/10e73b.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void select_10e73b() { + float16_t arg_0 = float16_t(0.0h); + float16_t arg_1 = float16_t(0.0h); + bool arg_2 = true; + float16_t res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_10e73b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_10e73b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_10e73b(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001B6F116BCD0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001B6F116BCD0(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/select/10e73b.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/10e73b.wgsl.expected.glsl new file mode 100644 index 0000000000..aa7382839d --- /dev/null +++ b/test/tint/builtins/gen/var/select/10e73b.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_10e73b() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + bool arg_2 = true; + float16_t res = (arg_2 ? arg_1 : arg_0); +} + +vec4 vertex_main() { + select_10e73b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void select_10e73b() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + bool arg_2 = true; + float16_t res = (arg_2 ? arg_1 : arg_0); +} + +void fragment_main() { + select_10e73b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_10e73b() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + bool arg_2 = true; + float16_t res = (arg_2 ? arg_1 : arg_0); +} + +void compute_main() { + select_10e73b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/10e73b.wgsl.expected.msl b/test/tint/builtins/gen/var/select/10e73b.wgsl.expected.msl new file mode 100644 index 0000000000..f643c290f0 --- /dev/null +++ b/test/tint/builtins/gen/var/select/10e73b.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_10e73b() { + half arg_0 = 0.0h; + half arg_1 = 0.0h; + bool arg_2 = true; + half res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_10e73b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_10e73b(); + return; +} + +kernel void compute_main() { + select_10e73b(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/10e73b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/10e73b.wgsl.expected.spvasm new file mode 100644 index 0000000000..6f8609b1d1 --- /dev/null +++ b/test/tint/builtins/gen/var/select/10e73b.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_10e73b "select_10e73b" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %bool = OpTypeBool + %true = OpConstantTrue %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %22 = OpConstantNull %bool + %28 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_10e73b = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %arg_1 = OpVariable %_ptr_Function_half Function %14 + %arg_2 = OpVariable %_ptr_Function_bool Function %22 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + OpStore %arg_2 %true + %24 = OpLoad %bool %arg_2 + %25 = OpLoad %half %arg_1 + %26 = OpLoad %half %arg_0 + %23 = OpSelect %half %24 %25 %26 + OpStore %res %23 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %select_10e73b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %select_10e73b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %void %select_10e73b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/10e73b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/10e73b.wgsl.expected.wgsl new file mode 100644 index 0000000000..a4cd0fc411 --- /dev/null +++ b/test/tint/builtins/gen/var/select/10e73b.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn select_10e73b() { + var arg_0 = f16(); + var arg_1 = f16(); + var arg_2 = true; + var res : f16 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_10e73b(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_10e73b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_10e73b(); +} diff --git a/test/tint/builtins/gen/var/select/1ada2a.wgsl b/test/tint/builtins/gen/var/select/1ada2a.wgsl new file mode 100644 index 0000000000..421c3ee35f --- /dev/null +++ b/test/tint/builtins/gen/var/select/1ada2a.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn select(vec<3, f16>, vec<3, f16>, bool) -> vec<3, f16> +fn select_1ada2a() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var arg_2 = true; + var res: vec3 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_1ada2a(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_1ada2a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_1ada2a(); +} diff --git a/test/tint/builtins/gen/var/select/1ada2a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/select/1ada2a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cdb717ce6a --- /dev/null +++ b/test/tint/builtins/gen/var/select/1ada2a.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void select_1ada2a() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + bool arg_2 = true; + vector res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_1ada2a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_1ada2a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_1ada2a(); + return; +} diff --git a/test/tint/builtins/gen/var/select/1ada2a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/select/1ada2a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a7ddf0962f --- /dev/null +++ b/test/tint/builtins/gen/var/select/1ada2a.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +void select_1ada2a() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + bool arg_2 = true; + vector res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_1ada2a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_1ada2a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_1ada2a(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001843DACE700(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001843DACE700(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001843DACE700(5,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/select/1ada2a.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/1ada2a.wgsl.expected.glsl new file mode 100644 index 0000000000..6111b1ee87 --- /dev/null +++ b/test/tint/builtins/gen/var/select/1ada2a.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_1ada2a() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + bool arg_2 = true; + f16vec3 res = (arg_2 ? arg_1 : arg_0); +} + +vec4 vertex_main() { + select_1ada2a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void select_1ada2a() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + bool arg_2 = true; + f16vec3 res = (arg_2 ? arg_1 : arg_0); +} + +void fragment_main() { + select_1ada2a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_1ada2a() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + bool arg_2 = true; + f16vec3 res = (arg_2 ? arg_1 : arg_0); +} + +void compute_main() { + select_1ada2a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/1ada2a.wgsl.expected.msl b/test/tint/builtins/gen/var/select/1ada2a.wgsl.expected.msl new file mode 100644 index 0000000000..3f236362ab --- /dev/null +++ b/test/tint/builtins/gen/var/select/1ada2a.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_1ada2a() { + half3 arg_0 = half3(0.0h); + half3 arg_1 = half3(0.0h); + bool arg_2 = true; + half3 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_1ada2a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_1ada2a(); + return; +} + +kernel void compute_main() { + select_1ada2a(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/1ada2a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/1ada2a.wgsl.expected.spvasm new file mode 100644 index 0000000000..efd6a0aec8 --- /dev/null +++ b/test/tint/builtins/gen/var/select/1ada2a.wgsl.expected.spvasm @@ -0,0 +1,92 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_1ada2a "select_1ada2a" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %bool = OpTypeBool + %true = OpConstantTrue %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %23 = OpConstantNull %bool + %v3bool = OpTypeVector %bool 3 +%_ptr_Function_v3bool = OpTypePointer Function %v3bool + %31 = OpConstantNull %v3bool + %34 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_1ada2a = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %arg_1 = OpVariable %_ptr_Function_v3half Function %15 + %arg_2 = OpVariable %_ptr_Function_bool Function %23 + %29 = OpVariable %_ptr_Function_v3bool Function %31 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %true + %25 = OpLoad %bool %arg_2 + %26 = OpLoad %v3half %arg_1 + %27 = OpLoad %v3half %arg_0 + %32 = OpCompositeConstruct %v3bool %25 %25 %25 + %24 = OpSelect %v3half %32 %26 %27 + OpStore %res %24 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %34 + %36 = OpLabel + %37 = OpFunctionCall %void %select_1ada2a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %39 = OpLabel + %40 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %40 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %43 = OpLabel + %44 = OpFunctionCall %void %select_1ada2a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %46 = OpLabel + %47 = OpFunctionCall %void %select_1ada2a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/1ada2a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/1ada2a.wgsl.expected.wgsl new file mode 100644 index 0000000000..89e258ccff --- /dev/null +++ b/test/tint/builtins/gen/var/select/1ada2a.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn select_1ada2a() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var arg_2 = true; + var res : vec3 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_1ada2a(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_1ada2a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_1ada2a(); +} diff --git a/test/tint/builtins/gen/var/select/53d518.wgsl b/test/tint/builtins/gen/var/select/53d518.wgsl new file mode 100644 index 0000000000..9f43aa80b0 --- /dev/null +++ b/test/tint/builtins/gen/var/select/53d518.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn select(vec<3, f16>, vec<3, f16>, vec<3, bool>) -> vec<3, f16> +fn select_53d518() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var arg_2 = vec3(true); + var res: vec3 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_53d518(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_53d518(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_53d518(); +} diff --git a/test/tint/builtins/gen/var/select/53d518.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/select/53d518.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a04ba3952a --- /dev/null +++ b/test/tint/builtins/gen/var/select/53d518.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void select_53d518() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + bool3 arg_2 = (true).xxx; + vector res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_53d518(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_53d518(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_53d518(); + return; +} diff --git a/test/tint/builtins/gen/var/select/53d518.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/select/53d518.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..41ea9bf471 --- /dev/null +++ b/test/tint/builtins/gen/var/select/53d518.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +void select_53d518() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + bool3 arg_2 = (true).xxx; + vector res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_53d518(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_53d518(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_53d518(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001B5EE857E30(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001B5EE857E30(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001B5EE857E30(5,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/select/53d518.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/53d518.wgsl.expected.glsl new file mode 100644 index 0000000000..496678a7d9 --- /dev/null +++ b/test/tint/builtins/gen/var/select/53d518.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_53d518() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + bvec3 arg_2 = bvec3(true); + f16vec3 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + select_53d518(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void select_53d518() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + bvec3 arg_2 = bvec3(true); + f16vec3 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + select_53d518(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_53d518() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + bvec3 arg_2 = bvec3(true); + f16vec3 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + select_53d518(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/53d518.wgsl.expected.msl b/test/tint/builtins/gen/var/select/53d518.wgsl.expected.msl new file mode 100644 index 0000000000..cc5db044d7 --- /dev/null +++ b/test/tint/builtins/gen/var/select/53d518.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_53d518() { + half3 arg_0 = half3(0.0h); + half3 arg_1 = half3(0.0h); + bool3 arg_2 = bool3(true); + half3 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_53d518(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_53d518(); + return; +} + +kernel void compute_main() { + select_53d518(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/53d518.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/53d518.wgsl.expected.spvasm new file mode 100644 index 0000000000..e2bd1a5fee --- /dev/null +++ b/test/tint/builtins/gen/var/select/53d518.wgsl.expected.spvasm @@ -0,0 +1,89 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_53d518 "select_53d518" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %true = OpConstantTrue %bool + %22 = OpConstantComposite %v3bool %true %true %true +%_ptr_Function_v3bool = OpTypePointer Function %v3bool + %25 = OpConstantNull %v3bool + %31 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_53d518 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %arg_1 = OpVariable %_ptr_Function_v3half Function %15 + %arg_2 = OpVariable %_ptr_Function_v3bool Function %25 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %22 + %27 = OpLoad %v3bool %arg_2 + %28 = OpLoad %v3half %arg_1 + %29 = OpLoad %v3half %arg_0 + %26 = OpSelect %v3half %27 %28 %29 + OpStore %res %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %31 + %33 = OpLabel + %34 = OpFunctionCall %void %select_53d518 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %37 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %void %select_53d518 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %43 = OpLabel + %44 = OpFunctionCall %void %select_53d518 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/53d518.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/53d518.wgsl.expected.wgsl new file mode 100644 index 0000000000..8c40bca363 --- /dev/null +++ b/test/tint/builtins/gen/var/select/53d518.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn select_53d518() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var arg_2 = vec3(true); + var res : vec3 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_53d518(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_53d518(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_53d518(); +} diff --git a/test/tint/builtins/gen/var/select/830dd9.wgsl b/test/tint/builtins/gen/var/select/830dd9.wgsl new file mode 100644 index 0000000000..596c536839 --- /dev/null +++ b/test/tint/builtins/gen/var/select/830dd9.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn select(vec<4, f16>, vec<4, f16>, bool) -> vec<4, f16> +fn select_830dd9() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var arg_2 = true; + var res: vec4 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_830dd9(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_830dd9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_830dd9(); +} diff --git a/test/tint/builtins/gen/var/select/830dd9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/select/830dd9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6cf31e5126 --- /dev/null +++ b/test/tint/builtins/gen/var/select/830dd9.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void select_830dd9() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + bool arg_2 = true; + vector res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_830dd9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_830dd9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_830dd9(); + return; +} diff --git a/test/tint/builtins/gen/var/select/830dd9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/select/830dd9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..844a4b78f0 --- /dev/null +++ b/test/tint/builtins/gen/var/select/830dd9.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +void select_830dd9() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + bool arg_2 = true; + vector res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_830dd9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_830dd9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_830dd9(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002476DF13A60(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002476DF13A60(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002476DF13A60(5,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/select/830dd9.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/830dd9.wgsl.expected.glsl new file mode 100644 index 0000000000..76d5e54014 --- /dev/null +++ b/test/tint/builtins/gen/var/select/830dd9.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_830dd9() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + bool arg_2 = true; + f16vec4 res = (arg_2 ? arg_1 : arg_0); +} + +vec4 vertex_main() { + select_830dd9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void select_830dd9() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + bool arg_2 = true; + f16vec4 res = (arg_2 ? arg_1 : arg_0); +} + +void fragment_main() { + select_830dd9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_830dd9() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + bool arg_2 = true; + f16vec4 res = (arg_2 ? arg_1 : arg_0); +} + +void compute_main() { + select_830dd9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/830dd9.wgsl.expected.msl b/test/tint/builtins/gen/var/select/830dd9.wgsl.expected.msl new file mode 100644 index 0000000000..e9b5d67ba1 --- /dev/null +++ b/test/tint/builtins/gen/var/select/830dd9.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_830dd9() { + half4 arg_0 = half4(0.0h); + half4 arg_1 = half4(0.0h); + bool arg_2 = true; + half4 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_830dd9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_830dd9(); + return; +} + +kernel void compute_main() { + select_830dd9(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/830dd9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/830dd9.wgsl.expected.spvasm new file mode 100644 index 0000000000..c099ce9b8c --- /dev/null +++ b/test/tint/builtins/gen/var/select/830dd9.wgsl.expected.spvasm @@ -0,0 +1,92 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_830dd9 "select_830dd9" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %bool = OpTypeBool + %true = OpConstantTrue %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %23 = OpConstantNull %bool + %v4bool = OpTypeVector %bool 4 +%_ptr_Function_v4bool = OpTypePointer Function %v4bool + %31 = OpConstantNull %v4bool + %34 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_830dd9 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %arg_1 = OpVariable %_ptr_Function_v4half Function %15 + %arg_2 = OpVariable %_ptr_Function_bool Function %23 + %29 = OpVariable %_ptr_Function_v4bool Function %31 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %true + %25 = OpLoad %bool %arg_2 + %26 = OpLoad %v4half %arg_1 + %27 = OpLoad %v4half %arg_0 + %32 = OpCompositeConstruct %v4bool %25 %25 %25 %25 + %24 = OpSelect %v4half %32 %26 %27 + OpStore %res %24 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %34 + %36 = OpLabel + %37 = OpFunctionCall %void %select_830dd9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %39 = OpLabel + %40 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %40 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %43 = OpLabel + %44 = OpFunctionCall %void %select_830dd9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %46 = OpLabel + %47 = OpFunctionCall %void %select_830dd9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/830dd9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/830dd9.wgsl.expected.wgsl new file mode 100644 index 0000000000..d1a0be6bae --- /dev/null +++ b/test/tint/builtins/gen/var/select/830dd9.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn select_830dd9() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var arg_2 = true; + var res : vec4 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_830dd9(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_830dd9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_830dd9(); +} diff --git a/test/tint/builtins/gen/var/select/86f9bd.wgsl b/test/tint/builtins/gen/var/select/86f9bd.wgsl new file mode 100644 index 0000000000..fcf7755f5c --- /dev/null +++ b/test/tint/builtins/gen/var/select/86f9bd.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn select(vec<2, f16>, vec<2, f16>, bool) -> vec<2, f16> +fn select_86f9bd() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var arg_2 = true; + var res: vec2 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_86f9bd(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_86f9bd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_86f9bd(); +} diff --git a/test/tint/builtins/gen/var/select/86f9bd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/select/86f9bd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b0d16c2655 --- /dev/null +++ b/test/tint/builtins/gen/var/select/86f9bd.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void select_86f9bd() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + bool arg_2 = true; + vector res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_86f9bd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_86f9bd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_86f9bd(); + return; +} diff --git a/test/tint/builtins/gen/var/select/86f9bd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/select/86f9bd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..341d518a38 --- /dev/null +++ b/test/tint/builtins/gen/var/select/86f9bd.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +void select_86f9bd() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + bool arg_2 = true; + vector res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_86f9bd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_86f9bd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_86f9bd(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018386C13370(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018386C13370(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018386C13370(5,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/select/86f9bd.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/86f9bd.wgsl.expected.glsl new file mode 100644 index 0000000000..6217049327 --- /dev/null +++ b/test/tint/builtins/gen/var/select/86f9bd.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_86f9bd() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + bool arg_2 = true; + f16vec2 res = (arg_2 ? arg_1 : arg_0); +} + +vec4 vertex_main() { + select_86f9bd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void select_86f9bd() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + bool arg_2 = true; + f16vec2 res = (arg_2 ? arg_1 : arg_0); +} + +void fragment_main() { + select_86f9bd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_86f9bd() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + bool arg_2 = true; + f16vec2 res = (arg_2 ? arg_1 : arg_0); +} + +void compute_main() { + select_86f9bd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/86f9bd.wgsl.expected.msl b/test/tint/builtins/gen/var/select/86f9bd.wgsl.expected.msl new file mode 100644 index 0000000000..1ff94774f4 --- /dev/null +++ b/test/tint/builtins/gen/var/select/86f9bd.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_86f9bd() { + half2 arg_0 = half2(0.0h); + half2 arg_1 = half2(0.0h); + bool arg_2 = true; + half2 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_86f9bd(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_86f9bd(); + return; +} + +kernel void compute_main() { + select_86f9bd(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/86f9bd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/86f9bd.wgsl.expected.spvasm new file mode 100644 index 0000000000..cfb8b98ce1 --- /dev/null +++ b/test/tint/builtins/gen/var/select/86f9bd.wgsl.expected.spvasm @@ -0,0 +1,92 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_86f9bd "select_86f9bd" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %bool = OpTypeBool + %true = OpConstantTrue %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %23 = OpConstantNull %bool + %v2bool = OpTypeVector %bool 2 +%_ptr_Function_v2bool = OpTypePointer Function %v2bool + %31 = OpConstantNull %v2bool + %34 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_86f9bd = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %arg_1 = OpVariable %_ptr_Function_v2half Function %15 + %arg_2 = OpVariable %_ptr_Function_bool Function %23 + %29 = OpVariable %_ptr_Function_v2bool Function %31 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %true + %25 = OpLoad %bool %arg_2 + %26 = OpLoad %v2half %arg_1 + %27 = OpLoad %v2half %arg_0 + %32 = OpCompositeConstruct %v2bool %25 %25 + %24 = OpSelect %v2half %32 %26 %27 + OpStore %res %24 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %34 + %36 = OpLabel + %37 = OpFunctionCall %void %select_86f9bd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %39 = OpLabel + %40 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %40 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %43 = OpLabel + %44 = OpFunctionCall %void %select_86f9bd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %46 = OpLabel + %47 = OpFunctionCall %void %select_86f9bd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/86f9bd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/86f9bd.wgsl.expected.wgsl new file mode 100644 index 0000000000..bd73ed0e79 --- /dev/null +++ b/test/tint/builtins/gen/var/select/86f9bd.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn select_86f9bd() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var arg_2 = true; + var res : vec2 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_86f9bd(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_86f9bd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_86f9bd(); +} diff --git a/test/tint/builtins/gen/var/select/a081f1.wgsl b/test/tint/builtins/gen/var/select/a081f1.wgsl new file mode 100644 index 0000000000..713d3c73e7 --- /dev/null +++ b/test/tint/builtins/gen/var/select/a081f1.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn select(vec<4, f16>, vec<4, f16>, vec<4, bool>) -> vec<4, f16> +fn select_a081f1() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var arg_2 = vec4(true); + var res: vec4 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_a081f1(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_a081f1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_a081f1(); +} diff --git a/test/tint/builtins/gen/var/select/a081f1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/select/a081f1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..abae0c7cb7 --- /dev/null +++ b/test/tint/builtins/gen/var/select/a081f1.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void select_a081f1() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + bool4 arg_2 = (true).xxxx; + vector res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_a081f1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_a081f1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_a081f1(); + return; +} diff --git a/test/tint/builtins/gen/var/select/a081f1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/select/a081f1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9ac9d28e83 --- /dev/null +++ b/test/tint/builtins/gen/var/select/a081f1.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +void select_a081f1() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + bool4 arg_2 = (true).xxxx; + vector res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_a081f1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_a081f1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_a081f1(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002045A0049A0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002045A0049A0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002045A0049A0(5,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/select/a081f1.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/a081f1.wgsl.expected.glsl new file mode 100644 index 0000000000..4d8e8c3427 --- /dev/null +++ b/test/tint/builtins/gen/var/select/a081f1.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_a081f1() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + bvec4 arg_2 = bvec4(true); + f16vec4 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + select_a081f1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void select_a081f1() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + bvec4 arg_2 = bvec4(true); + f16vec4 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + select_a081f1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_a081f1() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + bvec4 arg_2 = bvec4(true); + f16vec4 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + select_a081f1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/a081f1.wgsl.expected.msl b/test/tint/builtins/gen/var/select/a081f1.wgsl.expected.msl new file mode 100644 index 0000000000..4fcb8d9e91 --- /dev/null +++ b/test/tint/builtins/gen/var/select/a081f1.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_a081f1() { + half4 arg_0 = half4(0.0h); + half4 arg_1 = half4(0.0h); + bool4 arg_2 = bool4(true); + half4 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_a081f1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_a081f1(); + return; +} + +kernel void compute_main() { + select_a081f1(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/a081f1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/a081f1.wgsl.expected.spvasm new file mode 100644 index 0000000000..35b71ba82f --- /dev/null +++ b/test/tint/builtins/gen/var/select/a081f1.wgsl.expected.spvasm @@ -0,0 +1,89 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_a081f1 "select_a081f1" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %true = OpConstantTrue %bool + %22 = OpConstantComposite %v4bool %true %true %true %true +%_ptr_Function_v4bool = OpTypePointer Function %v4bool + %25 = OpConstantNull %v4bool + %31 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_a081f1 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %arg_1 = OpVariable %_ptr_Function_v4half Function %15 + %arg_2 = OpVariable %_ptr_Function_v4bool Function %25 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %22 + %27 = OpLoad %v4bool %arg_2 + %28 = OpLoad %v4half %arg_1 + %29 = OpLoad %v4half %arg_0 + %26 = OpSelect %v4half %27 %28 %29 + OpStore %res %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %31 + %33 = OpLabel + %34 = OpFunctionCall %void %select_a081f1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %37 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %void %select_a081f1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %43 = OpLabel + %44 = OpFunctionCall %void %select_a081f1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/a081f1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/a081f1.wgsl.expected.wgsl new file mode 100644 index 0000000000..2e86702635 --- /dev/null +++ b/test/tint/builtins/gen/var/select/a081f1.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn select_a081f1() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var arg_2 = vec4(true); + var res : vec4 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_a081f1(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_a081f1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_a081f1(); +} diff --git a/test/tint/builtins/gen/var/select/ed7c13.wgsl b/test/tint/builtins/gen/var/select/ed7c13.wgsl new file mode 100644 index 0000000000..43274f72ce --- /dev/null +++ b/test/tint/builtins/gen/var/select/ed7c13.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn select(vec<2, f16>, vec<2, f16>, vec<2, bool>) -> vec<2, f16> +fn select_ed7c13() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var arg_2 = vec2(true); + var res: vec2 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_ed7c13(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_ed7c13(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_ed7c13(); +} diff --git a/test/tint/builtins/gen/var/select/ed7c13.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/select/ed7c13.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..636eebe094 --- /dev/null +++ b/test/tint/builtins/gen/var/select/ed7c13.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void select_ed7c13() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + bool2 arg_2 = (true).xx; + vector res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_ed7c13(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_ed7c13(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_ed7c13(); + return; +} diff --git a/test/tint/builtins/gen/var/select/ed7c13.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/select/ed7c13.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..89935f9fd2 --- /dev/null +++ b/test/tint/builtins/gen/var/select/ed7c13.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +void select_ed7c13() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + bool2 arg_2 = (true).xx; + vector res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_ed7c13(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_ed7c13(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_ed7c13(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002503B521520(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002503B521520(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002503B521520(5,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/select/ed7c13.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/ed7c13.wgsl.expected.glsl new file mode 100644 index 0000000000..5dbf4afccf --- /dev/null +++ b/test/tint/builtins/gen/var/select/ed7c13.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_ed7c13() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + bvec2 arg_2 = bvec2(true); + f16vec2 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + select_ed7c13(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void select_ed7c13() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + bvec2 arg_2 = bvec2(true); + f16vec2 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + select_ed7c13(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_ed7c13() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + bvec2 arg_2 = bvec2(true); + f16vec2 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + select_ed7c13(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/ed7c13.wgsl.expected.msl b/test/tint/builtins/gen/var/select/ed7c13.wgsl.expected.msl new file mode 100644 index 0000000000..415a0659d3 --- /dev/null +++ b/test/tint/builtins/gen/var/select/ed7c13.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_ed7c13() { + half2 arg_0 = half2(0.0h); + half2 arg_1 = half2(0.0h); + bool2 arg_2 = bool2(true); + half2 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_ed7c13(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_ed7c13(); + return; +} + +kernel void compute_main() { + select_ed7c13(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/ed7c13.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/ed7c13.wgsl.expected.spvasm new file mode 100644 index 0000000000..bc159cf9e2 --- /dev/null +++ b/test/tint/builtins/gen/var/select/ed7c13.wgsl.expected.spvasm @@ -0,0 +1,89 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_ed7c13 "select_ed7c13" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %true = OpConstantTrue %bool + %22 = OpConstantComposite %v2bool %true %true +%_ptr_Function_v2bool = OpTypePointer Function %v2bool + %25 = OpConstantNull %v2bool + %31 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_ed7c13 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %arg_1 = OpVariable %_ptr_Function_v2half Function %15 + %arg_2 = OpVariable %_ptr_Function_v2bool Function %25 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %22 + %27 = OpLoad %v2bool %arg_2 + %28 = OpLoad %v2half %arg_1 + %29 = OpLoad %v2half %arg_0 + %26 = OpSelect %v2half %27 %28 %29 + OpStore %res %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %31 + %33 = OpLabel + %34 = OpFunctionCall %void %select_ed7c13 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %37 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %void %select_ed7c13 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %43 = OpLabel + %44 = OpFunctionCall %void %select_ed7c13 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/ed7c13.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/ed7c13.wgsl.expected.wgsl new file mode 100644 index 0000000000..67b7d82bd4 --- /dev/null +++ b/test/tint/builtins/gen/var/select/ed7c13.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn select_ed7c13() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var arg_2 = vec2(true); + var res : vec2 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_ed7c13(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_ed7c13(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_ed7c13(); +} diff --git a/test/tint/builtins/gen/var/sign/160933.wgsl b/test/tint/builtins/gen/var/sign/160933.wgsl new file mode 100644 index 0000000000..3bd21d2d34 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/160933.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sign(vec<4, f16>) -> vec<4, f16> +fn sign_160933() { + var arg_0 = vec4(f16()); + var res: vec4 = sign(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_160933(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_160933(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_160933(); +} diff --git a/test/tint/builtins/gen/var/sign/160933.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sign/160933.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5800ea0538 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/160933.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sign_160933() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = sign(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_160933(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_160933(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_160933(); + return; +} diff --git a/test/tint/builtins/gen/var/sign/160933.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sign/160933.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..15614dd84d --- /dev/null +++ b/test/tint/builtins/gen/var/sign/160933.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void sign_160933() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = sign(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_160933(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_160933(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_160933(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D74F9AEFE0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D74F9AEFE0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/sign/160933.wgsl.expected.glsl b/test/tint/builtins/gen/var/sign/160933.wgsl.expected.glsl new file mode 100644 index 0000000000..34a15388a5 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/160933.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sign_160933() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = sign(arg_0); +} + +vec4 vertex_main() { + sign_160933(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sign_160933() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = sign(arg_0); +} + +void fragment_main() { + sign_160933(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sign_160933() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = sign(arg_0); +} + +void compute_main() { + sign_160933(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sign/160933.wgsl.expected.msl b/test/tint/builtins/gen/var/sign/160933.wgsl.expected.msl new file mode 100644 index 0000000000..6e7de9c4c2 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/160933.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sign_160933() { + half4 arg_0 = half4(0.0h); + half4 res = sign(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sign_160933(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sign_160933(); + return; +} + +kernel void compute_main() { + sign_160933(); + return; +} + diff --git a/test/tint/builtins/gen/var/sign/160933.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sign/160933.wgsl.expected.spvasm new file mode 100644 index 0000000000..b1d1b7e55e --- /dev/null +++ b/test/tint/builtins/gen/var/sign/160933.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sign_160933 "sign_160933" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sign_160933 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 FSign %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %sign_160933 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sign_160933 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %sign_160933 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sign/160933.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sign/160933.wgsl.expected.wgsl new file mode 100644 index 0000000000..21ab9a5a47 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/160933.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn sign_160933() { + var arg_0 = vec4(f16()); + var res : vec4 = sign(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_160933(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_160933(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_160933(); +} diff --git a/test/tint/builtins/gen/var/sign/5d283a.wgsl b/test/tint/builtins/gen/var/sign/5d283a.wgsl new file mode 100644 index 0000000000..0855f7965e --- /dev/null +++ b/test/tint/builtins/gen/var/sign/5d283a.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sign(vec<3, f16>) -> vec<3, f16> +fn sign_5d283a() { + var arg_0 = vec3(f16()); + var res: vec3 = sign(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_5d283a(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_5d283a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_5d283a(); +} diff --git a/test/tint/builtins/gen/var/sign/5d283a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sign/5d283a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0f9a2c34af --- /dev/null +++ b/test/tint/builtins/gen/var/sign/5d283a.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sign_5d283a() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = sign(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_5d283a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_5d283a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_5d283a(); + return; +} diff --git a/test/tint/builtins/gen/var/sign/5d283a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sign/5d283a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0f5e127c62 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/5d283a.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void sign_5d283a() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = sign(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_5d283a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_5d283a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_5d283a(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000025242B02410(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000025242B02410(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/sign/5d283a.wgsl.expected.glsl b/test/tint/builtins/gen/var/sign/5d283a.wgsl.expected.glsl new file mode 100644 index 0000000000..bb557c08e2 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/5d283a.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sign_5d283a() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = sign(arg_0); +} + +vec4 vertex_main() { + sign_5d283a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sign_5d283a() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = sign(arg_0); +} + +void fragment_main() { + sign_5d283a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sign_5d283a() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = sign(arg_0); +} + +void compute_main() { + sign_5d283a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sign/5d283a.wgsl.expected.msl b/test/tint/builtins/gen/var/sign/5d283a.wgsl.expected.msl new file mode 100644 index 0000000000..06a5e9e1b2 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/5d283a.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sign_5d283a() { + half3 arg_0 = half3(0.0h); + half3 res = sign(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sign_5d283a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sign_5d283a(); + return; +} + +kernel void compute_main() { + sign_5d283a(); + return; +} + diff --git a/test/tint/builtins/gen/var/sign/5d283a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sign/5d283a.wgsl.expected.spvasm new file mode 100644 index 0000000000..a65dfc15e2 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/5d283a.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sign_5d283a "sign_5d283a" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sign_5d283a = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 FSign %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %sign_5d283a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sign_5d283a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %sign_5d283a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sign/5d283a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sign/5d283a.wgsl.expected.wgsl new file mode 100644 index 0000000000..78cd550cfb --- /dev/null +++ b/test/tint/builtins/gen/var/sign/5d283a.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn sign_5d283a() { + var arg_0 = vec3(f16()); + var res : vec3 = sign(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_5d283a(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_5d283a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_5d283a(); +} diff --git a/test/tint/builtins/gen/var/sign/7c85ea.wgsl b/test/tint/builtins/gen/var/sign/7c85ea.wgsl new file mode 100644 index 0000000000..55bb282ae3 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/7c85ea.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sign(f16) -> f16 +fn sign_7c85ea() { + var arg_0 = f16(); + var res: f16 = sign(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_7c85ea(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_7c85ea(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_7c85ea(); +} diff --git a/test/tint/builtins/gen/var/sign/7c85ea.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sign/7c85ea.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..159140c625 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/7c85ea.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sign_7c85ea() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = sign(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_7c85ea(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_7c85ea(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_7c85ea(); + return; +} diff --git a/test/tint/builtins/gen/var/sign/7c85ea.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sign/7c85ea.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f270cebf29 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/7c85ea.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void sign_7c85ea() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = sign(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_7c85ea(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_7c85ea(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_7c85ea(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000025B195644F0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000025B195644F0(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/sign/7c85ea.wgsl.expected.glsl b/test/tint/builtins/gen/var/sign/7c85ea.wgsl.expected.glsl new file mode 100644 index 0000000000..35b29e26ae --- /dev/null +++ b/test/tint/builtins/gen/var/sign/7c85ea.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sign_7c85ea() { + float16_t arg_0 = 0.0hf; + float16_t res = sign(arg_0); +} + +vec4 vertex_main() { + sign_7c85ea(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sign_7c85ea() { + float16_t arg_0 = 0.0hf; + float16_t res = sign(arg_0); +} + +void fragment_main() { + sign_7c85ea(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sign_7c85ea() { + float16_t arg_0 = 0.0hf; + float16_t res = sign(arg_0); +} + +void compute_main() { + sign_7c85ea(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sign/7c85ea.wgsl.expected.msl b/test/tint/builtins/gen/var/sign/7c85ea.wgsl.expected.msl new file mode 100644 index 0000000000..649103c28a --- /dev/null +++ b/test/tint/builtins/gen/var/sign/7c85ea.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sign_7c85ea() { + half arg_0 = 0.0h; + half res = sign(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sign_7c85ea(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sign_7c85ea(); + return; +} + +kernel void compute_main() { + sign_7c85ea(); + return; +} + diff --git a/test/tint/builtins/gen/var/sign/7c85ea.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sign/7c85ea.wgsl.expected.spvasm new file mode 100644 index 0000000000..81d4f68f29 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/7c85ea.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sign_7c85ea "sign_7c85ea" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sign_7c85ea = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 FSign %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %sign_7c85ea + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %sign_7c85ea + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %sign_7c85ea + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sign/7c85ea.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sign/7c85ea.wgsl.expected.wgsl new file mode 100644 index 0000000000..1d5dd3b8cc --- /dev/null +++ b/test/tint/builtins/gen/var/sign/7c85ea.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn sign_7c85ea() { + var arg_0 = f16(); + var res : f16 = sign(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_7c85ea(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_7c85ea(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_7c85ea(); +} diff --git a/test/tint/builtins/gen/var/sign/ccdb3c.wgsl b/test/tint/builtins/gen/var/sign/ccdb3c.wgsl new file mode 100644 index 0000000000..9796e600b7 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/ccdb3c.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sign(vec<2, f16>) -> vec<2, f16> +fn sign_ccdb3c() { + var arg_0 = vec2(f16()); + var res: vec2 = sign(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_ccdb3c(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_ccdb3c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_ccdb3c(); +} diff --git a/test/tint/builtins/gen/var/sign/ccdb3c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sign/ccdb3c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6968272ace --- /dev/null +++ b/test/tint/builtins/gen/var/sign/ccdb3c.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sign_ccdb3c() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = sign(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_ccdb3c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_ccdb3c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_ccdb3c(); + return; +} diff --git a/test/tint/builtins/gen/var/sign/ccdb3c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sign/ccdb3c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2756198dad --- /dev/null +++ b/test/tint/builtins/gen/var/sign/ccdb3c.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void sign_ccdb3c() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = sign(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_ccdb3c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_ccdb3c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_ccdb3c(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000027F56D505E0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000027F56D505E0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/sign/ccdb3c.wgsl.expected.glsl b/test/tint/builtins/gen/var/sign/ccdb3c.wgsl.expected.glsl new file mode 100644 index 0000000000..7cd2e5c2f1 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/ccdb3c.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sign_ccdb3c() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = sign(arg_0); +} + +vec4 vertex_main() { + sign_ccdb3c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sign_ccdb3c() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = sign(arg_0); +} + +void fragment_main() { + sign_ccdb3c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sign_ccdb3c() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = sign(arg_0); +} + +void compute_main() { + sign_ccdb3c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sign/ccdb3c.wgsl.expected.msl b/test/tint/builtins/gen/var/sign/ccdb3c.wgsl.expected.msl new file mode 100644 index 0000000000..479a00a2ac --- /dev/null +++ b/test/tint/builtins/gen/var/sign/ccdb3c.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sign_ccdb3c() { + half2 arg_0 = half2(0.0h); + half2 res = sign(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sign_ccdb3c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sign_ccdb3c(); + return; +} + +kernel void compute_main() { + sign_ccdb3c(); + return; +} + diff --git a/test/tint/builtins/gen/var/sign/ccdb3c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sign/ccdb3c.wgsl.expected.spvasm new file mode 100644 index 0000000000..3d7d8e8f7e --- /dev/null +++ b/test/tint/builtins/gen/var/sign/ccdb3c.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sign_ccdb3c "sign_ccdb3c" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sign_ccdb3c = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 FSign %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %sign_ccdb3c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sign_ccdb3c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %sign_ccdb3c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sign/ccdb3c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sign/ccdb3c.wgsl.expected.wgsl new file mode 100644 index 0000000000..71231ddbb6 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/ccdb3c.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn sign_ccdb3c() { + var arg_0 = vec2(f16()); + var res : vec2 = sign(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_ccdb3c(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_ccdb3c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_ccdb3c(); +} diff --git a/test/tint/builtins/gen/var/sin/2c903b.wgsl b/test/tint/builtins/gen/var/sin/2c903b.wgsl new file mode 100644 index 0000000000..d639f9b030 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/2c903b.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sin(vec<3, f16>) -> vec<3, f16> +fn sin_2c903b() { + var arg_0 = vec3(f16()); + var res: vec3 = sin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_2c903b(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_2c903b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_2c903b(); +} diff --git a/test/tint/builtins/gen/var/sin/2c903b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sin/2c903b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f4f1c6c931 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/2c903b.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sin_2c903b() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = sin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_2c903b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_2c903b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_2c903b(); + return; +} diff --git a/test/tint/builtins/gen/var/sin/2c903b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sin/2c903b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..06f82a8282 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/2c903b.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void sin_2c903b() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = sin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_2c903b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_2c903b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_2c903b(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022899018770(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022899018770(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/sin/2c903b.wgsl.expected.glsl b/test/tint/builtins/gen/var/sin/2c903b.wgsl.expected.glsl new file mode 100644 index 0000000000..8af8af092a --- /dev/null +++ b/test/tint/builtins/gen/var/sin/2c903b.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sin_2c903b() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = sin(arg_0); +} + +vec4 vertex_main() { + sin_2c903b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sin_2c903b() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = sin(arg_0); +} + +void fragment_main() { + sin_2c903b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sin_2c903b() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = sin(arg_0); +} + +void compute_main() { + sin_2c903b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sin/2c903b.wgsl.expected.msl b/test/tint/builtins/gen/var/sin/2c903b.wgsl.expected.msl new file mode 100644 index 0000000000..726be54644 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/2c903b.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sin_2c903b() { + half3 arg_0 = half3(0.0h); + half3 res = sin(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sin_2c903b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sin_2c903b(); + return; +} + +kernel void compute_main() { + sin_2c903b(); + return; +} + diff --git a/test/tint/builtins/gen/var/sin/2c903b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sin/2c903b.wgsl.expected.spvasm new file mode 100644 index 0000000000..a6340ff0ad --- /dev/null +++ b/test/tint/builtins/gen/var/sin/2c903b.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sin_2c903b "sin_2c903b" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %sin_2c903b = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Sin %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %sin_2c903b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sin_2c903b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %sin_2c903b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sin/2c903b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sin/2c903b.wgsl.expected.wgsl new file mode 100644 index 0000000000..7e8f70afb7 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/2c903b.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn sin_2c903b() { + var arg_0 = vec3(f16()); + var res : vec3 = sin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_2c903b(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_2c903b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_2c903b(); +} diff --git a/test/tint/builtins/gen/var/sin/3cca11.wgsl b/test/tint/builtins/gen/var/sin/3cca11.wgsl new file mode 100644 index 0000000000..fcc4f9f192 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/3cca11.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sin(vec<2, f16>) -> vec<2, f16> +fn sin_3cca11() { + var arg_0 = vec2(f16()); + var res: vec2 = sin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_3cca11(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_3cca11(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_3cca11(); +} diff --git a/test/tint/builtins/gen/var/sin/3cca11.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sin/3cca11.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..52c96edba9 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/3cca11.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sin_3cca11() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = sin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_3cca11(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_3cca11(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_3cca11(); + return; +} diff --git a/test/tint/builtins/gen/var/sin/3cca11.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sin/3cca11.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8ea97b8c1e --- /dev/null +++ b/test/tint/builtins/gen/var/sin/3cca11.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void sin_3cca11() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = sin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_3cca11(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_3cca11(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_3cca11(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001FCDD1705E0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001FCDD1705E0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/sin/3cca11.wgsl.expected.glsl b/test/tint/builtins/gen/var/sin/3cca11.wgsl.expected.glsl new file mode 100644 index 0000000000..75cdcafa58 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/3cca11.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sin_3cca11() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = sin(arg_0); +} + +vec4 vertex_main() { + sin_3cca11(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sin_3cca11() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = sin(arg_0); +} + +void fragment_main() { + sin_3cca11(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sin_3cca11() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = sin(arg_0); +} + +void compute_main() { + sin_3cca11(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sin/3cca11.wgsl.expected.msl b/test/tint/builtins/gen/var/sin/3cca11.wgsl.expected.msl new file mode 100644 index 0000000000..5dbd595150 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/3cca11.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sin_3cca11() { + half2 arg_0 = half2(0.0h); + half2 res = sin(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sin_3cca11(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sin_3cca11(); + return; +} + +kernel void compute_main() { + sin_3cca11(); + return; +} + diff --git a/test/tint/builtins/gen/var/sin/3cca11.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sin/3cca11.wgsl.expected.spvasm new file mode 100644 index 0000000000..969ca211b2 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/3cca11.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sin_3cca11 "sin_3cca11" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %sin_3cca11 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Sin %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %sin_3cca11 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sin_3cca11 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %sin_3cca11 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sin/3cca11.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sin/3cca11.wgsl.expected.wgsl new file mode 100644 index 0000000000..34f865d889 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/3cca11.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn sin_3cca11() { + var arg_0 = vec2(f16()); + var res : vec2 = sin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_3cca11(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_3cca11(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_3cca11(); +} diff --git a/test/tint/builtins/gen/var/sin/5c0712.wgsl b/test/tint/builtins/gen/var/sin/5c0712.wgsl new file mode 100644 index 0000000000..e94e831656 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/5c0712.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sin(vec<4, f16>) -> vec<4, f16> +fn sin_5c0712() { + var arg_0 = vec4(f16()); + var res: vec4 = sin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_5c0712(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_5c0712(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_5c0712(); +} diff --git a/test/tint/builtins/gen/var/sin/5c0712.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sin/5c0712.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..38a4ccab15 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/5c0712.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sin_5c0712() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = sin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_5c0712(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_5c0712(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_5c0712(); + return; +} diff --git a/test/tint/builtins/gen/var/sin/5c0712.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sin/5c0712.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cf3f4d433e --- /dev/null +++ b/test/tint/builtins/gen/var/sin/5c0712.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void sin_5c0712() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = sin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_5c0712(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_5c0712(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_5c0712(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000260A64A2B50(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000260A64A2B50(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/sin/5c0712.wgsl.expected.glsl b/test/tint/builtins/gen/var/sin/5c0712.wgsl.expected.glsl new file mode 100644 index 0000000000..2260625806 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/5c0712.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sin_5c0712() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = sin(arg_0); +} + +vec4 vertex_main() { + sin_5c0712(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sin_5c0712() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = sin(arg_0); +} + +void fragment_main() { + sin_5c0712(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sin_5c0712() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = sin(arg_0); +} + +void compute_main() { + sin_5c0712(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sin/5c0712.wgsl.expected.msl b/test/tint/builtins/gen/var/sin/5c0712.wgsl.expected.msl new file mode 100644 index 0000000000..87f6df62f9 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/5c0712.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sin_5c0712() { + half4 arg_0 = half4(0.0h); + half4 res = sin(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sin_5c0712(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sin_5c0712(); + return; +} + +kernel void compute_main() { + sin_5c0712(); + return; +} + diff --git a/test/tint/builtins/gen/var/sin/5c0712.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sin/5c0712.wgsl.expected.spvasm new file mode 100644 index 0000000000..07ac80981a --- /dev/null +++ b/test/tint/builtins/gen/var/sin/5c0712.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sin_5c0712 "sin_5c0712" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %sin_5c0712 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Sin %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %sin_5c0712 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sin_5c0712 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %sin_5c0712 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sin/5c0712.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sin/5c0712.wgsl.expected.wgsl new file mode 100644 index 0000000000..d737c454f1 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/5c0712.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn sin_5c0712() { + var arg_0 = vec4(f16()); + var res : vec4 = sin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_5c0712(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_5c0712(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_5c0712(); +} diff --git a/test/tint/builtins/gen/var/sin/66a59f.wgsl b/test/tint/builtins/gen/var/sin/66a59f.wgsl new file mode 100644 index 0000000000..d73f364e57 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/66a59f.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sin(f16) -> f16 +fn sin_66a59f() { + var arg_0 = f16(); + var res: f16 = sin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_66a59f(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_66a59f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_66a59f(); +} diff --git a/test/tint/builtins/gen/var/sin/66a59f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sin/66a59f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7b1237f82b --- /dev/null +++ b/test/tint/builtins/gen/var/sin/66a59f.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sin_66a59f() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = sin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_66a59f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_66a59f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_66a59f(); + return; +} diff --git a/test/tint/builtins/gen/var/sin/66a59f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sin/66a59f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..40199e2a2c --- /dev/null +++ b/test/tint/builtins/gen/var/sin/66a59f.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void sin_66a59f() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = sin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_66a59f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_66a59f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_66a59f(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001826042C2F0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001826042C2F0(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/sin/66a59f.wgsl.expected.glsl b/test/tint/builtins/gen/var/sin/66a59f.wgsl.expected.glsl new file mode 100644 index 0000000000..20ac57e5d7 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/66a59f.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sin_66a59f() { + float16_t arg_0 = 0.0hf; + float16_t res = sin(arg_0); +} + +vec4 vertex_main() { + sin_66a59f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sin_66a59f() { + float16_t arg_0 = 0.0hf; + float16_t res = sin(arg_0); +} + +void fragment_main() { + sin_66a59f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sin_66a59f() { + float16_t arg_0 = 0.0hf; + float16_t res = sin(arg_0); +} + +void compute_main() { + sin_66a59f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sin/66a59f.wgsl.expected.msl b/test/tint/builtins/gen/var/sin/66a59f.wgsl.expected.msl new file mode 100644 index 0000000000..1a7188408e --- /dev/null +++ b/test/tint/builtins/gen/var/sin/66a59f.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sin_66a59f() { + half arg_0 = 0.0h; + half res = sin(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sin_66a59f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sin_66a59f(); + return; +} + +kernel void compute_main() { + sin_66a59f(); + return; +} + diff --git a/test/tint/builtins/gen/var/sin/66a59f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sin/66a59f.wgsl.expected.spvasm new file mode 100644 index 0000000000..f4689fb064 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/66a59f.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sin_66a59f "sin_66a59f" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %sin_66a59f = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Sin %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %sin_66a59f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %sin_66a59f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %sin_66a59f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sin/66a59f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sin/66a59f.wgsl.expected.wgsl new file mode 100644 index 0000000000..897e30dd9c --- /dev/null +++ b/test/tint/builtins/gen/var/sin/66a59f.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn sin_66a59f() { + var arg_0 = f16(); + var res : f16 = sin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_66a59f(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_66a59f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_66a59f(); +} diff --git a/test/tint/builtins/gen/var/sinh/0908c1.wgsl b/test/tint/builtins/gen/var/sinh/0908c1.wgsl new file mode 100644 index 0000000000..13e6f98aba --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/0908c1.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sinh(vec<3, f16>) -> vec<3, f16> +fn sinh_0908c1() { + var arg_0 = vec3(f16()); + var res: vec3 = sinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_0908c1(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_0908c1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_0908c1(); +} diff --git a/test/tint/builtins/gen/var/sinh/0908c1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sinh/0908c1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..80c43ed31b --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/0908c1.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sinh_0908c1() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_0908c1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_0908c1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_0908c1(); + return; +} diff --git a/test/tint/builtins/gen/var/sinh/0908c1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sinh/0908c1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..218f8d25d3 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/0908c1.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void sinh_0908c1() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_0908c1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_0908c1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_0908c1(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000029A72348830(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000029A72348830(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/sinh/0908c1.wgsl.expected.glsl b/test/tint/builtins/gen/var/sinh/0908c1.wgsl.expected.glsl new file mode 100644 index 0000000000..5d2c159340 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/0908c1.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sinh_0908c1() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = sinh(arg_0); +} + +vec4 vertex_main() { + sinh_0908c1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sinh_0908c1() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = sinh(arg_0); +} + +void fragment_main() { + sinh_0908c1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sinh_0908c1() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = sinh(arg_0); +} + +void compute_main() { + sinh_0908c1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sinh/0908c1.wgsl.expected.msl b/test/tint/builtins/gen/var/sinh/0908c1.wgsl.expected.msl new file mode 100644 index 0000000000..a31c760e22 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/0908c1.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sinh_0908c1() { + half3 arg_0 = half3(0.0h); + half3 res = sinh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sinh_0908c1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sinh_0908c1(); + return; +} + +kernel void compute_main() { + sinh_0908c1(); + return; +} + diff --git a/test/tint/builtins/gen/var/sinh/0908c1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sinh/0908c1.wgsl.expected.spvasm new file mode 100644 index 0000000000..5d347fe26d --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/0908c1.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sinh_0908c1 "sinh_0908c1" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sinh_0908c1 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Sinh %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %sinh_0908c1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sinh_0908c1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %sinh_0908c1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sinh/0908c1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sinh/0908c1.wgsl.expected.wgsl new file mode 100644 index 0000000000..e077d31f8b --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/0908c1.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn sinh_0908c1() { + var arg_0 = vec3(f16()); + var res : vec3 = sinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_0908c1(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_0908c1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_0908c1(); +} diff --git a/test/tint/builtins/gen/var/sinh/69cce2.wgsl b/test/tint/builtins/gen/var/sinh/69cce2.wgsl new file mode 100644 index 0000000000..77fa301c62 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/69cce2.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sinh(f16) -> f16 +fn sinh_69cce2() { + var arg_0 = f16(); + var res: f16 = sinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_69cce2(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_69cce2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_69cce2(); +} diff --git a/test/tint/builtins/gen/var/sinh/69cce2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sinh/69cce2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4a09bf562b --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/69cce2.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sinh_69cce2() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_69cce2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_69cce2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_69cce2(); + return; +} diff --git a/test/tint/builtins/gen/var/sinh/69cce2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sinh/69cce2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7029997c74 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/69cce2.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void sinh_69cce2() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_69cce2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_69cce2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_69cce2(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002177048C2F0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002177048C2F0(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/sinh/69cce2.wgsl.expected.glsl b/test/tint/builtins/gen/var/sinh/69cce2.wgsl.expected.glsl new file mode 100644 index 0000000000..62e7689157 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/69cce2.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sinh_69cce2() { + float16_t arg_0 = 0.0hf; + float16_t res = sinh(arg_0); +} + +vec4 vertex_main() { + sinh_69cce2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sinh_69cce2() { + float16_t arg_0 = 0.0hf; + float16_t res = sinh(arg_0); +} + +void fragment_main() { + sinh_69cce2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sinh_69cce2() { + float16_t arg_0 = 0.0hf; + float16_t res = sinh(arg_0); +} + +void compute_main() { + sinh_69cce2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sinh/69cce2.wgsl.expected.msl b/test/tint/builtins/gen/var/sinh/69cce2.wgsl.expected.msl new file mode 100644 index 0000000000..8c1085407d --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/69cce2.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sinh_69cce2() { + half arg_0 = 0.0h; + half res = sinh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sinh_69cce2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sinh_69cce2(); + return; +} + +kernel void compute_main() { + sinh_69cce2(); + return; +} + diff --git a/test/tint/builtins/gen/var/sinh/69cce2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sinh/69cce2.wgsl.expected.spvasm new file mode 100644 index 0000000000..b9a45acd2b --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/69cce2.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sinh_69cce2 "sinh_69cce2" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sinh_69cce2 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Sinh %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %sinh_69cce2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %sinh_69cce2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %sinh_69cce2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sinh/69cce2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sinh/69cce2.wgsl.expected.wgsl new file mode 100644 index 0000000000..bb651b8525 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/69cce2.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn sinh_69cce2() { + var arg_0 = f16(); + var res : f16 = sinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_69cce2(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_69cce2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_69cce2(); +} diff --git a/test/tint/builtins/gen/var/sinh/924f19.wgsl b/test/tint/builtins/gen/var/sinh/924f19.wgsl new file mode 100644 index 0000000000..5afb8cf721 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/924f19.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sinh(vec<2, f16>) -> vec<2, f16> +fn sinh_924f19() { + var arg_0 = vec2(f16()); + var res: vec2 = sinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_924f19(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_924f19(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_924f19(); +} diff --git a/test/tint/builtins/gen/var/sinh/924f19.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sinh/924f19.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..dd95c74357 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/924f19.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sinh_924f19() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_924f19(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_924f19(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_924f19(); + return; +} diff --git a/test/tint/builtins/gen/var/sinh/924f19.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sinh/924f19.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..65bd9a35c2 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/924f19.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void sinh_924f19() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_924f19(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_924f19(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_924f19(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000023F87A98990(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000023F87A98990(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/sinh/924f19.wgsl.expected.glsl b/test/tint/builtins/gen/var/sinh/924f19.wgsl.expected.glsl new file mode 100644 index 0000000000..46efc04741 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/924f19.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sinh_924f19() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = sinh(arg_0); +} + +vec4 vertex_main() { + sinh_924f19(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sinh_924f19() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = sinh(arg_0); +} + +void fragment_main() { + sinh_924f19(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sinh_924f19() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = sinh(arg_0); +} + +void compute_main() { + sinh_924f19(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sinh/924f19.wgsl.expected.msl b/test/tint/builtins/gen/var/sinh/924f19.wgsl.expected.msl new file mode 100644 index 0000000000..eb99e968ad --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/924f19.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sinh_924f19() { + half2 arg_0 = half2(0.0h); + half2 res = sinh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sinh_924f19(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sinh_924f19(); + return; +} + +kernel void compute_main() { + sinh_924f19(); + return; +} + diff --git a/test/tint/builtins/gen/var/sinh/924f19.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sinh/924f19.wgsl.expected.spvasm new file mode 100644 index 0000000000..c1a335dc32 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/924f19.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sinh_924f19 "sinh_924f19" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sinh_924f19 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Sinh %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %sinh_924f19 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sinh_924f19 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %sinh_924f19 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sinh/924f19.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sinh/924f19.wgsl.expected.wgsl new file mode 100644 index 0000000000..e6d1440bec --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/924f19.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn sinh_924f19() { + var arg_0 = vec2(f16()); + var res : vec2 = sinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_924f19(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_924f19(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_924f19(); +} diff --git a/test/tint/builtins/gen/var/sinh/ba7e25.wgsl b/test/tint/builtins/gen/var/sinh/ba7e25.wgsl new file mode 100644 index 0000000000..ea5e54c4fb --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/ba7e25.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sinh(vec<4, f16>) -> vec<4, f16> +fn sinh_ba7e25() { + var arg_0 = vec4(f16()); + var res: vec4 = sinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_ba7e25(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_ba7e25(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_ba7e25(); +} diff --git a/test/tint/builtins/gen/var/sinh/ba7e25.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sinh/ba7e25.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d40f72623e --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/ba7e25.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sinh_ba7e25() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_ba7e25(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_ba7e25(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_ba7e25(); + return; +} diff --git a/test/tint/builtins/gen/var/sinh/ba7e25.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sinh/ba7e25.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6d013e8937 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/ba7e25.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void sinh_ba7e25() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_ba7e25(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_ba7e25(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_ba7e25(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001CF8F9907F0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001CF8F9907F0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/sinh/ba7e25.wgsl.expected.glsl b/test/tint/builtins/gen/var/sinh/ba7e25.wgsl.expected.glsl new file mode 100644 index 0000000000..c1e6fe6460 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/ba7e25.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sinh_ba7e25() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = sinh(arg_0); +} + +vec4 vertex_main() { + sinh_ba7e25(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sinh_ba7e25() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = sinh(arg_0); +} + +void fragment_main() { + sinh_ba7e25(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sinh_ba7e25() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = sinh(arg_0); +} + +void compute_main() { + sinh_ba7e25(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sinh/ba7e25.wgsl.expected.msl b/test/tint/builtins/gen/var/sinh/ba7e25.wgsl.expected.msl new file mode 100644 index 0000000000..c211bfd1a6 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/ba7e25.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sinh_ba7e25() { + half4 arg_0 = half4(0.0h); + half4 res = sinh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sinh_ba7e25(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sinh_ba7e25(); + return; +} + +kernel void compute_main() { + sinh_ba7e25(); + return; +} + diff --git a/test/tint/builtins/gen/var/sinh/ba7e25.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sinh/ba7e25.wgsl.expected.spvasm new file mode 100644 index 0000000000..d98c76f598 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/ba7e25.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sinh_ba7e25 "sinh_ba7e25" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sinh_ba7e25 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Sinh %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %sinh_ba7e25 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sinh_ba7e25 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %sinh_ba7e25 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sinh/ba7e25.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sinh/ba7e25.wgsl.expected.wgsl new file mode 100644 index 0000000000..4fdc05007e --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/ba7e25.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn sinh_ba7e25() { + var arg_0 = vec4(f16()); + var res : vec4 = sinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_ba7e25(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_ba7e25(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_ba7e25(); +} diff --git a/test/tint/builtins/gen/var/smoothstep/12c031.wgsl b/test/tint/builtins/gen/var/smoothstep/12c031.wgsl new file mode 100644 index 0000000000..630ba4fcce --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/12c031.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn smoothstep(vec<2, f16>, vec<2, f16>, vec<2, f16>) -> vec<2, f16> +fn smoothstep_12c031() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var arg_2 = vec2(f16()); + var res: vec2 = smoothstep(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_12c031(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_12c031(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_12c031(); +} diff --git a/test/tint/builtins/gen/var/smoothstep/12c031.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/smoothstep/12c031.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9be0898b47 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/12c031.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void smoothstep_12c031() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + vector arg_2 = (float16_t(0.0h)).xx; + vector res = smoothstep(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_12c031(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_12c031(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_12c031(); + return; +} diff --git a/test/tint/builtins/gen/var/smoothstep/12c031.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/smoothstep/12c031.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8bc939155c --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/12c031.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +SKIP: FAILED + +void smoothstep_12c031() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + vector arg_2 = (float16_t(0.0h)).xx; + vector res = smoothstep(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_12c031(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_12c031(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_12c031(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E666F5FB00(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E666F5FB00(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E666F5FB00(4,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E666F5FB00(5,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/smoothstep/12c031.wgsl.expected.glsl b/test/tint/builtins/gen/var/smoothstep/12c031.wgsl.expected.glsl new file mode 100644 index 0000000000..c5453ff59b --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/12c031.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void smoothstep_12c031() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 arg_2 = f16vec2(0.0hf); + f16vec2 res = smoothstep(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + smoothstep_12c031(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void smoothstep_12c031() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 arg_2 = f16vec2(0.0hf); + f16vec2 res = smoothstep(arg_0, arg_1, arg_2); +} + +void fragment_main() { + smoothstep_12c031(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void smoothstep_12c031() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 arg_2 = f16vec2(0.0hf); + f16vec2 res = smoothstep(arg_0, arg_1, arg_2); +} + +void compute_main() { + smoothstep_12c031(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/smoothstep/12c031.wgsl.expected.msl b/test/tint/builtins/gen/var/smoothstep/12c031.wgsl.expected.msl new file mode 100644 index 0000000000..d21672c1e3 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/12c031.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void smoothstep_12c031() { + half2 arg_0 = half2(0.0h); + half2 arg_1 = half2(0.0h); + half2 arg_2 = half2(0.0h); + half2 res = smoothstep(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + smoothstep_12c031(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + smoothstep_12c031(); + return; +} + +kernel void compute_main() { + smoothstep_12c031(); + return; +} + diff --git a/test/tint/builtins/gen/var/smoothstep/12c031.wgsl.expected.spvasm b/test/tint/builtins/gen/var/smoothstep/12c031.wgsl.expected.spvasm new file mode 100644 index 0000000000..658663c77b --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/12c031.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %smoothstep_12c031 "smoothstep_12c031" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%smoothstep_12c031 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %arg_1 = OpVariable %_ptr_Function_v2half Function %15 + %arg_2 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %22 = OpLoad %v2half %arg_0 + %23 = OpLoad %v2half %arg_1 + %24 = OpLoad %v2half %arg_2 + %20 = OpExtInst %v2half %21 SmoothStep %22 %23 %24 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %smoothstep_12c031 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %smoothstep_12c031 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %smoothstep_12c031 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/smoothstep/12c031.wgsl.expected.wgsl b/test/tint/builtins/gen/var/smoothstep/12c031.wgsl.expected.wgsl new file mode 100644 index 0000000000..771f83c71d --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/12c031.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn smoothstep_12c031() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var arg_2 = vec2(f16()); + var res : vec2 = smoothstep(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_12c031(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_12c031(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_12c031(); +} diff --git a/test/tint/builtins/gen/var/smoothstep/586e12.wgsl b/test/tint/builtins/gen/var/smoothstep/586e12.wgsl new file mode 100644 index 0000000000..55d79620a9 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/586e12.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn smoothstep(f16, f16, f16) -> f16 +fn smoothstep_586e12() { + var arg_0 = f16(); + var arg_1 = f16(); + var arg_2 = f16(); + var res: f16 = smoothstep(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_586e12(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_586e12(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_586e12(); +} diff --git a/test/tint/builtins/gen/var/smoothstep/586e12.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/smoothstep/586e12.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3dd35eb690 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/586e12.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void smoothstep_586e12() { + float16_t arg_0 = float16_t(0.0h); + float16_t arg_1 = float16_t(0.0h); + float16_t arg_2 = float16_t(0.0h); + float16_t res = smoothstep(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_586e12(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_586e12(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_586e12(); + return; +} diff --git a/test/tint/builtins/gen/var/smoothstep/586e12.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/smoothstep/586e12.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e740197c02 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/586e12.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void smoothstep_586e12() { + float16_t arg_0 = float16_t(0.0h); + float16_t arg_1 = float16_t(0.0h); + float16_t arg_2 = float16_t(0.0h); + float16_t res = smoothstep(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_586e12(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_586e12(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_586e12(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001CA5325EE80(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001CA5325EE80(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/smoothstep/586e12.wgsl.expected.glsl b/test/tint/builtins/gen/var/smoothstep/586e12.wgsl.expected.glsl new file mode 100644 index 0000000000..4aca82eb30 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/586e12.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void smoothstep_586e12() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t arg_2 = 0.0hf; + float16_t res = smoothstep(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + smoothstep_586e12(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void smoothstep_586e12() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t arg_2 = 0.0hf; + float16_t res = smoothstep(arg_0, arg_1, arg_2); +} + +void fragment_main() { + smoothstep_586e12(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void smoothstep_586e12() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t arg_2 = 0.0hf; + float16_t res = smoothstep(arg_0, arg_1, arg_2); +} + +void compute_main() { + smoothstep_586e12(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/smoothstep/586e12.wgsl.expected.msl b/test/tint/builtins/gen/var/smoothstep/586e12.wgsl.expected.msl new file mode 100644 index 0000000000..5b62341cce --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/586e12.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void smoothstep_586e12() { + half arg_0 = 0.0h; + half arg_1 = 0.0h; + half arg_2 = 0.0h; + half res = smoothstep(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + smoothstep_586e12(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + smoothstep_586e12(); + return; +} + +kernel void compute_main() { + smoothstep_586e12(); + return; +} + diff --git a/test/tint/builtins/gen/var/smoothstep/586e12.wgsl.expected.spvasm b/test/tint/builtins/gen/var/smoothstep/586e12.wgsl.expected.spvasm new file mode 100644 index 0000000000..dc12c4697a --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/586e12.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %smoothstep_586e12 "smoothstep_586e12" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%smoothstep_586e12 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %arg_1 = OpVariable %_ptr_Function_half Function %14 + %arg_2 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + OpStore %arg_2 %14 + %21 = OpLoad %half %arg_0 + %22 = OpLoad %half %arg_1 + %23 = OpLoad %half %arg_2 + %19 = OpExtInst %half %20 SmoothStep %21 %22 %23 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %smoothstep_586e12 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %smoothstep_586e12 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %smoothstep_586e12 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/smoothstep/586e12.wgsl.expected.wgsl b/test/tint/builtins/gen/var/smoothstep/586e12.wgsl.expected.wgsl new file mode 100644 index 0000000000..9967bf6593 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/586e12.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn smoothstep_586e12() { + var arg_0 = f16(); + var arg_1 = f16(); + var arg_2 = f16(); + var res : f16 = smoothstep(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_586e12(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_586e12(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_586e12(); +} diff --git a/test/tint/builtins/gen/var/smoothstep/6e7a74.wgsl b/test/tint/builtins/gen/var/smoothstep/6e7a74.wgsl new file mode 100644 index 0000000000..fbade6cbff --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/6e7a74.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn smoothstep(vec<3, f16>, vec<3, f16>, vec<3, f16>) -> vec<3, f16> +fn smoothstep_6e7a74() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var arg_2 = vec3(f16()); + var res: vec3 = smoothstep(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_6e7a74(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_6e7a74(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_6e7a74(); +} diff --git a/test/tint/builtins/gen/var/smoothstep/6e7a74.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/smoothstep/6e7a74.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..710439ce57 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/6e7a74.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void smoothstep_6e7a74() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector arg_2 = (float16_t(0.0h)).xxx; + vector res = smoothstep(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_6e7a74(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_6e7a74(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_6e7a74(); + return; +} diff --git a/test/tint/builtins/gen/var/smoothstep/6e7a74.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/smoothstep/6e7a74.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..dd99645246 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/6e7a74.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +SKIP: FAILED + +void smoothstep_6e7a74() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector arg_2 = (float16_t(0.0h)).xxx; + vector res = smoothstep(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_6e7a74(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_6e7a74(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_6e7a74(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018E52AF3660(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018E52AF3660(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018E52AF3660(4,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018E52AF3660(5,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/smoothstep/6e7a74.wgsl.expected.glsl b/test/tint/builtins/gen/var/smoothstep/6e7a74.wgsl.expected.glsl new file mode 100644 index 0000000000..f1ecbb7fa2 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/6e7a74.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void smoothstep_6e7a74() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 arg_2 = f16vec3(0.0hf); + f16vec3 res = smoothstep(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + smoothstep_6e7a74(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void smoothstep_6e7a74() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 arg_2 = f16vec3(0.0hf); + f16vec3 res = smoothstep(arg_0, arg_1, arg_2); +} + +void fragment_main() { + smoothstep_6e7a74(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void smoothstep_6e7a74() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 arg_2 = f16vec3(0.0hf); + f16vec3 res = smoothstep(arg_0, arg_1, arg_2); +} + +void compute_main() { + smoothstep_6e7a74(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/smoothstep/6e7a74.wgsl.expected.msl b/test/tint/builtins/gen/var/smoothstep/6e7a74.wgsl.expected.msl new file mode 100644 index 0000000000..ac08ba83d3 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/6e7a74.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void smoothstep_6e7a74() { + half3 arg_0 = half3(0.0h); + half3 arg_1 = half3(0.0h); + half3 arg_2 = half3(0.0h); + half3 res = smoothstep(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + smoothstep_6e7a74(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + smoothstep_6e7a74(); + return; +} + +kernel void compute_main() { + smoothstep_6e7a74(); + return; +} + diff --git a/test/tint/builtins/gen/var/smoothstep/6e7a74.wgsl.expected.spvasm b/test/tint/builtins/gen/var/smoothstep/6e7a74.wgsl.expected.spvasm new file mode 100644 index 0000000000..d4fa576d85 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/6e7a74.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %smoothstep_6e7a74 "smoothstep_6e7a74" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%smoothstep_6e7a74 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %arg_1 = OpVariable %_ptr_Function_v3half Function %15 + %arg_2 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %22 = OpLoad %v3half %arg_0 + %23 = OpLoad %v3half %arg_1 + %24 = OpLoad %v3half %arg_2 + %20 = OpExtInst %v3half %21 SmoothStep %22 %23 %24 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %smoothstep_6e7a74 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %smoothstep_6e7a74 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %smoothstep_6e7a74 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/smoothstep/6e7a74.wgsl.expected.wgsl b/test/tint/builtins/gen/var/smoothstep/6e7a74.wgsl.expected.wgsl new file mode 100644 index 0000000000..7e668ebf74 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/6e7a74.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn smoothstep_6e7a74() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var arg_2 = vec3(f16()); + var res : vec3 = smoothstep(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_6e7a74(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_6e7a74(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_6e7a74(); +} diff --git a/test/tint/builtins/gen/var/smoothstep/c43ebd.wgsl b/test/tint/builtins/gen/var/smoothstep/c43ebd.wgsl new file mode 100644 index 0000000000..b9a0caf740 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/c43ebd.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn smoothstep(vec<4, f16>, vec<4, f16>, vec<4, f16>) -> vec<4, f16> +fn smoothstep_c43ebd() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var arg_2 = vec4(f16()); + var res: vec4 = smoothstep(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_c43ebd(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_c43ebd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_c43ebd(); +} diff --git a/test/tint/builtins/gen/var/smoothstep/c43ebd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/smoothstep/c43ebd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3bd807dc2a --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/c43ebd.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void smoothstep_c43ebd() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + vector arg_2 = (float16_t(0.0h)).xxxx; + vector res = smoothstep(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_c43ebd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_c43ebd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_c43ebd(); + return; +} diff --git a/test/tint/builtins/gen/var/smoothstep/c43ebd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/smoothstep/c43ebd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..dcf7052162 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/c43ebd.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +SKIP: FAILED + +void smoothstep_c43ebd() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + vector arg_2 = (float16_t(0.0h)).xxxx; + vector res = smoothstep(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_c43ebd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_c43ebd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_c43ebd(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001EE5BEB1170(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001EE5BEB1170(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001EE5BEB1170(4,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001EE5BEB1170(5,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/smoothstep/c43ebd.wgsl.expected.glsl b/test/tint/builtins/gen/var/smoothstep/c43ebd.wgsl.expected.glsl new file mode 100644 index 0000000000..66c3b74443 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/c43ebd.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void smoothstep_c43ebd() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 arg_2 = f16vec4(0.0hf); + f16vec4 res = smoothstep(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + smoothstep_c43ebd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void smoothstep_c43ebd() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 arg_2 = f16vec4(0.0hf); + f16vec4 res = smoothstep(arg_0, arg_1, arg_2); +} + +void fragment_main() { + smoothstep_c43ebd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void smoothstep_c43ebd() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 arg_2 = f16vec4(0.0hf); + f16vec4 res = smoothstep(arg_0, arg_1, arg_2); +} + +void compute_main() { + smoothstep_c43ebd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/smoothstep/c43ebd.wgsl.expected.msl b/test/tint/builtins/gen/var/smoothstep/c43ebd.wgsl.expected.msl new file mode 100644 index 0000000000..317c0439c1 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/c43ebd.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void smoothstep_c43ebd() { + half4 arg_0 = half4(0.0h); + half4 arg_1 = half4(0.0h); + half4 arg_2 = half4(0.0h); + half4 res = smoothstep(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + smoothstep_c43ebd(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + smoothstep_c43ebd(); + return; +} + +kernel void compute_main() { + smoothstep_c43ebd(); + return; +} + diff --git a/test/tint/builtins/gen/var/smoothstep/c43ebd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/smoothstep/c43ebd.wgsl.expected.spvasm new file mode 100644 index 0000000000..af5f1b0539 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/c43ebd.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %smoothstep_c43ebd "smoothstep_c43ebd" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%smoothstep_c43ebd = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %arg_1 = OpVariable %_ptr_Function_v4half Function %15 + %arg_2 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %22 = OpLoad %v4half %arg_0 + %23 = OpLoad %v4half %arg_1 + %24 = OpLoad %v4half %arg_2 + %20 = OpExtInst %v4half %21 SmoothStep %22 %23 %24 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %smoothstep_c43ebd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %smoothstep_c43ebd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %smoothstep_c43ebd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/smoothstep/c43ebd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/smoothstep/c43ebd.wgsl.expected.wgsl new file mode 100644 index 0000000000..bb68100f74 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/c43ebd.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn smoothstep_c43ebd() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var arg_2 = vec4(f16()); + var res : vec4 = smoothstep(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_c43ebd(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_c43ebd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_c43ebd(); +} diff --git a/test/tint/builtins/gen/var/sqrt/803d1c.wgsl b/test/tint/builtins/gen/var/sqrt/803d1c.wgsl new file mode 100644 index 0000000000..39113939f6 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/803d1c.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sqrt(vec<4, f16>) -> vec<4, f16> +fn sqrt_803d1c() { + var arg_0 = vec4(f16()); + var res: vec4 = sqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_803d1c(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_803d1c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_803d1c(); +} diff --git a/test/tint/builtins/gen/var/sqrt/803d1c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sqrt/803d1c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..58428a6b01 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/803d1c.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sqrt_803d1c() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = sqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_803d1c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_803d1c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_803d1c(); + return; +} diff --git a/test/tint/builtins/gen/var/sqrt/803d1c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sqrt/803d1c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..888036ec97 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/803d1c.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void sqrt_803d1c() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = sqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_803d1c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_803d1c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_803d1c(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000017B75EA30C0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000017B75EA30C0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/sqrt/803d1c.wgsl.expected.glsl b/test/tint/builtins/gen/var/sqrt/803d1c.wgsl.expected.glsl new file mode 100644 index 0000000000..fe15cf8bc8 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/803d1c.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sqrt_803d1c() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = sqrt(arg_0); +} + +vec4 vertex_main() { + sqrt_803d1c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sqrt_803d1c() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = sqrt(arg_0); +} + +void fragment_main() { + sqrt_803d1c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sqrt_803d1c() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = sqrt(arg_0); +} + +void compute_main() { + sqrt_803d1c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sqrt/803d1c.wgsl.expected.msl b/test/tint/builtins/gen/var/sqrt/803d1c.wgsl.expected.msl new file mode 100644 index 0000000000..f05f55f350 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/803d1c.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sqrt_803d1c() { + half4 arg_0 = half4(0.0h); + half4 res = sqrt(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sqrt_803d1c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sqrt_803d1c(); + return; +} + +kernel void compute_main() { + sqrt_803d1c(); + return; +} + diff --git a/test/tint/builtins/gen/var/sqrt/803d1c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sqrt/803d1c.wgsl.expected.spvasm new file mode 100644 index 0000000000..4424826e51 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/803d1c.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sqrt_803d1c "sqrt_803d1c" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sqrt_803d1c = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Sqrt %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %sqrt_803d1c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sqrt_803d1c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %sqrt_803d1c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sqrt/803d1c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sqrt/803d1c.wgsl.expected.wgsl new file mode 100644 index 0000000000..0c835941e1 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/803d1c.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn sqrt_803d1c() { + var arg_0 = vec4(f16()); + var res : vec4 = sqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_803d1c(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_803d1c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_803d1c(); +} diff --git a/test/tint/builtins/gen/var/sqrt/895a0c.wgsl b/test/tint/builtins/gen/var/sqrt/895a0c.wgsl new file mode 100644 index 0000000000..9b4b318ddb --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/895a0c.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sqrt(vec<3, f16>) -> vec<3, f16> +fn sqrt_895a0c() { + var arg_0 = vec3(f16()); + var res: vec3 = sqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_895a0c(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_895a0c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_895a0c(); +} diff --git a/test/tint/builtins/gen/var/sqrt/895a0c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sqrt/895a0c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f22d812eea --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/895a0c.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sqrt_895a0c() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = sqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_895a0c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_895a0c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_895a0c(); + return; +} diff --git a/test/tint/builtins/gen/var/sqrt/895a0c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sqrt/895a0c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..68388d4dd0 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/895a0c.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void sqrt_895a0c() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = sqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_895a0c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_895a0c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_895a0c(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000173DFA01300(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000173DFA01300(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/sqrt/895a0c.wgsl.expected.glsl b/test/tint/builtins/gen/var/sqrt/895a0c.wgsl.expected.glsl new file mode 100644 index 0000000000..d8f2fbdb98 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/895a0c.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sqrt_895a0c() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = sqrt(arg_0); +} + +vec4 vertex_main() { + sqrt_895a0c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sqrt_895a0c() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = sqrt(arg_0); +} + +void fragment_main() { + sqrt_895a0c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sqrt_895a0c() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = sqrt(arg_0); +} + +void compute_main() { + sqrt_895a0c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sqrt/895a0c.wgsl.expected.msl b/test/tint/builtins/gen/var/sqrt/895a0c.wgsl.expected.msl new file mode 100644 index 0000000000..5a04cb5f47 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/895a0c.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sqrt_895a0c() { + half3 arg_0 = half3(0.0h); + half3 res = sqrt(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sqrt_895a0c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sqrt_895a0c(); + return; +} + +kernel void compute_main() { + sqrt_895a0c(); + return; +} + diff --git a/test/tint/builtins/gen/var/sqrt/895a0c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sqrt/895a0c.wgsl.expected.spvasm new file mode 100644 index 0000000000..e2fbf41669 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/895a0c.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sqrt_895a0c "sqrt_895a0c" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sqrt_895a0c = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Sqrt %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %sqrt_895a0c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sqrt_895a0c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %sqrt_895a0c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sqrt/895a0c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sqrt/895a0c.wgsl.expected.wgsl new file mode 100644 index 0000000000..98a857eef2 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/895a0c.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn sqrt_895a0c() { + var arg_0 = vec3(f16()); + var res : vec3 = sqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_895a0c(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_895a0c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_895a0c(); +} diff --git a/test/tint/builtins/gen/var/sqrt/d9ab4d.wgsl b/test/tint/builtins/gen/var/sqrt/d9ab4d.wgsl new file mode 100644 index 0000000000..4be2cc6159 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/d9ab4d.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sqrt(vec<2, f16>) -> vec<2, f16> +fn sqrt_d9ab4d() { + var arg_0 = vec2(f16()); + var res: vec2 = sqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_d9ab4d(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_d9ab4d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_d9ab4d(); +} diff --git a/test/tint/builtins/gen/var/sqrt/d9ab4d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sqrt/d9ab4d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..472d31d5b0 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/d9ab4d.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sqrt_d9ab4d() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = sqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_d9ab4d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_d9ab4d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_d9ab4d(); + return; +} diff --git a/test/tint/builtins/gen/var/sqrt/d9ab4d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sqrt/d9ab4d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2dae4c2799 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/d9ab4d.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void sqrt_d9ab4d() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = sqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_d9ab4d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_d9ab4d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_d9ab4d(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000261E9DA1200(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000261E9DA1200(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/sqrt/d9ab4d.wgsl.expected.glsl b/test/tint/builtins/gen/var/sqrt/d9ab4d.wgsl.expected.glsl new file mode 100644 index 0000000000..3cf2d1dfe3 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/d9ab4d.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sqrt_d9ab4d() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = sqrt(arg_0); +} + +vec4 vertex_main() { + sqrt_d9ab4d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sqrt_d9ab4d() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = sqrt(arg_0); +} + +void fragment_main() { + sqrt_d9ab4d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sqrt_d9ab4d() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = sqrt(arg_0); +} + +void compute_main() { + sqrt_d9ab4d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sqrt/d9ab4d.wgsl.expected.msl b/test/tint/builtins/gen/var/sqrt/d9ab4d.wgsl.expected.msl new file mode 100644 index 0000000000..39f7f69031 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/d9ab4d.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sqrt_d9ab4d() { + half2 arg_0 = half2(0.0h); + half2 res = sqrt(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sqrt_d9ab4d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sqrt_d9ab4d(); + return; +} + +kernel void compute_main() { + sqrt_d9ab4d(); + return; +} + diff --git a/test/tint/builtins/gen/var/sqrt/d9ab4d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sqrt/d9ab4d.wgsl.expected.spvasm new file mode 100644 index 0000000000..d02e8ccccf --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/d9ab4d.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sqrt_d9ab4d "sqrt_d9ab4d" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sqrt_d9ab4d = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Sqrt %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %sqrt_d9ab4d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sqrt_d9ab4d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %sqrt_d9ab4d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sqrt/d9ab4d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sqrt/d9ab4d.wgsl.expected.wgsl new file mode 100644 index 0000000000..cd6f05c191 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/d9ab4d.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn sqrt_d9ab4d() { + var arg_0 = vec2(f16()); + var res : vec2 = sqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_d9ab4d(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_d9ab4d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_d9ab4d(); +} diff --git a/test/tint/builtins/gen/var/sqrt/ec33e9.wgsl b/test/tint/builtins/gen/var/sqrt/ec33e9.wgsl new file mode 100644 index 0000000000..7a8254056f --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/ec33e9.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sqrt(f16) -> f16 +fn sqrt_ec33e9() { + var arg_0 = f16(); + var res: f16 = sqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_ec33e9(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_ec33e9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_ec33e9(); +} diff --git a/test/tint/builtins/gen/var/sqrt/ec33e9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sqrt/ec33e9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a0b3d5f96a --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/ec33e9.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sqrt_ec33e9() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = sqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_ec33e9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_ec33e9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_ec33e9(); + return; +} diff --git a/test/tint/builtins/gen/var/sqrt/ec33e9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sqrt/ec33e9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9a31e1357d --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/ec33e9.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void sqrt_ec33e9() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = sqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_ec33e9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_ec33e9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_ec33e9(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002A68F39AB60(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002A68F39AB60(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/sqrt/ec33e9.wgsl.expected.glsl b/test/tint/builtins/gen/var/sqrt/ec33e9.wgsl.expected.glsl new file mode 100644 index 0000000000..5cb1a665d1 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/ec33e9.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sqrt_ec33e9() { + float16_t arg_0 = 0.0hf; + float16_t res = sqrt(arg_0); +} + +vec4 vertex_main() { + sqrt_ec33e9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sqrt_ec33e9() { + float16_t arg_0 = 0.0hf; + float16_t res = sqrt(arg_0); +} + +void fragment_main() { + sqrt_ec33e9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sqrt_ec33e9() { + float16_t arg_0 = 0.0hf; + float16_t res = sqrt(arg_0); +} + +void compute_main() { + sqrt_ec33e9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sqrt/ec33e9.wgsl.expected.msl b/test/tint/builtins/gen/var/sqrt/ec33e9.wgsl.expected.msl new file mode 100644 index 0000000000..8f4e72e4a6 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/ec33e9.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sqrt_ec33e9() { + half arg_0 = 0.0h; + half res = sqrt(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sqrt_ec33e9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sqrt_ec33e9(); + return; +} + +kernel void compute_main() { + sqrt_ec33e9(); + return; +} + diff --git a/test/tint/builtins/gen/var/sqrt/ec33e9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sqrt/ec33e9.wgsl.expected.spvasm new file mode 100644 index 0000000000..c593eced59 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/ec33e9.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sqrt_ec33e9 "sqrt_ec33e9" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sqrt_ec33e9 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Sqrt %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %sqrt_ec33e9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %sqrt_ec33e9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %sqrt_ec33e9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sqrt/ec33e9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sqrt/ec33e9.wgsl.expected.wgsl new file mode 100644 index 0000000000..af947c5c5e --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/ec33e9.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn sqrt_ec33e9() { + var arg_0 = f16(); + var res : f16 = sqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_ec33e9(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_ec33e9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_ec33e9(); +} diff --git a/test/tint/builtins/gen/var/step/07cb06.wgsl b/test/tint/builtins/gen/var/step/07cb06.wgsl new file mode 100644 index 0000000000..a85442c490 --- /dev/null +++ b/test/tint/builtins/gen/var/step/07cb06.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn step(vec<2, f16>, vec<2, f16>) -> vec<2, f16> +fn step_07cb06() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var res: vec2 = step(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_07cb06(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_07cb06(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_07cb06(); +} diff --git a/test/tint/builtins/gen/var/step/07cb06.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/step/07cb06.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..58b3876a6e --- /dev/null +++ b/test/tint/builtins/gen/var/step/07cb06.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void step_07cb06() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + vector res = step(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_07cb06(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_07cb06(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_07cb06(); + return; +} diff --git a/test/tint/builtins/gen/var/step/07cb06.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/step/07cb06.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f643e8f03b --- /dev/null +++ b/test/tint/builtins/gen/var/step/07cb06.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void step_07cb06() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + vector res = step(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_07cb06(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_07cb06(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_07cb06(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000026FD2EC2DB0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000026FD2EC2DB0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000026FD2EC2DB0(4,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/step/07cb06.wgsl.expected.glsl b/test/tint/builtins/gen/var/step/07cb06.wgsl.expected.glsl new file mode 100644 index 0000000000..028ea1c5aa --- /dev/null +++ b/test/tint/builtins/gen/var/step/07cb06.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void step_07cb06() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 res = step(arg_0, arg_1); +} + +vec4 vertex_main() { + step_07cb06(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void step_07cb06() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 res = step(arg_0, arg_1); +} + +void fragment_main() { + step_07cb06(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void step_07cb06() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 res = step(arg_0, arg_1); +} + +void compute_main() { + step_07cb06(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/step/07cb06.wgsl.expected.msl b/test/tint/builtins/gen/var/step/07cb06.wgsl.expected.msl new file mode 100644 index 0000000000..e831f9197e --- /dev/null +++ b/test/tint/builtins/gen/var/step/07cb06.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void step_07cb06() { + half2 arg_0 = half2(0.0h); + half2 arg_1 = half2(0.0h); + half2 res = step(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + step_07cb06(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + step_07cb06(); + return; +} + +kernel void compute_main() { + step_07cb06(); + return; +} + diff --git a/test/tint/builtins/gen/var/step/07cb06.wgsl.expected.spvasm b/test/tint/builtins/gen/var/step/07cb06.wgsl.expected.spvasm new file mode 100644 index 0000000000..17f336aa19 --- /dev/null +++ b/test/tint/builtins/gen/var/step/07cb06.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %step_07cb06 "step_07cb06" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%step_07cb06 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %arg_1 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v2half %arg_0 + %22 = OpLoad %v2half %arg_1 + %19 = OpExtInst %v2half %20 Step %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %step_07cb06 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %step_07cb06 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %step_07cb06 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/step/07cb06.wgsl.expected.wgsl b/test/tint/builtins/gen/var/step/07cb06.wgsl.expected.wgsl new file mode 100644 index 0000000000..373395d8ea --- /dev/null +++ b/test/tint/builtins/gen/var/step/07cb06.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn step_07cb06() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var res : vec2 = step(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_07cb06(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_07cb06(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_07cb06(); +} diff --git a/test/tint/builtins/gen/var/step/630d07.wgsl b/test/tint/builtins/gen/var/step/630d07.wgsl new file mode 100644 index 0000000000..7b19969d6b --- /dev/null +++ b/test/tint/builtins/gen/var/step/630d07.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn step(f16, f16) -> f16 +fn step_630d07() { + var arg_0 = f16(); + var arg_1 = f16(); + var res: f16 = step(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_630d07(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_630d07(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_630d07(); +} diff --git a/test/tint/builtins/gen/var/step/630d07.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/step/630d07.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..12473dfc9c --- /dev/null +++ b/test/tint/builtins/gen/var/step/630d07.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void step_630d07() { + float16_t arg_0 = float16_t(0.0h); + float16_t arg_1 = float16_t(0.0h); + float16_t res = step(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_630d07(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_630d07(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_630d07(); + return; +} diff --git a/test/tint/builtins/gen/var/step/630d07.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/step/630d07.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1d7db44f9f --- /dev/null +++ b/test/tint/builtins/gen/var/step/630d07.wgsl.expected.fxc.hlsl @@ -0,0 +1,38 @@ +SKIP: FAILED + +void step_630d07() { + float16_t arg_0 = float16_t(0.0h); + float16_t arg_1 = float16_t(0.0h); + float16_t res = step(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_630d07(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_630d07(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_630d07(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024979951900(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024979951900(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/step/630d07.wgsl.expected.glsl b/test/tint/builtins/gen/var/step/630d07.wgsl.expected.glsl new file mode 100644 index 0000000000..a937e6ce10 --- /dev/null +++ b/test/tint/builtins/gen/var/step/630d07.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void step_630d07() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t res = step(arg_0, arg_1); +} + +vec4 vertex_main() { + step_630d07(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void step_630d07() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t res = step(arg_0, arg_1); +} + +void fragment_main() { + step_630d07(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void step_630d07() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t res = step(arg_0, arg_1); +} + +void compute_main() { + step_630d07(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/step/630d07.wgsl.expected.msl b/test/tint/builtins/gen/var/step/630d07.wgsl.expected.msl new file mode 100644 index 0000000000..7367608eb9 --- /dev/null +++ b/test/tint/builtins/gen/var/step/630d07.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void step_630d07() { + half arg_0 = 0.0h; + half arg_1 = 0.0h; + half res = step(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + step_630d07(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + step_630d07(); + return; +} + +kernel void compute_main() { + step_630d07(); + return; +} + diff --git a/test/tint/builtins/gen/var/step/630d07.wgsl.expected.spvasm b/test/tint/builtins/gen/var/step/630d07.wgsl.expected.spvasm new file mode 100644 index 0000000000..4ec1055e0b --- /dev/null +++ b/test/tint/builtins/gen/var/step/630d07.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %step_630d07 "step_630d07" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%step_630d07 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %arg_1 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + %20 = OpLoad %half %arg_0 + %21 = OpLoad %half %arg_1 + %18 = OpExtInst %half %19 Step %20 %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %step_630d07 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %step_630d07 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %step_630d07 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/step/630d07.wgsl.expected.wgsl b/test/tint/builtins/gen/var/step/630d07.wgsl.expected.wgsl new file mode 100644 index 0000000000..fb6884c9a2 --- /dev/null +++ b/test/tint/builtins/gen/var/step/630d07.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn step_630d07() { + var arg_0 = f16(); + var arg_1 = f16(); + var res : f16 = step(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_630d07(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_630d07(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_630d07(); +} diff --git a/test/tint/builtins/gen/var/step/baa320.wgsl b/test/tint/builtins/gen/var/step/baa320.wgsl new file mode 100644 index 0000000000..48a8fe6f58 --- /dev/null +++ b/test/tint/builtins/gen/var/step/baa320.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn step(vec<4, f16>, vec<4, f16>) -> vec<4, f16> +fn step_baa320() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var res: vec4 = step(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_baa320(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_baa320(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_baa320(); +} diff --git a/test/tint/builtins/gen/var/step/baa320.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/step/baa320.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..11ad9989a1 --- /dev/null +++ b/test/tint/builtins/gen/var/step/baa320.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void step_baa320() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + vector res = step(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_baa320(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_baa320(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_baa320(); + return; +} diff --git a/test/tint/builtins/gen/var/step/baa320.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/step/baa320.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7bae936940 --- /dev/null +++ b/test/tint/builtins/gen/var/step/baa320.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void step_baa320() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + vector res = step(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_baa320(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_baa320(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_baa320(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001DD0BA42C40(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001DD0BA42C40(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001DD0BA42C40(4,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/step/baa320.wgsl.expected.glsl b/test/tint/builtins/gen/var/step/baa320.wgsl.expected.glsl new file mode 100644 index 0000000000..6ac70dfe28 --- /dev/null +++ b/test/tint/builtins/gen/var/step/baa320.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void step_baa320() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 res = step(arg_0, arg_1); +} + +vec4 vertex_main() { + step_baa320(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void step_baa320() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 res = step(arg_0, arg_1); +} + +void fragment_main() { + step_baa320(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void step_baa320() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 res = step(arg_0, arg_1); +} + +void compute_main() { + step_baa320(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/step/baa320.wgsl.expected.msl b/test/tint/builtins/gen/var/step/baa320.wgsl.expected.msl new file mode 100644 index 0000000000..e0841af8a9 --- /dev/null +++ b/test/tint/builtins/gen/var/step/baa320.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void step_baa320() { + half4 arg_0 = half4(0.0h); + half4 arg_1 = half4(0.0h); + half4 res = step(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + step_baa320(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + step_baa320(); + return; +} + +kernel void compute_main() { + step_baa320(); + return; +} + diff --git a/test/tint/builtins/gen/var/step/baa320.wgsl.expected.spvasm b/test/tint/builtins/gen/var/step/baa320.wgsl.expected.spvasm new file mode 100644 index 0000000000..57e7451db6 --- /dev/null +++ b/test/tint/builtins/gen/var/step/baa320.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %step_baa320 "step_baa320" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%step_baa320 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %arg_1 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v4half %arg_0 + %22 = OpLoad %v4half %arg_1 + %19 = OpExtInst %v4half %20 Step %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %step_baa320 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %step_baa320 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %step_baa320 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/step/baa320.wgsl.expected.wgsl b/test/tint/builtins/gen/var/step/baa320.wgsl.expected.wgsl new file mode 100644 index 0000000000..6128002318 --- /dev/null +++ b/test/tint/builtins/gen/var/step/baa320.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn step_baa320() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var res : vec4 = step(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_baa320(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_baa320(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_baa320(); +} diff --git a/test/tint/builtins/gen/var/step/cc6b61.wgsl b/test/tint/builtins/gen/var/step/cc6b61.wgsl new file mode 100644 index 0000000000..7b954e0a83 --- /dev/null +++ b/test/tint/builtins/gen/var/step/cc6b61.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn step(vec<3, f16>, vec<3, f16>) -> vec<3, f16> +fn step_cc6b61() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var res: vec3 = step(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_cc6b61(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_cc6b61(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_cc6b61(); +} diff --git a/test/tint/builtins/gen/var/step/cc6b61.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/step/cc6b61.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..47f0c73c65 --- /dev/null +++ b/test/tint/builtins/gen/var/step/cc6b61.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void step_cc6b61() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector res = step(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_cc6b61(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_cc6b61(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_cc6b61(); + return; +} diff --git a/test/tint/builtins/gen/var/step/cc6b61.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/step/cc6b61.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..285ad21905 --- /dev/null +++ b/test/tint/builtins/gen/var/step/cc6b61.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void step_cc6b61() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector res = step(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_cc6b61(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_cc6b61(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_cc6b61(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000013865172DA0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000013865172DA0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000013865172DA0(4,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/step/cc6b61.wgsl.expected.glsl b/test/tint/builtins/gen/var/step/cc6b61.wgsl.expected.glsl new file mode 100644 index 0000000000..6b1be2e7b0 --- /dev/null +++ b/test/tint/builtins/gen/var/step/cc6b61.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void step_cc6b61() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 res = step(arg_0, arg_1); +} + +vec4 vertex_main() { + step_cc6b61(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void step_cc6b61() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 res = step(arg_0, arg_1); +} + +void fragment_main() { + step_cc6b61(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void step_cc6b61() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 res = step(arg_0, arg_1); +} + +void compute_main() { + step_cc6b61(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/step/cc6b61.wgsl.expected.msl b/test/tint/builtins/gen/var/step/cc6b61.wgsl.expected.msl new file mode 100644 index 0000000000..40defbb646 --- /dev/null +++ b/test/tint/builtins/gen/var/step/cc6b61.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void step_cc6b61() { + half3 arg_0 = half3(0.0h); + half3 arg_1 = half3(0.0h); + half3 res = step(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + step_cc6b61(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + step_cc6b61(); + return; +} + +kernel void compute_main() { + step_cc6b61(); + return; +} + diff --git a/test/tint/builtins/gen/var/step/cc6b61.wgsl.expected.spvasm b/test/tint/builtins/gen/var/step/cc6b61.wgsl.expected.spvasm new file mode 100644 index 0000000000..efbdfdce90 --- /dev/null +++ b/test/tint/builtins/gen/var/step/cc6b61.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %step_cc6b61 "step_cc6b61" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%step_cc6b61 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %arg_1 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v3half %arg_0 + %22 = OpLoad %v3half %arg_1 + %19 = OpExtInst %v3half %20 Step %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %step_cc6b61 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %step_cc6b61 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %step_cc6b61 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/step/cc6b61.wgsl.expected.wgsl b/test/tint/builtins/gen/var/step/cc6b61.wgsl.expected.wgsl new file mode 100644 index 0000000000..68bf8277df --- /dev/null +++ b/test/tint/builtins/gen/var/step/cc6b61.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn step_cc6b61() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var res : vec3 = step(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_cc6b61(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_cc6b61(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_cc6b61(); +} diff --git a/test/tint/builtins/gen/var/tan/539e54.wgsl b/test/tint/builtins/gen/var/tan/539e54.wgsl new file mode 100644 index 0000000000..1b4dec5ab8 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/539e54.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn tan(vec<4, f16>) -> vec<4, f16> +fn tan_539e54() { + var arg_0 = vec4(f16()); + var res: vec4 = tan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_539e54(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_539e54(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_539e54(); +} diff --git a/test/tint/builtins/gen/var/tan/539e54.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/tan/539e54.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..57565884af --- /dev/null +++ b/test/tint/builtins/gen/var/tan/539e54.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void tan_539e54() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = tan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_539e54(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_539e54(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_539e54(); + return; +} diff --git a/test/tint/builtins/gen/var/tan/539e54.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/tan/539e54.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c9329384d5 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/539e54.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void tan_539e54() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = tan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_539e54(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_539e54(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_539e54(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002AE30C0C880(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002AE30C0C880(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/tan/539e54.wgsl.expected.glsl b/test/tint/builtins/gen/var/tan/539e54.wgsl.expected.glsl new file mode 100644 index 0000000000..7b8a22d361 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/539e54.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tan_539e54() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = tan(arg_0); +} + +vec4 vertex_main() { + tan_539e54(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void tan_539e54() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = tan(arg_0); +} + +void fragment_main() { + tan_539e54(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tan_539e54() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = tan(arg_0); +} + +void compute_main() { + tan_539e54(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/tan/539e54.wgsl.expected.msl b/test/tint/builtins/gen/var/tan/539e54.wgsl.expected.msl new file mode 100644 index 0000000000..6c347d9b27 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/539e54.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void tan_539e54() { + half4 arg_0 = half4(0.0h); + half4 res = tan(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tan_539e54(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tan_539e54(); + return; +} + +kernel void compute_main() { + tan_539e54(); + return; +} + diff --git a/test/tint/builtins/gen/var/tan/539e54.wgsl.expected.spvasm b/test/tint/builtins/gen/var/tan/539e54.wgsl.expected.spvasm new file mode 100644 index 0000000000..3808f8e208 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/539e54.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tan_539e54 "tan_539e54" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tan_539e54 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Tan %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %tan_539e54 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %tan_539e54 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %tan_539e54 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/tan/539e54.wgsl.expected.wgsl b/test/tint/builtins/gen/var/tan/539e54.wgsl.expected.wgsl new file mode 100644 index 0000000000..ceb00cf272 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/539e54.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn tan_539e54() { + var arg_0 = vec4(f16()); + var res : vec4 = tan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_539e54(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_539e54(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_539e54(); +} diff --git a/test/tint/builtins/gen/var/tan/9f7c9c.wgsl b/test/tint/builtins/gen/var/tan/9f7c9c.wgsl new file mode 100644 index 0000000000..812610e314 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/9f7c9c.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn tan(vec<2, f16>) -> vec<2, f16> +fn tan_9f7c9c() { + var arg_0 = vec2(f16()); + var res: vec2 = tan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_9f7c9c(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_9f7c9c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_9f7c9c(); +} diff --git a/test/tint/builtins/gen/var/tan/9f7c9c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/tan/9f7c9c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2dc0ec5de1 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/9f7c9c.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void tan_9f7c9c() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = tan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_9f7c9c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_9f7c9c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_9f7c9c(); + return; +} diff --git a/test/tint/builtins/gen/var/tan/9f7c9c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/tan/9f7c9c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bfffaf2a2a --- /dev/null +++ b/test/tint/builtins/gen/var/tan/9f7c9c.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void tan_9f7c9c() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = tan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_9f7c9c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_9f7c9c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_9f7c9c(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000013C12D4B340(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000013C12D4B340(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/tan/9f7c9c.wgsl.expected.glsl b/test/tint/builtins/gen/var/tan/9f7c9c.wgsl.expected.glsl new file mode 100644 index 0000000000..fa9d31ee2d --- /dev/null +++ b/test/tint/builtins/gen/var/tan/9f7c9c.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tan_9f7c9c() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = tan(arg_0); +} + +vec4 vertex_main() { + tan_9f7c9c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void tan_9f7c9c() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = tan(arg_0); +} + +void fragment_main() { + tan_9f7c9c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tan_9f7c9c() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = tan(arg_0); +} + +void compute_main() { + tan_9f7c9c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/tan/9f7c9c.wgsl.expected.msl b/test/tint/builtins/gen/var/tan/9f7c9c.wgsl.expected.msl new file mode 100644 index 0000000000..5e664677fe --- /dev/null +++ b/test/tint/builtins/gen/var/tan/9f7c9c.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void tan_9f7c9c() { + half2 arg_0 = half2(0.0h); + half2 res = tan(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tan_9f7c9c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tan_9f7c9c(); + return; +} + +kernel void compute_main() { + tan_9f7c9c(); + return; +} + diff --git a/test/tint/builtins/gen/var/tan/9f7c9c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/tan/9f7c9c.wgsl.expected.spvasm new file mode 100644 index 0000000000..f4068eea16 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/9f7c9c.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tan_9f7c9c "tan_9f7c9c" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tan_9f7c9c = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Tan %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %tan_9f7c9c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %tan_9f7c9c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %tan_9f7c9c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/tan/9f7c9c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/tan/9f7c9c.wgsl.expected.wgsl new file mode 100644 index 0000000000..87305cc0f9 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/9f7c9c.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn tan_9f7c9c() { + var arg_0 = vec2(f16()); + var res : vec2 = tan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_9f7c9c(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_9f7c9c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_9f7c9c(); +} diff --git a/test/tint/builtins/gen/var/tan/d4d491.wgsl b/test/tint/builtins/gen/var/tan/d4d491.wgsl new file mode 100644 index 0000000000..3d3c9fa05c --- /dev/null +++ b/test/tint/builtins/gen/var/tan/d4d491.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn tan(f16) -> f16 +fn tan_d4d491() { + var arg_0 = f16(); + var res: f16 = tan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_d4d491(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_d4d491(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_d4d491(); +} diff --git a/test/tint/builtins/gen/var/tan/d4d491.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/tan/d4d491.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fb9b0ef077 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/d4d491.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void tan_d4d491() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = tan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_d4d491(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_d4d491(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_d4d491(); + return; +} diff --git a/test/tint/builtins/gen/var/tan/d4d491.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/tan/d4d491.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6df8e23220 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/d4d491.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void tan_d4d491() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = tan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_d4d491(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_d4d491(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_d4d491(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000026911B52E20(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000026911B52E20(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/tan/d4d491.wgsl.expected.glsl b/test/tint/builtins/gen/var/tan/d4d491.wgsl.expected.glsl new file mode 100644 index 0000000000..c826b6bddb --- /dev/null +++ b/test/tint/builtins/gen/var/tan/d4d491.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tan_d4d491() { + float16_t arg_0 = 0.0hf; + float16_t res = tan(arg_0); +} + +vec4 vertex_main() { + tan_d4d491(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void tan_d4d491() { + float16_t arg_0 = 0.0hf; + float16_t res = tan(arg_0); +} + +void fragment_main() { + tan_d4d491(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tan_d4d491() { + float16_t arg_0 = 0.0hf; + float16_t res = tan(arg_0); +} + +void compute_main() { + tan_d4d491(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/tan/d4d491.wgsl.expected.msl b/test/tint/builtins/gen/var/tan/d4d491.wgsl.expected.msl new file mode 100644 index 0000000000..792203e59a --- /dev/null +++ b/test/tint/builtins/gen/var/tan/d4d491.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void tan_d4d491() { + half arg_0 = 0.0h; + half res = tan(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tan_d4d491(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tan_d4d491(); + return; +} + +kernel void compute_main() { + tan_d4d491(); + return; +} + diff --git a/test/tint/builtins/gen/var/tan/d4d491.wgsl.expected.spvasm b/test/tint/builtins/gen/var/tan/d4d491.wgsl.expected.spvasm new file mode 100644 index 0000000000..e05388b753 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/d4d491.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tan_d4d491 "tan_d4d491" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tan_d4d491 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Tan %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %tan_d4d491 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %tan_d4d491 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %tan_d4d491 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/tan/d4d491.wgsl.expected.wgsl b/test/tint/builtins/gen/var/tan/d4d491.wgsl.expected.wgsl new file mode 100644 index 0000000000..34abd8dc84 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/d4d491.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn tan_d4d491() { + var arg_0 = f16(); + var res : f16 = tan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_d4d491(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_d4d491(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_d4d491(); +} diff --git a/test/tint/builtins/gen/var/tan/db0456.wgsl b/test/tint/builtins/gen/var/tan/db0456.wgsl new file mode 100644 index 0000000000..0277fd9754 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/db0456.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn tan(vec<3, f16>) -> vec<3, f16> +fn tan_db0456() { + var arg_0 = vec3(f16()); + var res: vec3 = tan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_db0456(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_db0456(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_db0456(); +} diff --git a/test/tint/builtins/gen/var/tan/db0456.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/tan/db0456.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b14a91a10d --- /dev/null +++ b/test/tint/builtins/gen/var/tan/db0456.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void tan_db0456() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = tan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_db0456(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_db0456(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_db0456(); + return; +} diff --git a/test/tint/builtins/gen/var/tan/db0456.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/tan/db0456.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2c6f4b3f76 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/db0456.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void tan_db0456() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = tan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_db0456(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_db0456(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_db0456(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022CB9A7E270(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022CB9A7E270(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/tan/db0456.wgsl.expected.glsl b/test/tint/builtins/gen/var/tan/db0456.wgsl.expected.glsl new file mode 100644 index 0000000000..06986581e9 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/db0456.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tan_db0456() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = tan(arg_0); +} + +vec4 vertex_main() { + tan_db0456(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void tan_db0456() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = tan(arg_0); +} + +void fragment_main() { + tan_db0456(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tan_db0456() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = tan(arg_0); +} + +void compute_main() { + tan_db0456(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/tan/db0456.wgsl.expected.msl b/test/tint/builtins/gen/var/tan/db0456.wgsl.expected.msl new file mode 100644 index 0000000000..35e012d6fa --- /dev/null +++ b/test/tint/builtins/gen/var/tan/db0456.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void tan_db0456() { + half3 arg_0 = half3(0.0h); + half3 res = tan(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tan_db0456(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tan_db0456(); + return; +} + +kernel void compute_main() { + tan_db0456(); + return; +} + diff --git a/test/tint/builtins/gen/var/tan/db0456.wgsl.expected.spvasm b/test/tint/builtins/gen/var/tan/db0456.wgsl.expected.spvasm new file mode 100644 index 0000000000..66a7ba7c63 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/db0456.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tan_db0456 "tan_db0456" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tan_db0456 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Tan %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %tan_db0456 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %tan_db0456 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %tan_db0456 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/tan/db0456.wgsl.expected.wgsl b/test/tint/builtins/gen/var/tan/db0456.wgsl.expected.wgsl new file mode 100644 index 0000000000..fb3a092f1e --- /dev/null +++ b/test/tint/builtins/gen/var/tan/db0456.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn tan_db0456() { + var arg_0 = vec3(f16()); + var res : vec3 = tan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_db0456(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_db0456(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_db0456(); +} diff --git a/test/tint/builtins/gen/var/tanh/06a4fe.wgsl b/test/tint/builtins/gen/var/tanh/06a4fe.wgsl new file mode 100644 index 0000000000..4c328b0616 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/06a4fe.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn tanh(vec<3, f16>) -> vec<3, f16> +fn tanh_06a4fe() { + var arg_0 = vec3(f16()); + var res: vec3 = tanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_06a4fe(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_06a4fe(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_06a4fe(); +} diff --git a/test/tint/builtins/gen/var/tanh/06a4fe.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/tanh/06a4fe.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..346965fc45 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/06a4fe.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void tanh_06a4fe() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = tanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_06a4fe(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_06a4fe(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_06a4fe(); + return; +} diff --git a/test/tint/builtins/gen/var/tanh/06a4fe.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/tanh/06a4fe.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a8775d630f --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/06a4fe.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void tanh_06a4fe() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = tanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_06a4fe(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_06a4fe(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_06a4fe(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000028509F68770(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000028509F68770(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/tanh/06a4fe.wgsl.expected.glsl b/test/tint/builtins/gen/var/tanh/06a4fe.wgsl.expected.glsl new file mode 100644 index 0000000000..6d9857aa0c --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/06a4fe.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tanh_06a4fe() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = tanh(arg_0); +} + +vec4 vertex_main() { + tanh_06a4fe(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void tanh_06a4fe() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = tanh(arg_0); +} + +void fragment_main() { + tanh_06a4fe(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tanh_06a4fe() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = tanh(arg_0); +} + +void compute_main() { + tanh_06a4fe(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/tanh/06a4fe.wgsl.expected.msl b/test/tint/builtins/gen/var/tanh/06a4fe.wgsl.expected.msl new file mode 100644 index 0000000000..3f2db876d4 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/06a4fe.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void tanh_06a4fe() { + half3 arg_0 = half3(0.0h); + half3 res = tanh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tanh_06a4fe(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tanh_06a4fe(); + return; +} + +kernel void compute_main() { + tanh_06a4fe(); + return; +} + diff --git a/test/tint/builtins/gen/var/tanh/06a4fe.wgsl.expected.spvasm b/test/tint/builtins/gen/var/tanh/06a4fe.wgsl.expected.spvasm new file mode 100644 index 0000000000..0a02492154 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/06a4fe.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tanh_06a4fe "tanh_06a4fe" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tanh_06a4fe = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Tanh %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %tanh_06a4fe + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %tanh_06a4fe + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %tanh_06a4fe + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/tanh/06a4fe.wgsl.expected.wgsl b/test/tint/builtins/gen/var/tanh/06a4fe.wgsl.expected.wgsl new file mode 100644 index 0000000000..8f73c44a8c --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/06a4fe.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn tanh_06a4fe() { + var arg_0 = vec3(f16()); + var res : vec3 = tanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_06a4fe(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_06a4fe(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_06a4fe(); +} diff --git a/test/tint/builtins/gen/var/tanh/5b19af.wgsl b/test/tint/builtins/gen/var/tanh/5b19af.wgsl new file mode 100644 index 0000000000..1b1cc793f1 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/5b19af.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn tanh(f16) -> f16 +fn tanh_5b19af() { + var arg_0 = f16(); + var res: f16 = tanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_5b19af(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_5b19af(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_5b19af(); +} diff --git a/test/tint/builtins/gen/var/tanh/5b19af.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/tanh/5b19af.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..23e33a7e32 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/5b19af.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void tanh_5b19af() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = tanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_5b19af(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_5b19af(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_5b19af(); + return; +} diff --git a/test/tint/builtins/gen/var/tanh/5b19af.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/tanh/5b19af.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8c81022257 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/5b19af.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void tanh_5b19af() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = tanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_5b19af(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_5b19af(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_5b19af(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001A07EE64130(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001A07EE64130(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/tanh/5b19af.wgsl.expected.glsl b/test/tint/builtins/gen/var/tanh/5b19af.wgsl.expected.glsl new file mode 100644 index 0000000000..27503fc53a --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/5b19af.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tanh_5b19af() { + float16_t arg_0 = 0.0hf; + float16_t res = tanh(arg_0); +} + +vec4 vertex_main() { + tanh_5b19af(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void tanh_5b19af() { + float16_t arg_0 = 0.0hf; + float16_t res = tanh(arg_0); +} + +void fragment_main() { + tanh_5b19af(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tanh_5b19af() { + float16_t arg_0 = 0.0hf; + float16_t res = tanh(arg_0); +} + +void compute_main() { + tanh_5b19af(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/tanh/5b19af.wgsl.expected.msl b/test/tint/builtins/gen/var/tanh/5b19af.wgsl.expected.msl new file mode 100644 index 0000000000..143fb989b5 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/5b19af.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void tanh_5b19af() { + half arg_0 = 0.0h; + half res = tanh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tanh_5b19af(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tanh_5b19af(); + return; +} + +kernel void compute_main() { + tanh_5b19af(); + return; +} + diff --git a/test/tint/builtins/gen/var/tanh/5b19af.wgsl.expected.spvasm b/test/tint/builtins/gen/var/tanh/5b19af.wgsl.expected.spvasm new file mode 100644 index 0000000000..9ea5007efe --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/5b19af.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tanh_5b19af "tanh_5b19af" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tanh_5b19af = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Tanh %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %tanh_5b19af + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %tanh_5b19af + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %tanh_5b19af + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/tanh/5b19af.wgsl.expected.wgsl b/test/tint/builtins/gen/var/tanh/5b19af.wgsl.expected.wgsl new file mode 100644 index 0000000000..b1f8363f16 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/5b19af.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn tanh_5b19af() { + var arg_0 = f16(); + var res : f16 = tanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_5b19af(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_5b19af(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_5b19af(); +} diff --git a/test/tint/builtins/gen/var/tanh/6d105a.wgsl b/test/tint/builtins/gen/var/tanh/6d105a.wgsl new file mode 100644 index 0000000000..08d3e6bb2c --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/6d105a.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn tanh(vec<2, f16>) -> vec<2, f16> +fn tanh_6d105a() { + var arg_0 = vec2(f16()); + var res: vec2 = tanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_6d105a(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_6d105a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_6d105a(); +} diff --git a/test/tint/builtins/gen/var/tanh/6d105a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/tanh/6d105a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cb526b42f1 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/6d105a.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void tanh_6d105a() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = tanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_6d105a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_6d105a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_6d105a(); + return; +} diff --git a/test/tint/builtins/gen/var/tanh/6d105a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/tanh/6d105a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..56aff70fb8 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/6d105a.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void tanh_6d105a() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = tanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_6d105a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_6d105a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_6d105a(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022C76563400(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022C76563400(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/tanh/6d105a.wgsl.expected.glsl b/test/tint/builtins/gen/var/tanh/6d105a.wgsl.expected.glsl new file mode 100644 index 0000000000..ab61ec7a4a --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/6d105a.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tanh_6d105a() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = tanh(arg_0); +} + +vec4 vertex_main() { + tanh_6d105a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void tanh_6d105a() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = tanh(arg_0); +} + +void fragment_main() { + tanh_6d105a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tanh_6d105a() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = tanh(arg_0); +} + +void compute_main() { + tanh_6d105a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/tanh/6d105a.wgsl.expected.msl b/test/tint/builtins/gen/var/tanh/6d105a.wgsl.expected.msl new file mode 100644 index 0000000000..1affd276c0 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/6d105a.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void tanh_6d105a() { + half2 arg_0 = half2(0.0h); + half2 res = tanh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tanh_6d105a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tanh_6d105a(); + return; +} + +kernel void compute_main() { + tanh_6d105a(); + return; +} + diff --git a/test/tint/builtins/gen/var/tanh/6d105a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/tanh/6d105a.wgsl.expected.spvasm new file mode 100644 index 0000000000..8fa93ec8a1 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/6d105a.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tanh_6d105a "tanh_6d105a" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tanh_6d105a = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Tanh %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %tanh_6d105a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %tanh_6d105a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %tanh_6d105a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/tanh/6d105a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/tanh/6d105a.wgsl.expected.wgsl new file mode 100644 index 0000000000..b638ef85ac --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/6d105a.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn tanh_6d105a() { + var arg_0 = vec2(f16()); + var res : vec2 = tanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_6d105a(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_6d105a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_6d105a(); +} diff --git a/test/tint/builtins/gen/var/tanh/e8efb3.wgsl b/test/tint/builtins/gen/var/tanh/e8efb3.wgsl new file mode 100644 index 0000000000..8091075e2e --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/e8efb3.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn tanh(vec<4, f16>) -> vec<4, f16> +fn tanh_e8efb3() { + var arg_0 = vec4(f16()); + var res: vec4 = tanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_e8efb3(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_e8efb3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_e8efb3(); +} diff --git a/test/tint/builtins/gen/var/tanh/e8efb3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/tanh/e8efb3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..26cb7ee5b7 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/e8efb3.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void tanh_e8efb3() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = tanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_e8efb3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_e8efb3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_e8efb3(); + return; +} diff --git a/test/tint/builtins/gen/var/tanh/e8efb3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/tanh/e8efb3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4ce063183d --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/e8efb3.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void tanh_e8efb3() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = tanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_e8efb3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_e8efb3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_e8efb3(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020C348DBBA0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020C348DBBA0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/tanh/e8efb3.wgsl.expected.glsl b/test/tint/builtins/gen/var/tanh/e8efb3.wgsl.expected.glsl new file mode 100644 index 0000000000..1d866b6cdc --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/e8efb3.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tanh_e8efb3() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = tanh(arg_0); +} + +vec4 vertex_main() { + tanh_e8efb3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void tanh_e8efb3() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = tanh(arg_0); +} + +void fragment_main() { + tanh_e8efb3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tanh_e8efb3() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = tanh(arg_0); +} + +void compute_main() { + tanh_e8efb3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/tanh/e8efb3.wgsl.expected.msl b/test/tint/builtins/gen/var/tanh/e8efb3.wgsl.expected.msl new file mode 100644 index 0000000000..0b5e6f4d96 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/e8efb3.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void tanh_e8efb3() { + half4 arg_0 = half4(0.0h); + half4 res = tanh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tanh_e8efb3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tanh_e8efb3(); + return; +} + +kernel void compute_main() { + tanh_e8efb3(); + return; +} + diff --git a/test/tint/builtins/gen/var/tanh/e8efb3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/tanh/e8efb3.wgsl.expected.spvasm new file mode 100644 index 0000000000..8e079164d6 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/e8efb3.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tanh_e8efb3 "tanh_e8efb3" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tanh_e8efb3 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Tanh %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %tanh_e8efb3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %tanh_e8efb3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %tanh_e8efb3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/tanh/e8efb3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/tanh/e8efb3.wgsl.expected.wgsl new file mode 100644 index 0000000000..bdb2905503 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/e8efb3.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn tanh_e8efb3() { + var arg_0 = vec4(f16()); + var res : vec4 = tanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_e8efb3(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_e8efb3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_e8efb3(); +} diff --git a/test/tint/builtins/gen/var/transpose/06794e.wgsl b/test/tint/builtins/gen/var/transpose/06794e.wgsl new file mode 100644 index 0000000000..e17468f1cf --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/06794e.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn transpose(mat<3, 3, f16>) -> mat<3, 3, f16> +fn transpose_06794e() { + var arg_0 = mat3x3(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16()); + var res: mat3x3 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_06794e(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_06794e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_06794e(); +} diff --git a/test/tint/builtins/gen/var/transpose/06794e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/transpose/06794e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cdd16a4175 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/06794e.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void transpose_06794e() { + matrix arg_0 = matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); + matrix res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_06794e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_06794e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_06794e(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/06794e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/transpose/06794e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8e83264b06 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/06794e.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void transpose_06794e() { + matrix arg_0 = matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); + matrix res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_06794e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_06794e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_06794e(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000166C5129750(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000166C5129750(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/transpose/06794e.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/06794e.wgsl.expected.glsl new file mode 100644 index 0000000000..558f547934 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/06794e.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_06794e() { + f16mat3 arg_0 = f16mat3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf)); + f16mat3 res = transpose(arg_0); +} + +vec4 vertex_main() { + transpose_06794e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void transpose_06794e() { + f16mat3 arg_0 = f16mat3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf)); + f16mat3 res = transpose(arg_0); +} + +void fragment_main() { + transpose_06794e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_06794e() { + f16mat3 arg_0 = f16mat3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf)); + f16mat3 res = transpose(arg_0); +} + +void compute_main() { + transpose_06794e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/06794e.wgsl.expected.msl b/test/tint/builtins/gen/var/transpose/06794e.wgsl.expected.msl new file mode 100644 index 0000000000..bef8041f1c --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/06794e.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void transpose_06794e() { + half3x3 arg_0 = half3x3(half3(0.0h), half3(0.0h), half3(0.0h)); + half3x3 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_06794e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_06794e(); + return; +} + +kernel void compute_main() { + transpose_06794e(); + return; +} + diff --git a/test/tint/builtins/gen/var/transpose/06794e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/transpose/06794e.wgsl.expected.spvasm new file mode 100644 index 0000000000..7817296401 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/06794e.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_06794e "transpose_06794e" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat3v3half = OpTypeMatrix %v3half 3 + %16 = OpConstantNull %mat3v3half +%_ptr_Function_mat3v3half = OpTypePointer Function %mat3v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%transpose_06794e = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat3v3half Function %16 + %res = OpVariable %_ptr_Function_mat3v3half Function %16 + OpStore %arg_0 %16 + %20 = OpLoad %mat3v3half %arg_0 + %19 = OpTranspose %mat3v3half %20 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %transpose_06794e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %transpose_06794e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %transpose_06794e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/transpose/06794e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/transpose/06794e.wgsl.expected.wgsl new file mode 100644 index 0000000000..500244dfe2 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/06794e.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn transpose_06794e() { + var arg_0 = mat3x3(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16()); + var res : mat3x3 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_06794e(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_06794e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_06794e(); +} diff --git a/test/tint/builtins/gen/var/transpose/5edd96.wgsl b/test/tint/builtins/gen/var/transpose/5edd96.wgsl new file mode 100644 index 0000000000..8bf22e8ebc --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/5edd96.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn transpose(mat<4, 2, f16>) -> mat<2, 4, f16> +fn transpose_5edd96() { + var arg_0 = mat4x2(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16()); + var res: mat2x4 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_5edd96(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_5edd96(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_5edd96(); +} diff --git a/test/tint/builtins/gen/var/transpose/5edd96.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/transpose/5edd96.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5bfa600378 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/5edd96.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void transpose_5edd96() { + matrix arg_0 = matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx); + matrix res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_5edd96(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_5edd96(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_5edd96(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/5edd96.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/transpose/5edd96.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9874ab3527 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/5edd96.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void transpose_5edd96() { + matrix arg_0 = matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx); + matrix res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_5edd96(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_5edd96(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_5edd96(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F440374A40(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F440374A40(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/transpose/5edd96.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/5edd96.wgsl.expected.glsl new file mode 100644 index 0000000000..68629f5da7 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/5edd96.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_5edd96() { + f16mat4x2 arg_0 = f16mat4x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf)); + f16mat2x4 res = transpose(arg_0); +} + +vec4 vertex_main() { + transpose_5edd96(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void transpose_5edd96() { + f16mat4x2 arg_0 = f16mat4x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf)); + f16mat2x4 res = transpose(arg_0); +} + +void fragment_main() { + transpose_5edd96(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_5edd96() { + f16mat4x2 arg_0 = f16mat4x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf)); + f16mat2x4 res = transpose(arg_0); +} + +void compute_main() { + transpose_5edd96(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/5edd96.wgsl.expected.msl b/test/tint/builtins/gen/var/transpose/5edd96.wgsl.expected.msl new file mode 100644 index 0000000000..c656586ff3 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/5edd96.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void transpose_5edd96() { + half4x2 arg_0 = half4x2(half2(0.0h), half2(0.0h), half2(0.0h), half2(0.0h)); + half2x4 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_5edd96(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_5edd96(); + return; +} + +kernel void compute_main() { + transpose_5edd96(); + return; +} + diff --git a/test/tint/builtins/gen/var/transpose/5edd96.wgsl.expected.spvasm b/test/tint/builtins/gen/var/transpose/5edd96.wgsl.expected.spvasm new file mode 100644 index 0000000000..a433092809 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/5edd96.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_5edd96 "transpose_5edd96" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat4v2half = OpTypeMatrix %v2half 4 + %16 = OpConstantNull %mat4v2half +%_ptr_Function_mat4v2half = OpTypePointer Function %mat4v2half + %v4half = OpTypeVector %half 4 + %mat2v4half = OpTypeMatrix %v4half 2 +%_ptr_Function_mat2v4half = OpTypePointer Function %mat2v4half + %25 = OpConstantNull %mat2v4half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%transpose_5edd96 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat4v2half Function %16 + %res = OpVariable %_ptr_Function_mat2v4half Function %25 + OpStore %arg_0 %16 + %22 = OpLoad %mat4v2half %arg_0 + %19 = OpTranspose %mat2v4half %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %transpose_5edd96 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %transpose_5edd96 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %transpose_5edd96 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/transpose/5edd96.wgsl.expected.wgsl b/test/tint/builtins/gen/var/transpose/5edd96.wgsl.expected.wgsl new file mode 100644 index 0000000000..9c293d94ed --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/5edd96.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn transpose_5edd96() { + var arg_0 = mat4x2(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16()); + var res : mat2x4 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_5edd96(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_5edd96(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_5edd96(); +} diff --git a/test/tint/builtins/gen/var/transpose/5f36bf.wgsl b/test/tint/builtins/gen/var/transpose/5f36bf.wgsl new file mode 100644 index 0000000000..7dfb05cdf1 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/5f36bf.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn transpose(mat<4, 3, f16>) -> mat<3, 4, f16> +fn transpose_5f36bf() { + var arg_0 = mat4x3(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16()); + var res: mat3x4 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_5f36bf(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_5f36bf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_5f36bf(); +} diff --git a/test/tint/builtins/gen/var/transpose/5f36bf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/transpose/5f36bf.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6f424bdd13 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/5f36bf.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void transpose_5f36bf() { + matrix arg_0 = matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); + matrix res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_5f36bf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_5f36bf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_5f36bf(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/5f36bf.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/transpose/5f36bf.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cfb38a5f4e --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/5f36bf.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void transpose_5f36bf() { + matrix arg_0 = matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); + matrix res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_5f36bf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_5f36bf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_5f36bf(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002500869E2F0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002500869E2F0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/transpose/5f36bf.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/5f36bf.wgsl.expected.glsl new file mode 100644 index 0000000000..306e862be8 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/5f36bf.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_5f36bf() { + f16mat4x3 arg_0 = f16mat4x3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf)); + f16mat3x4 res = transpose(arg_0); +} + +vec4 vertex_main() { + transpose_5f36bf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void transpose_5f36bf() { + f16mat4x3 arg_0 = f16mat4x3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf)); + f16mat3x4 res = transpose(arg_0); +} + +void fragment_main() { + transpose_5f36bf(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_5f36bf() { + f16mat4x3 arg_0 = f16mat4x3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf)); + f16mat3x4 res = transpose(arg_0); +} + +void compute_main() { + transpose_5f36bf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/5f36bf.wgsl.expected.msl b/test/tint/builtins/gen/var/transpose/5f36bf.wgsl.expected.msl new file mode 100644 index 0000000000..2f8a2ac28f --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/5f36bf.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void transpose_5f36bf() { + half4x3 arg_0 = half4x3(half3(0.0h), half3(0.0h), half3(0.0h), half3(0.0h)); + half3x4 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_5f36bf(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_5f36bf(); + return; +} + +kernel void compute_main() { + transpose_5f36bf(); + return; +} + diff --git a/test/tint/builtins/gen/var/transpose/5f36bf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/transpose/5f36bf.wgsl.expected.spvasm new file mode 100644 index 0000000000..8a2641b0cf --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/5f36bf.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_5f36bf "transpose_5f36bf" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat4v3half = OpTypeMatrix %v3half 4 + %16 = OpConstantNull %mat4v3half +%_ptr_Function_mat4v3half = OpTypePointer Function %mat4v3half + %v4half = OpTypeVector %half 4 + %mat3v4half = OpTypeMatrix %v4half 3 +%_ptr_Function_mat3v4half = OpTypePointer Function %mat3v4half + %25 = OpConstantNull %mat3v4half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%transpose_5f36bf = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat4v3half Function %16 + %res = OpVariable %_ptr_Function_mat3v4half Function %25 + OpStore %arg_0 %16 + %22 = OpLoad %mat4v3half %arg_0 + %19 = OpTranspose %mat3v4half %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %transpose_5f36bf + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %transpose_5f36bf + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %transpose_5f36bf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/transpose/5f36bf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/transpose/5f36bf.wgsl.expected.wgsl new file mode 100644 index 0000000000..4fe203151d --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/5f36bf.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn transpose_5f36bf() { + var arg_0 = mat4x3(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16()); + var res : mat3x4 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_5f36bf(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_5f36bf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_5f36bf(); +} diff --git a/test/tint/builtins/gen/var/transpose/7be8b2.wgsl b/test/tint/builtins/gen/var/transpose/7be8b2.wgsl new file mode 100644 index 0000000000..7102102baf --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/7be8b2.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn transpose(mat<2, 2, f16>) -> mat<2, 2, f16> +fn transpose_7be8b2() { + var arg_0 = mat2x2(f16(), f16(), f16(), f16()); + var res: mat2x2 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_7be8b2(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_7be8b2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_7be8b2(); +} diff --git a/test/tint/builtins/gen/var/transpose/7be8b2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/transpose/7be8b2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ee1edd6352 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/7be8b2.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void transpose_7be8b2() { + matrix arg_0 = matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx); + matrix res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_7be8b2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_7be8b2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_7be8b2(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/7be8b2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/transpose/7be8b2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cd61e2cab3 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/7be8b2.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void transpose_7be8b2() { + matrix arg_0 = matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx); + matrix res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_7be8b2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_7be8b2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_7be8b2(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000015E28C70990(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000015E28C70990(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/transpose/7be8b2.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/7be8b2.wgsl.expected.glsl new file mode 100644 index 0000000000..f9c1764182 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/7be8b2.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_7be8b2() { + f16mat2 arg_0 = f16mat2(f16vec2(0.0hf), f16vec2(0.0hf)); + f16mat2 res = transpose(arg_0); +} + +vec4 vertex_main() { + transpose_7be8b2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void transpose_7be8b2() { + f16mat2 arg_0 = f16mat2(f16vec2(0.0hf), f16vec2(0.0hf)); + f16mat2 res = transpose(arg_0); +} + +void fragment_main() { + transpose_7be8b2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_7be8b2() { + f16mat2 arg_0 = f16mat2(f16vec2(0.0hf), f16vec2(0.0hf)); + f16mat2 res = transpose(arg_0); +} + +void compute_main() { + transpose_7be8b2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/7be8b2.wgsl.expected.msl b/test/tint/builtins/gen/var/transpose/7be8b2.wgsl.expected.msl new file mode 100644 index 0000000000..f53a158427 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/7be8b2.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void transpose_7be8b2() { + half2x2 arg_0 = half2x2(half2(0.0h), half2(0.0h)); + half2x2 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_7be8b2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_7be8b2(); + return; +} + +kernel void compute_main() { + transpose_7be8b2(); + return; +} + diff --git a/test/tint/builtins/gen/var/transpose/7be8b2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/transpose/7be8b2.wgsl.expected.spvasm new file mode 100644 index 0000000000..f676cac4f0 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/7be8b2.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_7be8b2 "transpose_7be8b2" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat2v2half = OpTypeMatrix %v2half 2 + %16 = OpConstantNull %mat2v2half +%_ptr_Function_mat2v2half = OpTypePointer Function %mat2v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%transpose_7be8b2 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat2v2half Function %16 + %res = OpVariable %_ptr_Function_mat2v2half Function %16 + OpStore %arg_0 %16 + %20 = OpLoad %mat2v2half %arg_0 + %19 = OpTranspose %mat2v2half %20 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %transpose_7be8b2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %transpose_7be8b2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %transpose_7be8b2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/transpose/7be8b2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/transpose/7be8b2.wgsl.expected.wgsl new file mode 100644 index 0000000000..277d2e5d5f --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/7be8b2.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn transpose_7be8b2() { + var arg_0 = mat2x2(f16(), f16(), f16(), f16()); + var res : mat2x2 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_7be8b2(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_7be8b2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_7be8b2(); +} diff --git a/test/tint/builtins/gen/var/transpose/844869.wgsl b/test/tint/builtins/gen/var/transpose/844869.wgsl new file mode 100644 index 0000000000..920f4448fc --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/844869.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn transpose(mat<4, 4, f16>) -> mat<4, 4, f16> +fn transpose_844869() { + var arg_0 = mat4x4(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16()); + var res: mat4x4 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_844869(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_844869(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_844869(); +} diff --git a/test/tint/builtins/gen/var/transpose/844869.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/transpose/844869.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..17bcee893a --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/844869.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void transpose_844869() { + matrix arg_0 = matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); + matrix res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_844869(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_844869(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_844869(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/844869.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/transpose/844869.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..62a940892d --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/844869.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void transpose_844869() { + matrix arg_0 = matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); + matrix res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_844869(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_844869(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_844869(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001A73CD16C90(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001A73CD16C90(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/transpose/844869.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/844869.wgsl.expected.glsl new file mode 100644 index 0000000000..97269852bd --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/844869.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_844869() { + f16mat4 arg_0 = f16mat4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf)); + f16mat4 res = transpose(arg_0); +} + +vec4 vertex_main() { + transpose_844869(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void transpose_844869() { + f16mat4 arg_0 = f16mat4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf)); + f16mat4 res = transpose(arg_0); +} + +void fragment_main() { + transpose_844869(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_844869() { + f16mat4 arg_0 = f16mat4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf)); + f16mat4 res = transpose(arg_0); +} + +void compute_main() { + transpose_844869(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/844869.wgsl.expected.msl b/test/tint/builtins/gen/var/transpose/844869.wgsl.expected.msl new file mode 100644 index 0000000000..564ba7de7e --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/844869.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void transpose_844869() { + half4x4 arg_0 = half4x4(half4(0.0h), half4(0.0h), half4(0.0h), half4(0.0h)); + half4x4 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_844869(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_844869(); + return; +} + +kernel void compute_main() { + transpose_844869(); + return; +} + diff --git a/test/tint/builtins/gen/var/transpose/844869.wgsl.expected.spvasm b/test/tint/builtins/gen/var/transpose/844869.wgsl.expected.spvasm new file mode 100644 index 0000000000..204bd6cab5 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/844869.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_844869 "transpose_844869" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat4v4half = OpTypeMatrix %v4half 4 + %16 = OpConstantNull %mat4v4half +%_ptr_Function_mat4v4half = OpTypePointer Function %mat4v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%transpose_844869 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat4v4half Function %16 + %res = OpVariable %_ptr_Function_mat4v4half Function %16 + OpStore %arg_0 %16 + %20 = OpLoad %mat4v4half %arg_0 + %19 = OpTranspose %mat4v4half %20 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %transpose_844869 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %transpose_844869 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %transpose_844869 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/transpose/844869.wgsl.expected.wgsl b/test/tint/builtins/gen/var/transpose/844869.wgsl.expected.wgsl new file mode 100644 index 0000000000..a96ffd3034 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/844869.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn transpose_844869() { + var arg_0 = mat4x4(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16()); + var res : mat4x4 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_844869(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_844869(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_844869(); +} diff --git a/test/tint/builtins/gen/var/transpose/8c06ce.wgsl b/test/tint/builtins/gen/var/transpose/8c06ce.wgsl new file mode 100644 index 0000000000..591691377f --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/8c06ce.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn transpose(mat<3, 4, f16>) -> mat<4, 3, f16> +fn transpose_8c06ce() { + var arg_0 = mat3x4(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16()); + var res: mat4x3 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_8c06ce(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_8c06ce(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_8c06ce(); +} diff --git a/test/tint/builtins/gen/var/transpose/8c06ce.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/transpose/8c06ce.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8af9aa19df --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/8c06ce.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void transpose_8c06ce() { + matrix arg_0 = matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); + matrix res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_8c06ce(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_8c06ce(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_8c06ce(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/8c06ce.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/transpose/8c06ce.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..478d92f635 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/8c06ce.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void transpose_8c06ce() { + matrix arg_0 = matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); + matrix res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_8c06ce(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_8c06ce(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_8c06ce(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018FE8A7D600(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018FE8A7D600(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/transpose/8c06ce.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/8c06ce.wgsl.expected.glsl new file mode 100644 index 0000000000..eb6e17c2fd --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/8c06ce.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_8c06ce() { + f16mat3x4 arg_0 = f16mat3x4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf)); + f16mat4x3 res = transpose(arg_0); +} + +vec4 vertex_main() { + transpose_8c06ce(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void transpose_8c06ce() { + f16mat3x4 arg_0 = f16mat3x4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf)); + f16mat4x3 res = transpose(arg_0); +} + +void fragment_main() { + transpose_8c06ce(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_8c06ce() { + f16mat3x4 arg_0 = f16mat3x4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf)); + f16mat4x3 res = transpose(arg_0); +} + +void compute_main() { + transpose_8c06ce(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/8c06ce.wgsl.expected.msl b/test/tint/builtins/gen/var/transpose/8c06ce.wgsl.expected.msl new file mode 100644 index 0000000000..ae175b0d33 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/8c06ce.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void transpose_8c06ce() { + half3x4 arg_0 = half3x4(half4(0.0h), half4(0.0h), half4(0.0h)); + half4x3 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_8c06ce(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_8c06ce(); + return; +} + +kernel void compute_main() { + transpose_8c06ce(); + return; +} + diff --git a/test/tint/builtins/gen/var/transpose/8c06ce.wgsl.expected.spvasm b/test/tint/builtins/gen/var/transpose/8c06ce.wgsl.expected.spvasm new file mode 100644 index 0000000000..c01b8c6b5f --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/8c06ce.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_8c06ce "transpose_8c06ce" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat3v4half = OpTypeMatrix %v4half 3 + %16 = OpConstantNull %mat3v4half +%_ptr_Function_mat3v4half = OpTypePointer Function %mat3v4half + %v3half = OpTypeVector %half 3 + %mat4v3half = OpTypeMatrix %v3half 4 +%_ptr_Function_mat4v3half = OpTypePointer Function %mat4v3half + %25 = OpConstantNull %mat4v3half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%transpose_8c06ce = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat3v4half Function %16 + %res = OpVariable %_ptr_Function_mat4v3half Function %25 + OpStore %arg_0 %16 + %22 = OpLoad %mat3v4half %arg_0 + %19 = OpTranspose %mat4v3half %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %transpose_8c06ce + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %transpose_8c06ce + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %transpose_8c06ce + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/transpose/8c06ce.wgsl.expected.wgsl b/test/tint/builtins/gen/var/transpose/8c06ce.wgsl.expected.wgsl new file mode 100644 index 0000000000..ee401e76ed --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/8c06ce.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn transpose_8c06ce() { + var arg_0 = mat3x4(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16()); + var res : mat4x3 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_8c06ce(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_8c06ce(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_8c06ce(); +} diff --git a/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl b/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl new file mode 100644 index 0000000000..fd8dc13bd2 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn transpose(mat<3, 2, f16>) -> mat<2, 3, f16> +fn transpose_b9ad1f() { + var arg_0 = mat3x2(f16(), f16(), f16(), f16(), f16(), f16()); + var res: mat2x3 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_b9ad1f(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_b9ad1f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_b9ad1f(); +} diff --git a/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..dae12f3130 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void transpose_b9ad1f() { + matrix arg_0 = matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx); + matrix res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_b9ad1f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_b9ad1f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_b9ad1f(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ba9abbe274 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void transpose_b9ad1f() { + matrix arg_0 = matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx); + matrix res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_b9ad1f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_b9ad1f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_b9ad1f(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001BE022AEC60(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001BE022AEC60(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl.expected.glsl new file mode 100644 index 0000000000..fbe4830053 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_b9ad1f() { + f16mat3x2 arg_0 = f16mat3x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf)); + f16mat2x3 res = transpose(arg_0); +} + +vec4 vertex_main() { + transpose_b9ad1f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void transpose_b9ad1f() { + f16mat3x2 arg_0 = f16mat3x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf)); + f16mat2x3 res = transpose(arg_0); +} + +void fragment_main() { + transpose_b9ad1f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_b9ad1f() { + f16mat3x2 arg_0 = f16mat3x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf)); + f16mat2x3 res = transpose(arg_0); +} + +void compute_main() { + transpose_b9ad1f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl.expected.msl b/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl.expected.msl new file mode 100644 index 0000000000..df905fe9d5 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void transpose_b9ad1f() { + half3x2 arg_0 = half3x2(half2(0.0h), half2(0.0h), half2(0.0h)); + half2x3 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_b9ad1f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_b9ad1f(); + return; +} + +kernel void compute_main() { + transpose_b9ad1f(); + return; +} + diff --git a/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl.expected.spvasm new file mode 100644 index 0000000000..0aefff3660 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_b9ad1f "transpose_b9ad1f" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat3v2half = OpTypeMatrix %v2half 3 + %16 = OpConstantNull %mat3v2half +%_ptr_Function_mat3v2half = OpTypePointer Function %mat3v2half + %v3half = OpTypeVector %half 3 + %mat2v3half = OpTypeMatrix %v3half 2 +%_ptr_Function_mat2v3half = OpTypePointer Function %mat2v3half + %25 = OpConstantNull %mat2v3half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%transpose_b9ad1f = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat3v2half Function %16 + %res = OpVariable %_ptr_Function_mat2v3half Function %25 + OpStore %arg_0 %16 + %22 = OpLoad %mat3v2half %arg_0 + %19 = OpTranspose %mat2v3half %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %transpose_b9ad1f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %transpose_b9ad1f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %transpose_b9ad1f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl.expected.wgsl new file mode 100644 index 0000000000..c96a7dc0b5 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn transpose_b9ad1f() { + var arg_0 = mat3x2(f16(), f16(), f16(), f16(), f16(), f16()); + var res : mat2x3 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_b9ad1f(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_b9ad1f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_b9ad1f(); +} diff --git a/test/tint/builtins/gen/var/transpose/d6faec.wgsl b/test/tint/builtins/gen/var/transpose/d6faec.wgsl new file mode 100644 index 0000000000..d5b7ec3e39 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/d6faec.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn transpose(mat<2, 3, f16>) -> mat<3, 2, f16> +fn transpose_d6faec() { + var arg_0 = mat2x3(f16(), f16(), f16(), f16(), f16(), f16()); + var res: mat3x2 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_d6faec(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_d6faec(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_d6faec(); +} diff --git a/test/tint/builtins/gen/var/transpose/d6faec.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/transpose/d6faec.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5f07e18872 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/d6faec.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void transpose_d6faec() { + matrix arg_0 = matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); + matrix res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_d6faec(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_d6faec(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_d6faec(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/d6faec.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/transpose/d6faec.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cab57863c4 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/d6faec.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void transpose_d6faec() { + matrix arg_0 = matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); + matrix res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_d6faec(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_d6faec(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_d6faec(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022366B94660(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022366B94660(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/transpose/d6faec.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/d6faec.wgsl.expected.glsl new file mode 100644 index 0000000000..b4d1afed88 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/d6faec.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_d6faec() { + f16mat2x3 arg_0 = f16mat2x3(f16vec3(0.0hf), f16vec3(0.0hf)); + f16mat3x2 res = transpose(arg_0); +} + +vec4 vertex_main() { + transpose_d6faec(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void transpose_d6faec() { + f16mat2x3 arg_0 = f16mat2x3(f16vec3(0.0hf), f16vec3(0.0hf)); + f16mat3x2 res = transpose(arg_0); +} + +void fragment_main() { + transpose_d6faec(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_d6faec() { + f16mat2x3 arg_0 = f16mat2x3(f16vec3(0.0hf), f16vec3(0.0hf)); + f16mat3x2 res = transpose(arg_0); +} + +void compute_main() { + transpose_d6faec(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/d6faec.wgsl.expected.msl b/test/tint/builtins/gen/var/transpose/d6faec.wgsl.expected.msl new file mode 100644 index 0000000000..1f7eac07e3 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/d6faec.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void transpose_d6faec() { + half2x3 arg_0 = half2x3(half3(0.0h), half3(0.0h)); + half3x2 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_d6faec(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_d6faec(); + return; +} + +kernel void compute_main() { + transpose_d6faec(); + return; +} + diff --git a/test/tint/builtins/gen/var/transpose/d6faec.wgsl.expected.spvasm b/test/tint/builtins/gen/var/transpose/d6faec.wgsl.expected.spvasm new file mode 100644 index 0000000000..513643d34f --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/d6faec.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_d6faec "transpose_d6faec" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat2v3half = OpTypeMatrix %v3half 2 + %16 = OpConstantNull %mat2v3half +%_ptr_Function_mat2v3half = OpTypePointer Function %mat2v3half + %v2half = OpTypeVector %half 2 + %mat3v2half = OpTypeMatrix %v2half 3 +%_ptr_Function_mat3v2half = OpTypePointer Function %mat3v2half + %25 = OpConstantNull %mat3v2half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%transpose_d6faec = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat2v3half Function %16 + %res = OpVariable %_ptr_Function_mat3v2half Function %25 + OpStore %arg_0 %16 + %22 = OpLoad %mat2v3half %arg_0 + %19 = OpTranspose %mat3v2half %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %transpose_d6faec + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %transpose_d6faec + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %transpose_d6faec + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/transpose/d6faec.wgsl.expected.wgsl b/test/tint/builtins/gen/var/transpose/d6faec.wgsl.expected.wgsl new file mode 100644 index 0000000000..472aade960 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/d6faec.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn transpose_d6faec() { + var arg_0 = mat2x3(f16(), f16(), f16(), f16(), f16(), f16()); + var res : mat3x2 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_d6faec(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_d6faec(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_d6faec(); +} diff --git a/test/tint/builtins/gen/var/transpose/faeb05.wgsl b/test/tint/builtins/gen/var/transpose/faeb05.wgsl new file mode 100644 index 0000000000..0e2feed300 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/faeb05.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn transpose(mat<2, 4, f16>) -> mat<4, 2, f16> +fn transpose_faeb05() { + var arg_0 = mat2x4(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16()); + var res: mat4x2 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_faeb05(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_faeb05(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_faeb05(); +} diff --git a/test/tint/builtins/gen/var/transpose/faeb05.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/transpose/faeb05.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e318602606 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/faeb05.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void transpose_faeb05() { + matrix arg_0 = matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); + matrix res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_faeb05(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_faeb05(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_faeb05(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/faeb05.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/transpose/faeb05.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d4414a3503 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/faeb05.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void transpose_faeb05() { + matrix arg_0 = matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); + matrix res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_faeb05(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_faeb05(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_faeb05(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018F09DB3BF0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018F09DB3BF0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/transpose/faeb05.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/faeb05.wgsl.expected.glsl new file mode 100644 index 0000000000..3080917650 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/faeb05.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_faeb05() { + f16mat2x4 arg_0 = f16mat2x4(f16vec4(0.0hf), f16vec4(0.0hf)); + f16mat4x2 res = transpose(arg_0); +} + +vec4 vertex_main() { + transpose_faeb05(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void transpose_faeb05() { + f16mat2x4 arg_0 = f16mat2x4(f16vec4(0.0hf), f16vec4(0.0hf)); + f16mat4x2 res = transpose(arg_0); +} + +void fragment_main() { + transpose_faeb05(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_faeb05() { + f16mat2x4 arg_0 = f16mat2x4(f16vec4(0.0hf), f16vec4(0.0hf)); + f16mat4x2 res = transpose(arg_0); +} + +void compute_main() { + transpose_faeb05(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/faeb05.wgsl.expected.msl b/test/tint/builtins/gen/var/transpose/faeb05.wgsl.expected.msl new file mode 100644 index 0000000000..f941a64552 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/faeb05.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void transpose_faeb05() { + half2x4 arg_0 = half2x4(half4(0.0h), half4(0.0h)); + half4x2 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_faeb05(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_faeb05(); + return; +} + +kernel void compute_main() { + transpose_faeb05(); + return; +} + diff --git a/test/tint/builtins/gen/var/transpose/faeb05.wgsl.expected.spvasm b/test/tint/builtins/gen/var/transpose/faeb05.wgsl.expected.spvasm new file mode 100644 index 0000000000..f7a4c55661 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/faeb05.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_faeb05 "transpose_faeb05" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat2v4half = OpTypeMatrix %v4half 2 + %16 = OpConstantNull %mat2v4half +%_ptr_Function_mat2v4half = OpTypePointer Function %mat2v4half + %v2half = OpTypeVector %half 2 + %mat4v2half = OpTypeMatrix %v2half 4 +%_ptr_Function_mat4v2half = OpTypePointer Function %mat4v2half + %25 = OpConstantNull %mat4v2half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%transpose_faeb05 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat2v4half Function %16 + %res = OpVariable %_ptr_Function_mat4v2half Function %25 + OpStore %arg_0 %16 + %22 = OpLoad %mat2v4half %arg_0 + %19 = OpTranspose %mat4v2half %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %transpose_faeb05 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %transpose_faeb05 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %transpose_faeb05 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/transpose/faeb05.wgsl.expected.wgsl b/test/tint/builtins/gen/var/transpose/faeb05.wgsl.expected.wgsl new file mode 100644 index 0000000000..a6de2cbd2c --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/faeb05.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn transpose_faeb05() { + var arg_0 = mat2x4(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16()); + var res : mat4x2 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_faeb05(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_faeb05(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_faeb05(); +} diff --git a/test/tint/builtins/gen/var/trunc/103ab8.wgsl b/test/tint/builtins/gen/var/trunc/103ab8.wgsl new file mode 100644 index 0000000000..144541ae66 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/103ab8.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn trunc(vec<3, f16>) -> vec<3, f16> +fn trunc_103ab8() { + var arg_0 = vec3(f16()); + var res: vec3 = trunc(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_103ab8(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_103ab8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_103ab8(); +} diff --git a/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6adf48c5c4 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void trunc_103ab8() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = trunc(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_103ab8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_103ab8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_103ab8(); + return; +} diff --git a/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b061405db5 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void trunc_103ab8() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = trunc(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_103ab8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_103ab8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_103ab8(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020DD35586D0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020DD35586D0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.glsl b/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.glsl new file mode 100644 index 0000000000..cd4f15d4f1 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void trunc_103ab8() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = trunc(arg_0); +} + +vec4 vertex_main() { + trunc_103ab8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void trunc_103ab8() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = trunc(arg_0); +} + +void fragment_main() { + trunc_103ab8(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void trunc_103ab8() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = trunc(arg_0); +} + +void compute_main() { + trunc_103ab8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.msl b/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.msl new file mode 100644 index 0000000000..3bd56b9c27 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void trunc_103ab8() { + half3 arg_0 = half3(0.0h); + half3 res = trunc(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + trunc_103ab8(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + trunc_103ab8(); + return; +} + +kernel void compute_main() { + trunc_103ab8(); + return; +} + diff --git a/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.spvasm new file mode 100644 index 0000000000..7080335868 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %trunc_103ab8 "trunc_103ab8" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%trunc_103ab8 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Trunc %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %trunc_103ab8 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %trunc_103ab8 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %trunc_103ab8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.wgsl new file mode 100644 index 0000000000..a4cd5c830b --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn trunc_103ab8() { + var arg_0 = vec3(f16()); + var res : vec3 = trunc(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_103ab8(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_103ab8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_103ab8(); +} diff --git a/test/tint/builtins/gen/var/trunc/a56109.wgsl b/test/tint/builtins/gen/var/trunc/a56109.wgsl new file mode 100644 index 0000000000..f7ece8d716 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/a56109.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn trunc(vec<2, f16>) -> vec<2, f16> +fn trunc_a56109() { + var arg_0 = vec2(f16()); + var res: vec2 = trunc(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_a56109(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_a56109(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_a56109(); +} diff --git a/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..39ea25561b --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void trunc_a56109() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = trunc(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_a56109(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_a56109(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_a56109(); + return; +} diff --git a/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..36a52b19da --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void trunc_a56109() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = trunc(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_a56109(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_a56109(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_a56109(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001DD3B6C86D0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001DD3B6C86D0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.glsl b/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.glsl new file mode 100644 index 0000000000..754116e0ec --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void trunc_a56109() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = trunc(arg_0); +} + +vec4 vertex_main() { + trunc_a56109(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void trunc_a56109() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = trunc(arg_0); +} + +void fragment_main() { + trunc_a56109(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void trunc_a56109() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = trunc(arg_0); +} + +void compute_main() { + trunc_a56109(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.msl b/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.msl new file mode 100644 index 0000000000..395166bc39 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void trunc_a56109() { + half2 arg_0 = half2(0.0h); + half2 res = trunc(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + trunc_a56109(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + trunc_a56109(); + return; +} + +kernel void compute_main() { + trunc_a56109(); + return; +} + diff --git a/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.spvasm b/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.spvasm new file mode 100644 index 0000000000..fa693e8dd3 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %trunc_a56109 "trunc_a56109" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%trunc_a56109 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Trunc %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %trunc_a56109 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %trunc_a56109 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %trunc_a56109 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.wgsl b/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.wgsl new file mode 100644 index 0000000000..be9c55da32 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn trunc_a56109() { + var arg_0 = vec2(f16()); + var res : vec2 = trunc(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_a56109(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_a56109(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_a56109(); +} diff --git a/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl b/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl new file mode 100644 index 0000000000..3aad0e3d85 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn trunc(f16) -> f16 +fn trunc_cc2b0d() { + var arg_0 = f16(); + var res: f16 = trunc(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_cc2b0d(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_cc2b0d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_cc2b0d(); +} diff --git a/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e998713fb2 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void trunc_cc2b0d() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = trunc(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_cc2b0d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_cc2b0d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_cc2b0d(); + return; +} diff --git a/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2c934e2bef --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void trunc_cc2b0d() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = trunc(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_cc2b0d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_cc2b0d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_cc2b0d(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000023FD3F982D0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000023FD3F982D0(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.glsl b/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.glsl new file mode 100644 index 0000000000..73a3d1e537 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void trunc_cc2b0d() { + float16_t arg_0 = 0.0hf; + float16_t res = trunc(arg_0); +} + +vec4 vertex_main() { + trunc_cc2b0d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void trunc_cc2b0d() { + float16_t arg_0 = 0.0hf; + float16_t res = trunc(arg_0); +} + +void fragment_main() { + trunc_cc2b0d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void trunc_cc2b0d() { + float16_t arg_0 = 0.0hf; + float16_t res = trunc(arg_0); +} + +void compute_main() { + trunc_cc2b0d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.msl b/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.msl new file mode 100644 index 0000000000..3b88cd73ed --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void trunc_cc2b0d() { + half arg_0 = 0.0h; + half res = trunc(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + trunc_cc2b0d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + trunc_cc2b0d(); + return; +} + +kernel void compute_main() { + trunc_cc2b0d(); + return; +} + diff --git a/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.spvasm new file mode 100644 index 0000000000..a227bbaf5b --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %trunc_cc2b0d "trunc_cc2b0d" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%trunc_cc2b0d = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Trunc %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %trunc_cc2b0d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %trunc_cc2b0d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %trunc_cc2b0d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.wgsl new file mode 100644 index 0000000000..5530fe352e --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn trunc_cc2b0d() { + var arg_0 = f16(); + var res : f16 = trunc(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_cc2b0d(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_cc2b0d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_cc2b0d(); +} diff --git a/test/tint/builtins/gen/var/trunc/ce7c17.wgsl b/test/tint/builtins/gen/var/trunc/ce7c17.wgsl new file mode 100644 index 0000000000..a90b8321b1 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/ce7c17.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 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/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn trunc(vec<4, f16>) -> vec<4, f16> +fn trunc_ce7c17() { + var arg_0 = vec4(f16()); + var res: vec4 = trunc(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_ce7c17(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_ce7c17(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_ce7c17(); +} diff --git a/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b3fc9a34d3 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void trunc_ce7c17() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = trunc(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_ce7c17(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_ce7c17(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_ce7c17(); + return; +} diff --git a/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..58aab6d079 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void trunc_ce7c17() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = trunc(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_ce7c17(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_ce7c17(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_ce7c17(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001469F0570D0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001469F0570D0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.glsl b/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.glsl new file mode 100644 index 0000000000..53c46bdd96 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void trunc_ce7c17() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = trunc(arg_0); +} + +vec4 vertex_main() { + trunc_ce7c17(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void trunc_ce7c17() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = trunc(arg_0); +} + +void fragment_main() { + trunc_ce7c17(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void trunc_ce7c17() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = trunc(arg_0); +} + +void compute_main() { + trunc_ce7c17(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.msl b/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.msl new file mode 100644 index 0000000000..183371de7f --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void trunc_ce7c17() { + half4 arg_0 = half4(0.0h); + half4 res = trunc(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + trunc_ce7c17(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + trunc_ce7c17(); + return; +} + +kernel void compute_main() { + trunc_ce7c17(); + return; +} + diff --git a/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.spvasm b/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.spvasm new file mode 100644 index 0000000000..9341301ab6 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %trunc_ce7c17 "trunc_ce7c17" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_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 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%trunc_ce7c17 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Trunc %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %trunc_ce7c17 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %trunc_ce7c17 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %trunc_ce7c17 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.wgsl b/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.wgsl new file mode 100644 index 0000000000..bc7e46a46f --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn trunc_ce7c17() { + var arg_0 = vec4(f16()); + var res : vec4 = trunc(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_ce7c17(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_ce7c17(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_ce7c17(); +} diff --git a/tools/src/tint/intrinsic/gen/gen.go b/tools/src/tint/intrinsic/gen/gen.go index a426a46725..7672019331 100644 --- a/tools/src/tint/intrinsic/gen/gen.go +++ b/tools/src/tint/intrinsic/gen/gen.go @@ -495,7 +495,7 @@ func IsDeclarable(fqn sem.FullyQualifiedName) bool { } // OverloadUsesF16 returns true if the overload uses the f16 type anywhere in the signature. -func OverloadUsesF16(overload *sem.Overload) bool { +func OverloadUsesF16(overload sem.Overload) bool { for _, param := range overload.Parameters { if DeepestElementType(param.Type).Target.GetName() == "f16" { return true