Add const-eval for `trunc`

This CL adds const-eval for `trunc`.

Bug: tint:1581
Change-Id: If58f79ea70fe490746e30ed118d847c61edd8023
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110173
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
dan sinclair 2022-11-16 20:07:31 +00:00 committed by Dawn LUCI CQ
parent 130b8b3941
commit 92af2b5693
165 changed files with 2489 additions and 302 deletions

View File

@ -547,8 +547,8 @@ fn sqrt<N: num, T: f32_f16>(vec<N, T>) -> vec<N, T>
@const fn tanh<T: fa_f32_f16>(T) -> T
@const fn tanh<N: num, T: fa_f32_f16>(vec<N, T>) -> vec<N, T>
fn transpose<M: num, N: num, T: f32_f16>(mat<M, N, T>) -> mat<N, M, T>
fn trunc<T: f32_f16>(T) -> T
fn trunc<N: num, T: f32_f16>(vec<N, T>) -> vec<N, T>
@const fn trunc<T: fa_f32_f16>(@test_value(1.5) T) -> T
@const fn trunc<N: num, T: fa_f32_f16>(@test_value(1.5) vec<N, T>) -> vec<N, T>
@const fn unpack2x16float(u32) -> vec2<f32>
@const fn unpack2x16snorm(u32) -> vec2<f32>
@const fn unpack2x16unorm(u32) -> vec2<f32>

View File

@ -2401,6 +2401,18 @@ ConstEval::Result ConstEval::tanh(const sem::Type* ty,
return TransformElements(builder, ty, transform, args[0]);
}
ConstEval::Result ConstEval::trunc(const sem::Type* ty,
utils::VectorRef<const sem::Constant*> args,
const Source&) {
auto transform = [&](const sem::Constant* c0) {
auto create = [&](auto i) {
return CreateElement(builder, c0->Type(), decltype(i)(std::trunc(i.value)));
};
return Dispatch_fa_f32_f16(create, c0);
};
return TransformElements(builder, ty, transform, args[0]);
}
ConstEval::Result ConstEval::unpack2x16float(const sem::Type* ty,
utils::VectorRef<const sem::Constant*> args,
const Source& source) {

View File

@ -737,6 +737,15 @@ class ConstEval {
utils::VectorRef<const sem::Constant*> args,
const Source& source);
/// trunc builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location of the conversion
/// @return the result value, or null if the value cannot be calculated
Result trunc(const sem::Type* ty,
utils::VectorRef<const sem::Constant*> args,
const Source& source);
/// unpack2x16float builtin
/// @param ty the expression type
/// @param args the input arguments

View File

@ -1693,6 +1693,26 @@ INSTANTIATE_TEST_SUITE_P( //
TanhCases<f32>(),
TanhCases<f16>()))));
template <typename T>
std::vector<Case> TruncCases() {
std::vector<Case> cases = {C({T(0)}, T(0)), //
C({-T(0)}, -T(0)), //
C({T(1.5)}, T(1)), //
C({-T(1.5)}, -T(1)),
// Vector tests
C({Vec(T(0.0), T(1.5), -T(2.2))}, Vec(T(0), T(1), -T(2)))};
return cases;
}
INSTANTIATE_TEST_SUITE_P( //
Trunc,
ResolverConstEvalBuiltinTest,
testing::Combine(testing::Values(sem::BuiltinType::kTrunc),
testing::ValuesIn(Concat(TruncCases<AFloat>(), //
TruncCases<f32>(),
TruncCases<f16>()))));
std::vector<Case> Unpack4x8snormCases() {
return {
C({Val(u32(0x0000'0000))}, Vec(f32(0), f32(0), f32(0), f32(0))),

View File

@ -12729,24 +12729,24 @@ constexpr OverloadInfo kOverloads[] = {
/* num parameters */ 1,
/* num template types */ 1,
/* num template numbers */ 0,
/* template types */ &kTemplateTypes[25],
/* template types */ &kTemplateTypes[24],
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[977],
/* return matcher indices */ &kMatcherIndices[1],
/* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
/* const eval */ nullptr,
/* const eval */ &ConstEval::trunc,
},
{
/* [367] */
/* num parameters */ 1,
/* num template types */ 1,
/* num template numbers */ 1,
/* template types */ &kTemplateTypes[25],
/* template types */ &kTemplateTypes[24],
/* template numbers */ &kTemplateNumbers[5],
/* parameters */ &kParameters[976],
/* return matcher indices */ &kMatcherIndices[30],
/* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
/* const eval */ nullptr,
/* const eval */ &ConstEval::trunc,
},
{
/* [368] */
@ -14551,8 +14551,8 @@ constexpr IntrinsicInfo kBuiltins[] = {
},
{
/* [79] */
/* fn trunc<T : f32_f16>(T) -> T */
/* fn trunc<N : num, T : f32_f16>(vec<N, T>) -> vec<N, T> */
/* fn trunc<T : fa_f32_f16>(@test_value(1.5) T) -> T */
/* fn trunc<N : num, T : fa_f32_f16>(@test_value(1.5) vec<N, T>) -> vec<N, T> */
/* num overloads */ 2,
/* overloads */ &kOverloads[366],
},

View File

@ -25,7 +25,7 @@ enable f16;
// fn trunc(vec<3, f16>) -> vec<3, f16>
fn trunc_103ab8() {
var res: vec3<f16> = trunc(vec3<f16>(1.h));
var res: vec3<f16> = trunc(vec3<f16>(1.5h));
}
@vertex

View File

@ -1,5 +1,5 @@
void trunc_103ab8() {
vector<float16_t, 3> res = trunc((float16_t(1.0h)).xxx);
vector<float16_t, 3> res = (float16_t(1.0h)).xxx;
}
struct tint_symbol {

View File

@ -2,7 +2,7 @@
#extension GL_AMD_gpu_shader_half_float : require
void trunc_103ab8() {
f16vec3 res = trunc(f16vec3(1.0hf));
f16vec3 res = f16vec3(1.0hf);
}
vec4 vertex_main() {
@ -23,7 +23,7 @@ void main() {
precision mediump float;
void trunc_103ab8() {
f16vec3 res = trunc(f16vec3(1.0hf));
f16vec3 res = f16vec3(1.0hf);
}
void fragment_main() {
@ -38,7 +38,7 @@ void main() {
#extension GL_AMD_gpu_shader_half_float : require
void trunc_103ab8() {
f16vec3 res = trunc(f16vec3(1.0hf));
f16vec3 res = f16vec3(1.0hf);
}
void compute_main() {

View File

@ -2,7 +2,7 @@
using namespace metal;
void trunc_103ab8() {
half3 res = trunc(half3(1.0h));
half3 res = half3(1.0h);
}
struct tint_symbol {

View File

@ -1,14 +1,13 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 36
; 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"
@ -38,37 +37,36 @@
%half = OpTypeFloat 16
%v3half = OpTypeVector %half 3
%half_0x1p_0 = OpConstant %half 0x1p+0
%18 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0
%16 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0
%_ptr_Function_v3half = OpTypePointer Function %v3half
%21 = OpConstantNull %v3half
%22 = OpTypeFunction %v4float
%19 = OpConstantNull %v3half
%20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%trunc_103ab8 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v3half Function %21
%13 = OpExtInst %v3half %16 Trunc %18
OpStore %res %13
%res = OpVariable %_ptr_Function_v3half Function %19
OpStore %res %16
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %22
%24 = OpLabel
%25 = OpFunctionCall %void %trunc_103ab8
%vertex_main_inner = OpFunction %v4float None %20
%22 = OpLabel
%23 = OpFunctionCall %void %trunc_103ab8
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
%27 = OpLabel
%28 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %28
%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
%31 = OpLabel
%32 = OpFunctionCall %void %trunc_103ab8
%29 = OpLabel
%30 = OpFunctionCall %void %trunc_103ab8
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%34 = OpLabel
%35 = OpFunctionCall %void %trunc_103ab8
%32 = OpLabel
%33 = OpFunctionCall %void %trunc_103ab8
OpReturn
OpFunctionEnd

View File

@ -1,7 +1,7 @@
enable f16;
fn trunc_103ab8() {
var res : vec3<f16> = trunc(vec3<f16>(1.0h));
var res : vec3<f16> = trunc(vec3<f16>(1.5h));
}
@vertex

View File

@ -0,0 +1,43 @@
// Copyright 2022 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
////////////////////////////////////////////////////////////////////////////////
// File generated by tools/src/cmd/gen
// using the template:
// test/tint/builtins/gen/gen.wgsl.tmpl
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
// fn trunc(vec<3, fa>) -> vec<3, fa>
fn trunc_117396() {
var res = trunc(vec3(1.5));
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
trunc_117396();
return vec4<f32>();
}
@fragment
fn fragment_main() {
trunc_117396();
}
@compute @workgroup_size(1)
fn compute_main() {
trunc_117396();
}

View File

@ -0,0 +1,30 @@
void trunc_117396() {
float3 res = (1.0f).xxx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
trunc_117396();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const 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_117396();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
trunc_117396();
return;
}

View File

@ -0,0 +1,30 @@
void trunc_117396() {
float3 res = (1.0f).xxx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
trunc_117396();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const 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_117396();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
trunc_117396();
return;
}

View File

@ -0,0 +1,49 @@
#version 310 es
void trunc_117396() {
vec3 res = vec3(1.0f);
}
vec4 vertex_main() {
trunc_117396();
return vec4(0.0f);
}
void main() {
gl_PointSize = 1.0;
vec4 inner_result = vertex_main();
gl_Position = inner_result;
gl_Position.y = -(gl_Position.y);
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}
#version 310 es
precision mediump float;
void trunc_117396() {
vec3 res = vec3(1.0f);
}
void fragment_main() {
trunc_117396();
}
void main() {
fragment_main();
return;
}
#version 310 es
void trunc_117396() {
vec3 res = vec3(1.0f);
}
void compute_main() {
trunc_117396();
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
compute_main();
return;
}

View File

@ -0,0 +1,33 @@
#include <metal_stdlib>
using namespace metal;
void trunc_117396() {
float3 res = float3(1.0f);
}
struct tint_symbol {
float4 value [[position]];
};
float4 vertex_main_inner() {
trunc_117396();
return float4(0.0f);
}
vertex tint_symbol vertex_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_117396();
return;
}
kernel void compute_main() {
trunc_117396();
return;
}

View File

@ -0,0 +1,66 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 32
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "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_117396 "trunc_117396"
OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %value BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%value = OpVariable %_ptr_Output_v4float Output %5
%_ptr_Output_float = OpTypePointer Output %float
%8 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
%void = OpTypeVoid
%9 = OpTypeFunction %void
%v3float = OpTypeVector %float 3
%float_1 = OpConstant %float 1
%15 = OpConstantComposite %v3float %float_1 %float_1 %float_1
%_ptr_Function_v3float = OpTypePointer Function %v3float
%18 = OpConstantNull %v3float
%19 = OpTypeFunction %v4float
%trunc_117396 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v3float Function %18
OpStore %res %15
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %19
%21 = OpLabel
%22 = OpFunctionCall %void %trunc_117396
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
%27 = OpLabel
%28 = OpFunctionCall %void %trunc_117396
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%30 = OpLabel
%31 = OpFunctionCall %void %trunc_117396
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,19 @@
fn trunc_117396() {
var res = trunc(vec3(1.5));
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
trunc_117396();
return vec4<f32>();
}
@fragment
fn fragment_main() {
trunc_117396();
}
@compute @workgroup_size(1)
fn compute_main() {
trunc_117396();
}

View File

@ -23,7 +23,7 @@
// fn trunc(vec<3, f32>) -> vec<3, f32>
fn trunc_562d05() {
var res: vec3<f32> = trunc(vec3<f32>(1.f));
var res: vec3<f32> = trunc(vec3<f32>(1.5f));
}
@vertex

View File

@ -1,5 +1,5 @@
void trunc_562d05() {
float3 res = trunc((1.0f).xxx);
float3 res = (1.0f).xxx;
}
struct tint_symbol {

View File

@ -1,5 +1,5 @@
void trunc_562d05() {
float3 res = trunc((1.0f).xxx);
float3 res = (1.0f).xxx;
}
struct tint_symbol {

View File

@ -1,7 +1,7 @@
#version 310 es
void trunc_562d05() {
vec3 res = trunc(vec3(1.0f));
vec3 res = vec3(1.0f);
}
vec4 vertex_main() {
@ -21,7 +21,7 @@ void main() {
precision mediump float;
void trunc_562d05() {
vec3 res = trunc(vec3(1.0f));
vec3 res = vec3(1.0f);
}
void fragment_main() {
@ -35,7 +35,7 @@ void main() {
#version 310 es
void trunc_562d05() {
vec3 res = trunc(vec3(1.0f));
vec3 res = vec3(1.0f);
}
void compute_main() {

View File

@ -2,7 +2,7 @@
using namespace metal;
void trunc_562d05() {
float3 res = trunc(float3(1.0f));
float3 res = float3(1.0f);
}
struct tint_symbol {

View File

@ -1,10 +1,9 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 34
; Bound: 32
; Schema: 0
OpCapability Shader
%15 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@ -33,36 +32,35 @@
%9 = OpTypeFunction %void
%v3float = OpTypeVector %float 3
%float_1 = OpConstant %float 1
%17 = OpConstantComposite %v3float %float_1 %float_1 %float_1
%15 = OpConstantComposite %v3float %float_1 %float_1 %float_1
%_ptr_Function_v3float = OpTypePointer Function %v3float
%20 = OpConstantNull %v3float
%21 = OpTypeFunction %v4float
%18 = OpConstantNull %v3float
%19 = OpTypeFunction %v4float
%trunc_562d05 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v3float Function %20
%13 = OpExtInst %v3float %15 Trunc %17
OpStore %res %13
%res = OpVariable %_ptr_Function_v3float Function %18
OpStore %res %15
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %21
%23 = OpLabel
%24 = OpFunctionCall %void %trunc_562d05
%vertex_main_inner = OpFunction %v4float None %19
%21 = OpLabel
%22 = OpFunctionCall %void %trunc_562d05
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
%26 = OpLabel
%27 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %27
%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
%29 = OpLabel
%30 = OpFunctionCall %void %trunc_562d05
%27 = OpLabel
%28 = OpFunctionCall %void %trunc_562d05
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%32 = OpLabel
%33 = OpFunctionCall %void %trunc_562d05
%30 = OpLabel
%31 = OpFunctionCall %void %trunc_562d05
OpReturn
OpFunctionEnd

View File

@ -1,5 +1,5 @@
fn trunc_562d05() {
var res : vec3<f32> = trunc(vec3<f32>(1.0f));
var res : vec3<f32> = trunc(vec3<f32>(1.5f));
}
@vertex

View File

@ -0,0 +1,43 @@
// Copyright 2022 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
////////////////////////////////////////////////////////////////////////////////
// File generated by tools/src/cmd/gen
// using the template:
// test/tint/builtins/gen/gen.wgsl.tmpl
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
// fn trunc(fa) -> fa
fn trunc_7d6ded() {
var res = trunc(1.5);
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
trunc_7d6ded();
return vec4<f32>();
}
@fragment
fn fragment_main() {
trunc_7d6ded();
}
@compute @workgroup_size(1)
fn compute_main() {
trunc_7d6ded();
}

View File

@ -0,0 +1,30 @@
void trunc_7d6ded() {
float res = 1.0f;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
trunc_7d6ded();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const 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_7d6ded();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
trunc_7d6ded();
return;
}

View File

@ -0,0 +1,30 @@
void trunc_7d6ded() {
float res = 1.0f;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
trunc_7d6ded();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const 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_7d6ded();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
trunc_7d6ded();
return;
}

View File

@ -0,0 +1,49 @@
#version 310 es
void trunc_7d6ded() {
float res = 1.0f;
}
vec4 vertex_main() {
trunc_7d6ded();
return vec4(0.0f);
}
void main() {
gl_PointSize = 1.0;
vec4 inner_result = vertex_main();
gl_Position = inner_result;
gl_Position.y = -(gl_Position.y);
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}
#version 310 es
precision mediump float;
void trunc_7d6ded() {
float res = 1.0f;
}
void fragment_main() {
trunc_7d6ded();
}
void main() {
fragment_main();
return;
}
#version 310 es
void trunc_7d6ded() {
float res = 1.0f;
}
void compute_main() {
trunc_7d6ded();
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
compute_main();
return;
}

View File

@ -0,0 +1,33 @@
#include <metal_stdlib>
using namespace metal;
void trunc_7d6ded() {
float res = 1.0f;
}
struct tint_symbol {
float4 value [[position]];
};
float4 vertex_main_inner() {
trunc_7d6ded();
return float4(0.0f);
}
vertex tint_symbol vertex_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_7d6ded();
return;
}
kernel void compute_main() {
trunc_7d6ded();
return;
}

View File

@ -0,0 +1,63 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 29
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "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_7d6ded "trunc_7d6ded"
OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %value BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%value = OpVariable %_ptr_Output_v4float Output %5
%_ptr_Output_float = OpTypePointer Output %float
%8 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
%void = OpTypeVoid
%9 = OpTypeFunction %void
%float_1 = OpConstant %float 1
%_ptr_Function_float = OpTypePointer Function %float
%16 = OpTypeFunction %v4float
%trunc_7d6ded = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_float Function %8
OpStore %res %float_1
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %16
%18 = OpLabel
%19 = OpFunctionCall %void %trunc_7d6ded
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
%21 = OpLabel
%22 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %22
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
%24 = OpLabel
%25 = OpFunctionCall %void %trunc_7d6ded
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%27 = OpLabel
%28 = OpFunctionCall %void %trunc_7d6ded
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,19 @@
fn trunc_7d6ded() {
var res = trunc(1.5);
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
trunc_7d6ded();
return vec4<f32>();
}
@fragment
fn fragment_main() {
trunc_7d6ded();
}
@compute @workgroup_size(1)
fn compute_main() {
trunc_7d6ded();
}

View File

@ -25,7 +25,7 @@ enable f16;
// fn trunc(vec<2, f16>) -> vec<2, f16>
fn trunc_a56109() {
var res: vec2<f16> = trunc(vec2<f16>(1.h));
var res: vec2<f16> = trunc(vec2<f16>(1.5h));
}
@vertex

View File

@ -1,5 +1,5 @@
void trunc_a56109() {
vector<float16_t, 2> res = trunc((float16_t(1.0h)).xx);
vector<float16_t, 2> res = (float16_t(1.0h)).xx;
}
struct tint_symbol {

View File

@ -2,7 +2,7 @@
#extension GL_AMD_gpu_shader_half_float : require
void trunc_a56109() {
f16vec2 res = trunc(f16vec2(1.0hf));
f16vec2 res = f16vec2(1.0hf);
}
vec4 vertex_main() {
@ -23,7 +23,7 @@ void main() {
precision mediump float;
void trunc_a56109() {
f16vec2 res = trunc(f16vec2(1.0hf));
f16vec2 res = f16vec2(1.0hf);
}
void fragment_main() {
@ -38,7 +38,7 @@ void main() {
#extension GL_AMD_gpu_shader_half_float : require
void trunc_a56109() {
f16vec2 res = trunc(f16vec2(1.0hf));
f16vec2 res = f16vec2(1.0hf);
}
void compute_main() {

View File

@ -2,7 +2,7 @@
using namespace metal;
void trunc_a56109() {
half2 res = trunc(half2(1.0h));
half2 res = half2(1.0h);
}
struct tint_symbol {

View File

@ -1,14 +1,13 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 36
; 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"
@ -38,37 +37,36 @@
%half = OpTypeFloat 16
%v2half = OpTypeVector %half 2
%half_0x1p_0 = OpConstant %half 0x1p+0
%18 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_0
%16 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_0
%_ptr_Function_v2half = OpTypePointer Function %v2half
%21 = OpConstantNull %v2half
%22 = OpTypeFunction %v4float
%19 = OpConstantNull %v2half
%20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%trunc_a56109 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v2half Function %21
%13 = OpExtInst %v2half %16 Trunc %18
OpStore %res %13
%res = OpVariable %_ptr_Function_v2half Function %19
OpStore %res %16
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %22
%24 = OpLabel
%25 = OpFunctionCall %void %trunc_a56109
%vertex_main_inner = OpFunction %v4float None %20
%22 = OpLabel
%23 = OpFunctionCall %void %trunc_a56109
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
%27 = OpLabel
%28 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %28
%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
%31 = OpLabel
%32 = OpFunctionCall %void %trunc_a56109
%29 = OpLabel
%30 = OpFunctionCall %void %trunc_a56109
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%34 = OpLabel
%35 = OpFunctionCall %void %trunc_a56109
%32 = OpLabel
%33 = OpFunctionCall %void %trunc_a56109
OpReturn
OpFunctionEnd

View File

@ -1,7 +1,7 @@
enable f16;
fn trunc_a56109() {
var res : vec2<f16> = trunc(vec2<f16>(1.0h));
var res : vec2<f16> = trunc(vec2<f16>(1.5h));
}
@vertex

View File

@ -0,0 +1,43 @@
// Copyright 2022 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
////////////////////////////////////////////////////////////////////////////////
// File generated by tools/src/cmd/gen
// using the template:
// test/tint/builtins/gen/gen.wgsl.tmpl
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
// fn trunc(vec<2, fa>) -> vec<2, fa>
fn trunc_c12555() {
var res = trunc(vec2(1.5));
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
trunc_c12555();
return vec4<f32>();
}
@fragment
fn fragment_main() {
trunc_c12555();
}
@compute @workgroup_size(1)
fn compute_main() {
trunc_c12555();
}

View File

@ -0,0 +1,30 @@
void trunc_c12555() {
float2 res = (1.0f).xx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
trunc_c12555();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const 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_c12555();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
trunc_c12555();
return;
}

View File

@ -0,0 +1,30 @@
void trunc_c12555() {
float2 res = (1.0f).xx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
trunc_c12555();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const 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_c12555();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
trunc_c12555();
return;
}

View File

@ -0,0 +1,49 @@
#version 310 es
void trunc_c12555() {
vec2 res = vec2(1.0f);
}
vec4 vertex_main() {
trunc_c12555();
return vec4(0.0f);
}
void main() {
gl_PointSize = 1.0;
vec4 inner_result = vertex_main();
gl_Position = inner_result;
gl_Position.y = -(gl_Position.y);
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}
#version 310 es
precision mediump float;
void trunc_c12555() {
vec2 res = vec2(1.0f);
}
void fragment_main() {
trunc_c12555();
}
void main() {
fragment_main();
return;
}
#version 310 es
void trunc_c12555() {
vec2 res = vec2(1.0f);
}
void compute_main() {
trunc_c12555();
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
compute_main();
return;
}

View File

@ -0,0 +1,33 @@
#include <metal_stdlib>
using namespace metal;
void trunc_c12555() {
float2 res = float2(1.0f);
}
struct tint_symbol {
float4 value [[position]];
};
float4 vertex_main_inner() {
trunc_c12555();
return float4(0.0f);
}
vertex tint_symbol vertex_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_c12555();
return;
}
kernel void compute_main() {
trunc_c12555();
return;
}

View File

@ -0,0 +1,66 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 32
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "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_c12555 "trunc_c12555"
OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %value BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%value = OpVariable %_ptr_Output_v4float Output %5
%_ptr_Output_float = OpTypePointer Output %float
%8 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
%void = OpTypeVoid
%9 = OpTypeFunction %void
%v2float = OpTypeVector %float 2
%float_1 = OpConstant %float 1
%15 = OpConstantComposite %v2float %float_1 %float_1
%_ptr_Function_v2float = OpTypePointer Function %v2float
%18 = OpConstantNull %v2float
%19 = OpTypeFunction %v4float
%trunc_c12555 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v2float Function %18
OpStore %res %15
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %19
%21 = OpLabel
%22 = OpFunctionCall %void %trunc_c12555
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
%27 = OpLabel
%28 = OpFunctionCall %void %trunc_c12555
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%30 = OpLabel
%31 = OpFunctionCall %void %trunc_c12555
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,19 @@
fn trunc_c12555() {
var res = trunc(vec2(1.5));
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
trunc_c12555();
return vec4<f32>();
}
@fragment
fn fragment_main() {
trunc_c12555();
}
@compute @workgroup_size(1)
fn compute_main() {
trunc_c12555();
}

View File

@ -25,7 +25,7 @@ enable f16;
// fn trunc(f16) -> f16
fn trunc_cc2b0d() {
var res: f16 = trunc(1.h);
var res: f16 = trunc(1.5h);
}
@vertex

View File

@ -1,5 +1,5 @@
void trunc_cc2b0d() {
float16_t res = trunc(float16_t(1.0h));
float16_t res = float16_t(1.0h);
}
struct tint_symbol {

View File

@ -2,7 +2,7 @@
#extension GL_AMD_gpu_shader_half_float : require
void trunc_cc2b0d() {
float16_t res = trunc(1.0hf);
float16_t res = 1.0hf;
}
vec4 vertex_main() {
@ -23,7 +23,7 @@ void main() {
precision mediump float;
void trunc_cc2b0d() {
float16_t res = trunc(1.0hf);
float16_t res = 1.0hf;
}
void fragment_main() {
@ -38,7 +38,7 @@ void main() {
#extension GL_AMD_gpu_shader_half_float : require
void trunc_cc2b0d() {
float16_t res = trunc(1.0hf);
float16_t res = 1.0hf;
}
void compute_main() {

View File

@ -2,7 +2,7 @@
using namespace metal;
void trunc_cc2b0d() {
half res = trunc(1.0h);
half res = 1.0h;
}
struct tint_symbol {

View File

@ -1,14 +1,13 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 34
; Bound: 32
; 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"
@ -38,35 +37,34 @@
%half = OpTypeFloat 16
%half_0x1p_0 = OpConstant %half 0x1p+0
%_ptr_Function_half = OpTypePointer Function %half
%19 = OpConstantNull %half
%20 = OpTypeFunction %v4float
%17 = OpConstantNull %half
%18 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%trunc_cc2b0d = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_half Function %19
%13 = OpExtInst %half %15 Trunc %half_0x1p_0
OpStore %res %13
%res = OpVariable %_ptr_Function_half Function %17
OpStore %res %half_0x1p_0
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %20
%22 = OpLabel
%23 = OpFunctionCall %void %trunc_cc2b0d
%vertex_main_inner = OpFunction %v4float None %18
%20 = OpLabel
%21 = OpFunctionCall %void %trunc_cc2b0d
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
%25 = OpLabel
%26 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %26
%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
%29 = OpLabel
%30 = OpFunctionCall %void %trunc_cc2b0d
%27 = OpLabel
%28 = OpFunctionCall %void %trunc_cc2b0d
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%32 = OpLabel
%33 = OpFunctionCall %void %trunc_cc2b0d
%30 = OpLabel
%31 = OpFunctionCall %void %trunc_cc2b0d
OpReturn
OpFunctionEnd

View File

@ -1,7 +1,7 @@
enable f16;
fn trunc_cc2b0d() {
var res : f16 = trunc(1.0h);
var res : f16 = trunc(1.5h);
}
@vertex

View File

@ -25,7 +25,7 @@ enable f16;
// fn trunc(vec<4, f16>) -> vec<4, f16>
fn trunc_ce7c17() {
var res: vec4<f16> = trunc(vec4<f16>(1.h));
var res: vec4<f16> = trunc(vec4<f16>(1.5h));
}
@vertex

View File

@ -1,5 +1,5 @@
void trunc_ce7c17() {
vector<float16_t, 4> res = trunc((float16_t(1.0h)).xxxx);
vector<float16_t, 4> res = (float16_t(1.0h)).xxxx;
}
struct tint_symbol {

View File

@ -2,7 +2,7 @@
#extension GL_AMD_gpu_shader_half_float : require
void trunc_ce7c17() {
f16vec4 res = trunc(f16vec4(1.0hf));
f16vec4 res = f16vec4(1.0hf);
}
vec4 vertex_main() {
@ -23,7 +23,7 @@ void main() {
precision mediump float;
void trunc_ce7c17() {
f16vec4 res = trunc(f16vec4(1.0hf));
f16vec4 res = f16vec4(1.0hf);
}
void fragment_main() {
@ -38,7 +38,7 @@ void main() {
#extension GL_AMD_gpu_shader_half_float : require
void trunc_ce7c17() {
f16vec4 res = trunc(f16vec4(1.0hf));
f16vec4 res = f16vec4(1.0hf);
}
void compute_main() {

View File

@ -2,7 +2,7 @@
using namespace metal;
void trunc_ce7c17() {
half4 res = trunc(half4(1.0h));
half4 res = half4(1.0h);
}
struct tint_symbol {

View File

@ -1,14 +1,13 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 36
; 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"
@ -38,37 +37,36 @@
%half = OpTypeFloat 16
%v4half = OpTypeVector %half 4
%half_0x1p_0 = OpConstant %half 0x1p+0
%18 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 %half_0x1p_0
%16 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 %half_0x1p_0
%_ptr_Function_v4half = OpTypePointer Function %v4half
%21 = OpConstantNull %v4half
%22 = OpTypeFunction %v4float
%19 = OpConstantNull %v4half
%20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%trunc_ce7c17 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v4half Function %21
%13 = OpExtInst %v4half %16 Trunc %18
OpStore %res %13
%res = OpVariable %_ptr_Function_v4half Function %19
OpStore %res %16
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %22
%24 = OpLabel
%25 = OpFunctionCall %void %trunc_ce7c17
%vertex_main_inner = OpFunction %v4float None %20
%22 = OpLabel
%23 = OpFunctionCall %void %trunc_ce7c17
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
%27 = OpLabel
%28 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %28
%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
%31 = OpLabel
%32 = OpFunctionCall %void %trunc_ce7c17
%29 = OpLabel
%30 = OpFunctionCall %void %trunc_ce7c17
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%34 = OpLabel
%35 = OpFunctionCall %void %trunc_ce7c17
%32 = OpLabel
%33 = OpFunctionCall %void %trunc_ce7c17
OpReturn
OpFunctionEnd

View File

@ -1,7 +1,7 @@
enable f16;
fn trunc_ce7c17() {
var res : vec4<f16> = trunc(vec4<f16>(1.0h));
var res : vec4<f16> = trunc(vec4<f16>(1.5h));
}
@vertex

View File

@ -23,7 +23,7 @@
// fn trunc(vec<4, f32>) -> vec<4, f32>
fn trunc_e183aa() {
var res: vec4<f32> = trunc(vec4<f32>(1.f));
var res: vec4<f32> = trunc(vec4<f32>(1.5f));
}
@vertex

View File

@ -1,5 +1,5 @@
void trunc_e183aa() {
float4 res = trunc((1.0f).xxxx);
float4 res = (1.0f).xxxx;
}
struct tint_symbol {

View File

@ -1,5 +1,5 @@
void trunc_e183aa() {
float4 res = trunc((1.0f).xxxx);
float4 res = (1.0f).xxxx;
}
struct tint_symbol {

View File

@ -1,7 +1,7 @@
#version 310 es
void trunc_e183aa() {
vec4 res = trunc(vec4(1.0f));
vec4 res = vec4(1.0f);
}
vec4 vertex_main() {
@ -21,7 +21,7 @@ void main() {
precision mediump float;
void trunc_e183aa() {
vec4 res = trunc(vec4(1.0f));
vec4 res = vec4(1.0f);
}
void fragment_main() {
@ -35,7 +35,7 @@ void main() {
#version 310 es
void trunc_e183aa() {
vec4 res = trunc(vec4(1.0f));
vec4 res = vec4(1.0f);
}
void compute_main() {

View File

@ -2,7 +2,7 @@
using namespace metal;
void trunc_e183aa() {
float4 res = trunc(float4(1.0f));
float4 res = float4(1.0f);
}
struct tint_symbol {

View File

@ -1,10 +1,9 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 32
; Bound: 30
; Schema: 0
OpCapability Shader
%14 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@ -32,35 +31,34 @@
%void = OpTypeVoid
%9 = OpTypeFunction %void
%float_1 = OpConstant %float 1
%16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%_ptr_Function_v4float = OpTypePointer Function %v4float
%19 = OpTypeFunction %v4float
%17 = OpTypeFunction %v4float
%trunc_e183aa = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v4float Function %5
%13 = OpExtInst %v4float %14 Trunc %16
OpStore %res %13
OpStore %res %14
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %19
%21 = OpLabel
%22 = OpFunctionCall %void %trunc_e183aa
%vertex_main_inner = OpFunction %v4float None %17
%19 = OpLabel
%20 = OpFunctionCall %void %trunc_e183aa
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
%24 = OpLabel
%25 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %25
%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
%27 = OpLabel
%28 = OpFunctionCall %void %trunc_e183aa
%25 = OpLabel
%26 = OpFunctionCall %void %trunc_e183aa
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%30 = OpLabel
%31 = OpFunctionCall %void %trunc_e183aa
%28 = OpLabel
%29 = OpFunctionCall %void %trunc_e183aa
OpReturn
OpFunctionEnd

View File

@ -1,5 +1,5 @@
fn trunc_e183aa() {
var res : vec4<f32> = trunc(vec4<f32>(1.0f));
var res : vec4<f32> = trunc(vec4<f32>(1.5f));
}
@vertex

View File

@ -23,7 +23,7 @@
// fn trunc(f32) -> f32
fn trunc_eb83df() {
var res: f32 = trunc(1.f);
var res: f32 = trunc(1.5f);
}
@vertex

View File

@ -1,5 +1,5 @@
void trunc_eb83df() {
float res = trunc(1.0f);
float res = 1.0f;
}
struct tint_symbol {

View File

@ -1,5 +1,5 @@
void trunc_eb83df() {
float res = trunc(1.0f);
float res = 1.0f;
}
struct tint_symbol {

View File

@ -1,7 +1,7 @@
#version 310 es
void trunc_eb83df() {
float res = trunc(1.0f);
float res = 1.0f;
}
vec4 vertex_main() {
@ -21,7 +21,7 @@ void main() {
precision mediump float;
void trunc_eb83df() {
float res = trunc(1.0f);
float res = 1.0f;
}
void fragment_main() {
@ -35,7 +35,7 @@ void main() {
#version 310 es
void trunc_eb83df() {
float res = trunc(1.0f);
float res = 1.0f;
}
void compute_main() {

View File

@ -2,7 +2,7 @@
using namespace metal;
void trunc_eb83df() {
float res = trunc(1.0f);
float res = 1.0f;
}
struct tint_symbol {

View File

@ -1,10 +1,9 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 31
; Bound: 29
; Schema: 0
OpCapability Shader
%14 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@ -33,33 +32,32 @@
%9 = OpTypeFunction %void
%float_1 = OpConstant %float 1
%_ptr_Function_float = OpTypePointer Function %float
%18 = OpTypeFunction %v4float
%16 = OpTypeFunction %v4float
%trunc_eb83df = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_float Function %8
%13 = OpExtInst %float %14 Trunc %float_1
OpStore %res %13
OpStore %res %float_1
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %18
%20 = OpLabel
%21 = OpFunctionCall %void %trunc_eb83df
%vertex_main_inner = OpFunction %v4float None %16
%18 = OpLabel
%19 = OpFunctionCall %void %trunc_eb83df
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
%23 = OpLabel
%24 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %24
%21 = OpLabel
%22 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %22
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
%26 = OpLabel
%27 = OpFunctionCall %void %trunc_eb83df
%24 = OpLabel
%25 = OpFunctionCall %void %trunc_eb83df
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%29 = OpLabel
%30 = OpFunctionCall %void %trunc_eb83df
%27 = OpLabel
%28 = OpFunctionCall %void %trunc_eb83df
OpReturn
OpFunctionEnd

View File

@ -1,5 +1,5 @@
fn trunc_eb83df() {
var res : f32 = trunc(1.0f);
var res : f32 = trunc(1.5f);
}
@vertex

View File

@ -0,0 +1,43 @@
// Copyright 2022 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
////////////////////////////////////////////////////////////////////////////////
// File generated by tools/src/cmd/gen
// using the template:
// test/tint/builtins/gen/gen.wgsl.tmpl
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
// fn trunc(vec<4, fa>) -> vec<4, fa>
fn trunc_f0f1a1() {
var res = trunc(vec4(1.5));
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
trunc_f0f1a1();
return vec4<f32>();
}
@fragment
fn fragment_main() {
trunc_f0f1a1();
}
@compute @workgroup_size(1)
fn compute_main() {
trunc_f0f1a1();
}

View File

@ -0,0 +1,30 @@
void trunc_f0f1a1() {
float4 res = (1.0f).xxxx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
trunc_f0f1a1();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const 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_f0f1a1();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
trunc_f0f1a1();
return;
}

View File

@ -0,0 +1,30 @@
void trunc_f0f1a1() {
float4 res = (1.0f).xxxx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
trunc_f0f1a1();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const 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_f0f1a1();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
trunc_f0f1a1();
return;
}

View File

@ -0,0 +1,49 @@
#version 310 es
void trunc_f0f1a1() {
vec4 res = vec4(1.0f);
}
vec4 vertex_main() {
trunc_f0f1a1();
return vec4(0.0f);
}
void main() {
gl_PointSize = 1.0;
vec4 inner_result = vertex_main();
gl_Position = inner_result;
gl_Position.y = -(gl_Position.y);
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}
#version 310 es
precision mediump float;
void trunc_f0f1a1() {
vec4 res = vec4(1.0f);
}
void fragment_main() {
trunc_f0f1a1();
}
void main() {
fragment_main();
return;
}
#version 310 es
void trunc_f0f1a1() {
vec4 res = vec4(1.0f);
}
void compute_main() {
trunc_f0f1a1();
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
compute_main();
return;
}

View File

@ -0,0 +1,33 @@
#include <metal_stdlib>
using namespace metal;
void trunc_f0f1a1() {
float4 res = float4(1.0f);
}
struct tint_symbol {
float4 value [[position]];
};
float4 vertex_main_inner() {
trunc_f0f1a1();
return float4(0.0f);
}
vertex tint_symbol vertex_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_f0f1a1();
return;
}
kernel void compute_main() {
trunc_f0f1a1();
return;
}

View File

@ -0,0 +1,64 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 30
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "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_f0f1a1 "trunc_f0f1a1"
OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %value BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%value = OpVariable %_ptr_Output_v4float Output %5
%_ptr_Output_float = OpTypePointer Output %float
%8 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
%void = OpTypeVoid
%9 = OpTypeFunction %void
%float_1 = OpConstant %float 1
%14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%_ptr_Function_v4float = OpTypePointer Function %v4float
%17 = OpTypeFunction %v4float
%trunc_f0f1a1 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v4float Function %5
OpStore %res %14
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %17
%19 = OpLabel
%20 = OpFunctionCall %void %trunc_f0f1a1
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
%25 = OpLabel
%26 = OpFunctionCall %void %trunc_f0f1a1
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%28 = OpLabel
%29 = OpFunctionCall %void %trunc_f0f1a1
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,19 @@
fn trunc_f0f1a1() {
var res = trunc(vec4(1.5));
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
trunc_f0f1a1();
return vec4<f32>();
}
@fragment
fn fragment_main() {
trunc_f0f1a1();
}
@compute @workgroup_size(1)
fn compute_main() {
trunc_f0f1a1();
}

View File

@ -23,7 +23,7 @@
// fn trunc(vec<2, f32>) -> vec<2, f32>
fn trunc_f370d3() {
var res: vec2<f32> = trunc(vec2<f32>(1.f));
var res: vec2<f32> = trunc(vec2<f32>(1.5f));
}
@vertex

View File

@ -1,5 +1,5 @@
void trunc_f370d3() {
float2 res = trunc((1.0f).xx);
float2 res = (1.0f).xx;
}
struct tint_symbol {

View File

@ -1,5 +1,5 @@
void trunc_f370d3() {
float2 res = trunc((1.0f).xx);
float2 res = (1.0f).xx;
}
struct tint_symbol {

View File

@ -1,7 +1,7 @@
#version 310 es
void trunc_f370d3() {
vec2 res = trunc(vec2(1.0f));
vec2 res = vec2(1.0f);
}
vec4 vertex_main() {
@ -21,7 +21,7 @@ void main() {
precision mediump float;
void trunc_f370d3() {
vec2 res = trunc(vec2(1.0f));
vec2 res = vec2(1.0f);
}
void fragment_main() {
@ -35,7 +35,7 @@ void main() {
#version 310 es
void trunc_f370d3() {
vec2 res = trunc(vec2(1.0f));
vec2 res = vec2(1.0f);
}
void compute_main() {

View File

@ -2,7 +2,7 @@
using namespace metal;
void trunc_f370d3() {
float2 res = trunc(float2(1.0f));
float2 res = float2(1.0f);
}
struct tint_symbol {

View File

@ -1,10 +1,9 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 34
; Bound: 32
; Schema: 0
OpCapability Shader
%15 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@ -33,36 +32,35 @@
%9 = OpTypeFunction %void
%v2float = OpTypeVector %float 2
%float_1 = OpConstant %float 1
%17 = OpConstantComposite %v2float %float_1 %float_1
%15 = OpConstantComposite %v2float %float_1 %float_1
%_ptr_Function_v2float = OpTypePointer Function %v2float
%20 = OpConstantNull %v2float
%21 = OpTypeFunction %v4float
%18 = OpConstantNull %v2float
%19 = OpTypeFunction %v4float
%trunc_f370d3 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v2float Function %20
%13 = OpExtInst %v2float %15 Trunc %17
OpStore %res %13
%res = OpVariable %_ptr_Function_v2float Function %18
OpStore %res %15
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %21
%23 = OpLabel
%24 = OpFunctionCall %void %trunc_f370d3
%vertex_main_inner = OpFunction %v4float None %19
%21 = OpLabel
%22 = OpFunctionCall %void %trunc_f370d3
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
%26 = OpLabel
%27 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %27
%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
%29 = OpLabel
%30 = OpFunctionCall %void %trunc_f370d3
%27 = OpLabel
%28 = OpFunctionCall %void %trunc_f370d3
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%32 = OpLabel
%33 = OpFunctionCall %void %trunc_f370d3
%30 = OpLabel
%31 = OpFunctionCall %void %trunc_f370d3
OpReturn
OpFunctionEnd

View File

@ -1,5 +1,5 @@
fn trunc_f370d3() {
var res : vec2<f32> = trunc(vec2<f32>(1.0f));
var res : vec2<f32> = trunc(vec2<f32>(1.5f));
}
@vertex

View File

@ -25,7 +25,7 @@ enable f16;
// fn trunc(vec<3, f16>) -> vec<3, f16>
fn trunc_103ab8() {
var arg_0 = vec3<f16>(1.h);
var arg_0 = vec3<f16>(1.5h);
var res: vec3<f16> = trunc(arg_0);
}

View File

@ -1,5 +1,5 @@
void trunc_103ab8() {
vector<float16_t, 3> arg_0 = (float16_t(1.0h)).xxx;
vector<float16_t, 3> arg_0 = (float16_t(1.5h)).xxx;
vector<float16_t, 3> res = trunc(arg_0);
}

View File

@ -2,7 +2,7 @@
#extension GL_AMD_gpu_shader_half_float : require
void trunc_103ab8() {
f16vec3 arg_0 = f16vec3(1.0hf);
f16vec3 arg_0 = f16vec3(1.5hf);
f16vec3 res = trunc(arg_0);
}
@ -24,7 +24,7 @@ void main() {
precision mediump float;
void trunc_103ab8() {
f16vec3 arg_0 = f16vec3(1.0hf);
f16vec3 arg_0 = f16vec3(1.5hf);
f16vec3 res = trunc(arg_0);
}
@ -40,7 +40,7 @@ void main() {
#extension GL_AMD_gpu_shader_half_float : require
void trunc_103ab8() {
f16vec3 arg_0 = f16vec3(1.0hf);
f16vec3 arg_0 = f16vec3(1.5hf);
f16vec3 res = trunc(arg_0);
}

View File

@ -2,7 +2,7 @@
using namespace metal;
void trunc_103ab8() {
half3 arg_0 = half3(1.0h);
half3 arg_0 = half3(1.5h);
half3 res = trunc(arg_0);
}

View File

@ -38,8 +38,8 @@
%9 = OpTypeFunction %void
%half = OpTypeFloat 16
%v3half = OpTypeVector %half 3
%half_0x1p_0 = OpConstant %half 0x1p+0
%16 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0
%half_0x1_8p_0 = OpConstant %half 0x1.8p+0
%16 = OpConstantComposite %v3half %half_0x1_8p_0 %half_0x1_8p_0 %half_0x1_8p_0
%_ptr_Function_v3half = OpTypePointer Function %v3half
%19 = OpConstantNull %v3half
%24 = OpTypeFunction %v4float

View File

@ -1,7 +1,7 @@
enable f16;
fn trunc_103ab8() {
var arg_0 = vec3<f16>(1.0h);
var arg_0 = vec3<f16>(1.5h);
var res : vec3<f16> = trunc(arg_0);
}

View File

@ -0,0 +1,44 @@
// Copyright 2022 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
////////////////////////////////////////////////////////////////////////////////
// File generated by tools/src/cmd/gen
// using the template:
// test/tint/builtins/gen/gen.wgsl.tmpl
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
// fn trunc(vec<3, fa>) -> vec<3, fa>
fn trunc_117396() {
const arg_0 = vec3(1.5);
var res = trunc(arg_0);
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
trunc_117396();
return vec4<f32>();
}
@fragment
fn fragment_main() {
trunc_117396();
}
@compute @workgroup_size(1)
fn compute_main() {
trunc_117396();
}

View File

@ -0,0 +1,30 @@
void trunc_117396() {
float3 res = (1.0f).xxx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
trunc_117396();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const 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_117396();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
trunc_117396();
return;
}

View File

@ -0,0 +1,30 @@
void trunc_117396() {
float3 res = (1.0f).xxx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
trunc_117396();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const 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_117396();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
trunc_117396();
return;
}

View File

@ -0,0 +1,49 @@
#version 310 es
void trunc_117396() {
vec3 res = vec3(1.0f);
}
vec4 vertex_main() {
trunc_117396();
return vec4(0.0f);
}
void main() {
gl_PointSize = 1.0;
vec4 inner_result = vertex_main();
gl_Position = inner_result;
gl_Position.y = -(gl_Position.y);
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}
#version 310 es
precision mediump float;
void trunc_117396() {
vec3 res = vec3(1.0f);
}
void fragment_main() {
trunc_117396();
}
void main() {
fragment_main();
return;
}
#version 310 es
void trunc_117396() {
vec3 res = vec3(1.0f);
}
void compute_main() {
trunc_117396();
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
compute_main();
return;
}

View File

@ -0,0 +1,33 @@
#include <metal_stdlib>
using namespace metal;
void trunc_117396() {
float3 res = float3(1.0f);
}
struct tint_symbol {
float4 value [[position]];
};
float4 vertex_main_inner() {
trunc_117396();
return float4(0.0f);
}
vertex tint_symbol vertex_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_117396();
return;
}
kernel void compute_main() {
trunc_117396();
return;
}

View File

@ -0,0 +1,66 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 32
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "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_117396 "trunc_117396"
OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %value BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%value = OpVariable %_ptr_Output_v4float Output %5
%_ptr_Output_float = OpTypePointer Output %float
%8 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
%void = OpTypeVoid
%9 = OpTypeFunction %void
%v3float = OpTypeVector %float 3
%float_1 = OpConstant %float 1
%15 = OpConstantComposite %v3float %float_1 %float_1 %float_1
%_ptr_Function_v3float = OpTypePointer Function %v3float
%18 = OpConstantNull %v3float
%19 = OpTypeFunction %v4float
%trunc_117396 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v3float Function %18
OpStore %res %15
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %19
%21 = OpLabel
%22 = OpFunctionCall %void %trunc_117396
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
%27 = OpLabel
%28 = OpFunctionCall %void %trunc_117396
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%30 = OpLabel
%31 = OpFunctionCall %void %trunc_117396
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,20 @@
fn trunc_117396() {
const arg_0 = vec3(1.5);
var res = trunc(arg_0);
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
trunc_117396();
return vec4<f32>();
}
@fragment
fn fragment_main() {
trunc_117396();
}
@compute @workgroup_size(1)
fn compute_main() {
trunc_117396();
}

View File

@ -23,7 +23,7 @@
// fn trunc(vec<3, f32>) -> vec<3, f32>
fn trunc_562d05() {
var arg_0 = vec3<f32>(1.f);
var arg_0 = vec3<f32>(1.5f);
var res: vec3<f32> = trunc(arg_0);
}

View File

@ -1,5 +1,5 @@
void trunc_562d05() {
float3 arg_0 = (1.0f).xxx;
float3 arg_0 = (1.5f).xxx;
float3 res = trunc(arg_0);
}

Some files were not shown because too many files have changed in this diff Show More