Add const-eval for `round`

This CL adds const-eval for `round`.

Bug: tint:1581
Change-Id: I16ebb2010969debb8de50479235d9d9f5433c0a1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110175
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
dan sinclair 2022-11-16 22:52:08 +00:00 committed by Dawn LUCI CQ
parent c214cbe98b
commit 19e5042ade
165 changed files with 2543 additions and 310 deletions

View File

@ -522,8 +522,8 @@ fn reflect<N: num, T: f32_f16>(vec<N, T>, vec<N, T>) -> vec<N, T>
fn refract<N: num, T: f32_f16>(vec<N, T>, vec<N, T>, T) -> vec<N, T>
@const fn reverseBits<T: iu32>(T) -> T
@const fn reverseBits<N: num, T: iu32>(vec<N, T>) -> vec<N, T>
fn round<T: f32_f16>(T) -> T
fn round<N: num, T: f32_f16>(vec<N, T>) -> vec<N, T>
@const fn round<T: fa_f32_f16>(@test_value(3.4) T) -> T
@const fn round<N: num, T: fa_f32_f16>(@test_value(3.4) vec<N, T>) -> vec<N, T>
@const fn saturate<T: fa_f32_f16>(@test_value(2) T) -> T
@const fn saturate<T: fa_f32_f16, N: num>(@test_value(2) vec<N, T>) -> vec<N, T>
@const("select_bool") fn select<T: scalar>(T, T, bool) -> T

View File

@ -2270,6 +2270,42 @@ ConstEval::Result ConstEval::reverseBits(const sem::Type* ty,
return TransformElements(builder, ty, transform, args[0]);
}
ConstEval::Result ConstEval::round(const sem::Type* ty,
utils::VectorRef<const sem::Constant*> args,
const Source&) {
auto transform = [&](const sem::Constant* c0) {
auto create = [&](auto e) {
using NumberT = decltype(e);
using T = UnwrapNumber<NumberT>;
auto integral = NumberT(0);
auto fract = std::abs(std::modf(e.value, &(integral.value)));
// When e lies halfway between integers k and k + 1, the result is k when k is even,
// and k + 1 when k is odd.
NumberT result = NumberT(0.0);
if (fract == NumberT(0.5)) {
// If the integral value is negative, then we need to subtract one in order to move
// to the correct `k`. The half way check is `k` and `k + 1` which in the positive
// case is `x` and `x + 1` but in the negative case is `x - 1` and `x`.
T integral_val = integral.value;
if (std::signbit(integral_val)) {
integral_val = std::abs(integral_val - 1);
}
if (uint64_t(integral_val) % 2 == 0) {
result = NumberT(std::floor(e.value));
} else {
result = NumberT(std::ceil(e.value));
}
} else {
result = NumberT(std::round(e.value));
}
return CreateElement(builder, c0->Type(), result);
};
return Dispatch_fa_f32_f16(create, c0);
};
return TransformElements(builder, ty, transform, args[0]);
}
ConstEval::Result ConstEval::saturate(const sem::Type* ty,
utils::VectorRef<const sem::Constant*> args,
const Source&) {

View File

@ -656,6 +656,15 @@ class ConstEval {
utils::VectorRef<const sem::Constant*> args,
const Source& source);
/// round 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 round(const sem::Type* ty,
utils::VectorRef<const sem::Constant*> args,
const Source& source);
/// saturate builtin
/// @param ty the expression type
/// @param args the input arguments

View File

@ -1477,6 +1477,36 @@ INSTANTIATE_TEST_SUITE_P( //
testing::ValuesIn(Concat(ReverseBitsCases<i32>(), //
ReverseBitsCases<u32>()))));
template <typename T>
std::vector<Case> RoundCases() {
std::vector<Case> cases = {
C({T(0.0)}, T(0.0)), //
C({-T(0.0)}, -T(0.0)), //
C({T(1.5)}, T(2.0)), //
C({T(2.5)}, T(2.0)), //
C({T(2.4)}, T(2.0)), //
C({T(2.6)}, T(3.0)), //
C({T(1.49999)}, T(1.0)), //
C({T(1.50001)}, T(2.0)), //
C({-T(1.5)}, -T(2.0)), //
C({-T(2.5)}, -T(2.0)), //
C({-T(2.6)}, -T(3.0)), //
C({-T(2.4)}, -T(2.0)), //
// Vector tests
C({Vec(T(0.0), T(1.5), T(2.5))}, Vec(T(0.0), T(2.0), T(2.0))),
};
return cases;
}
INSTANTIATE_TEST_SUITE_P( //
Round,
ResolverConstEvalBuiltinTest,
testing::Combine(testing::Values(sem::BuiltinType::kRound),
testing::ValuesIn(Concat(RoundCases<AFloat>(), //
RoundCases<f32>(),
RoundCases<f16>()))));
template <typename T>
std::vector<Case> SaturateCases() {
return {

View File

@ -12993,24 +12993,24 @@ constexpr OverloadInfo kOverloads[] = {
/* num parameters */ 1,
/* num template types */ 1,
/* num template numbers */ 0,
/* template types */ &kTemplateTypes[26],
/* template types */ &kTemplateTypes[23],
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[895],
/* return matcher indices */ &kMatcherIndices[3],
/* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
/* const eval */ nullptr,
/* const eval */ &ConstEval::round,
},
{
/* [389] */
/* num parameters */ 1,
/* num template types */ 1,
/* num template numbers */ 1,
/* template types */ &kTemplateTypes[26],
/* template types */ &kTemplateTypes[23],
/* template numbers */ &kTemplateNumbers[4],
/* parameters */ &kParameters[896],
/* return matcher indices */ &kMatcherIndices[30],
/* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
/* const eval */ nullptr,
/* const eval */ &ConstEval::round,
},
{
/* [390] */
@ -14461,8 +14461,8 @@ constexpr IntrinsicInfo kBuiltins[] = {
},
{
/* [66] */
/* fn round<T : f32_f16>(T) -> T */
/* fn round<N : num, T : f32_f16>(vec<N, T>) -> vec<N, T> */
/* fn round<T : fa_f32_f16>(@test_value(3.4) T) -> T */
/* fn round<N : num, T : fa_f32_f16>(@test_value(3.4) vec<N, T>) -> vec<N, T> */
/* num overloads */ 2,
/* overloads */ &kOverloads[388],
},

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,10 +1,9 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 32
; Bound: 31
; 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"
@ -31,36 +30,36 @@
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
%void = OpTypeVoid
%9 = OpTypeFunction %void
%float_1 = OpConstant %float 1
%16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%float_3 = OpConstant %float 3
%14 = OpConstantComposite %v4float %float_3 %float_3 %float_3 %float_3
%_ptr_Function_v4float = OpTypePointer Function %v4float
%19 = OpTypeFunction %v4float
%17 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%round_106c0b = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v4float Function %5
%13 = OpExtInst %v4float %14 RoundEven %16
OpStore %res %13
OpStore %res %14
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %19
%21 = OpLabel
%22 = OpFunctionCall %void %round_106c0b
%vertex_main_inner = OpFunction %v4float None %17
%19 = OpLabel
%20 = OpFunctionCall %void %round_106c0b
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 %round_106c0b
%26 = OpLabel
%27 = OpFunctionCall %void %round_106c0b
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%30 = OpLabel
%31 = OpFunctionCall %void %round_106c0b
%29 = OpLabel
%30 = OpFunctionCall %void %round_106c0b
OpReturn
OpFunctionEnd

View File

@ -1,5 +1,5 @@
fn round_106c0b() {
var res : vec4<f32> = round(vec4<f32>(1.0f));
var res : vec4<f32> = round(vec4<f32>(3.400000095f));
}
@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 round(vec<4, fa>) -> vec<4, fa>
fn round_184d5a() {
var res = round(vec4(3.4));
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
round_184d5a();
return vec4<f32>();
}
@fragment
fn fragment_main() {
round_184d5a();
}
@compute @workgroup_size(1)
fn compute_main() {
round_184d5a();
}

View File

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

View File

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

View File

@ -0,0 +1,49 @@
#version 310 es
void round_184d5a() {
vec4 res = vec4(3.0f);
}
vec4 vertex_main() {
round_184d5a();
return vec4(0.0f);
}
void main() {
gl_PointSize = 1.0;
vec4 inner_result = vertex_main();
gl_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 round_184d5a() {
vec4 res = vec4(3.0f);
}
void fragment_main() {
round_184d5a();
}
void main() {
fragment_main();
return;
}
#version 310 es
void round_184d5a() {
vec4 res = vec4(3.0f);
}
void compute_main() {
round_184d5a();
}
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 round_184d5a() {
float4 res = float4(3.0f);
}
struct tint_symbol {
float4 value [[position]];
};
float4 vertex_main_inner() {
round_184d5a();
return float4(0.0f);
}
vertex tint_symbol vertex_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_184d5a();
return;
}
kernel void compute_main() {
round_184d5a();
return;
}

View File

@ -0,0 +1,65 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 31
; 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 %round_184d5a "round_184d5a"
OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %value BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%value = OpVariable %_ptr_Output_v4float Output %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_3 = OpConstant %float 3
%14 = OpConstantComposite %v4float %float_3 %float_3 %float_3 %float_3
%_ptr_Function_v4float = OpTypePointer Function %v4float
%17 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%round_184d5a = 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 %round_184d5a
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 %round_184d5a
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%29 = OpLabel
%30 = OpFunctionCall %void %round_184d5a
OpReturn
OpFunctionEnd

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,10 +1,9 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 34
; Bound: 33
; 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"
@ -32,37 +31,37 @@
%void = OpTypeVoid
%9 = OpTypeFunction %void
%v3float = OpTypeVector %float 3
%float_1 = OpConstant %float 1
%17 = OpConstantComposite %v3float %float_1 %float_1 %float_1
%float_3 = OpConstant %float 3
%15 = OpConstantComposite %v3float %float_3 %float_3 %float_3
%_ptr_Function_v3float = OpTypePointer Function %v3float
%20 = OpConstantNull %v3float
%21 = OpTypeFunction %v4float
%18 = OpConstantNull %v3float
%19 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%round_1c7897 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v3float Function %20
%13 = OpExtInst %v3float %15 RoundEven %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 %round_1c7897
%vertex_main_inner = OpFunction %v4float None %19
%21 = OpLabel
%22 = OpFunctionCall %void %round_1c7897
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 %round_1c7897
%28 = OpLabel
%29 = OpFunctionCall %void %round_1c7897
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%32 = OpLabel
%33 = OpFunctionCall %void %round_1c7897
%31 = OpLabel
%32 = OpFunctionCall %void %round_1c7897
OpReturn
OpFunctionEnd

View File

@ -1,5 +1,5 @@
fn round_1c7897() {
var res : vec3<f32> = round(vec3<f32>(1.0f));
var res : vec3<f32> = round(vec3<f32>(3.400000095f));
}
@vertex

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,10 +1,9 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 34
; Bound: 33
; 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"
@ -32,37 +31,37 @@
%void = OpTypeVoid
%9 = OpTypeFunction %void
%v2float = OpTypeVector %float 2
%float_1 = OpConstant %float 1
%17 = OpConstantComposite %v2float %float_1 %float_1
%float_3 = OpConstant %float 3
%15 = OpConstantComposite %v2float %float_3 %float_3
%_ptr_Function_v2float = OpTypePointer Function %v2float
%20 = OpConstantNull %v2float
%21 = OpTypeFunction %v4float
%18 = OpConstantNull %v2float
%19 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%round_52c84d = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v2float Function %20
%13 = OpExtInst %v2float %15 RoundEven %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 %round_52c84d
%vertex_main_inner = OpFunction %v4float None %19
%21 = OpLabel
%22 = OpFunctionCall %void %round_52c84d
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 %round_52c84d
%28 = OpLabel
%29 = OpFunctionCall %void %round_52c84d
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%32 = OpLabel
%33 = OpFunctionCall %void %round_52c84d
%31 = OpLabel
%32 = OpFunctionCall %void %round_52c84d
OpReturn
OpFunctionEnd

View File

@ -1,5 +1,5 @@
fn round_52c84d() {
var res : vec2<f32> = round(vec2<f32>(1.0f));
var res : vec2<f32> = round(vec2<f32>(3.400000095f));
}
@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 round(fa) -> fa
fn round_773a8f() {
var res = round(3.4);
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
round_773a8f();
return vec4<f32>();
}
@fragment
fn fragment_main() {
round_773a8f();
}
@compute @workgroup_size(1)
fn compute_main() {
round_773a8f();
}

View File

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

View File

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

View File

@ -0,0 +1,49 @@
#version 310 es
void round_773a8f() {
float res = 3.0f;
}
vec4 vertex_main() {
round_773a8f();
return vec4(0.0f);
}
void main() {
gl_PointSize = 1.0;
vec4 inner_result = vertex_main();
gl_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 round_773a8f() {
float res = 3.0f;
}
void fragment_main() {
round_773a8f();
}
void main() {
fragment_main();
return;
}
#version 310 es
void round_773a8f() {
float res = 3.0f;
}
void compute_main() {
round_773a8f();
}
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 round_773a8f() {
float res = 3.0f;
}
struct tint_symbol {
float4 value [[position]];
};
float4 vertex_main_inner() {
round_773a8f();
return float4(0.0f);
}
vertex tint_symbol vertex_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_773a8f();
return;
}
kernel void compute_main() {
round_773a8f();
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 %round_773a8f "round_773a8f"
OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %value BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%value = OpVariable %_ptr_Output_v4float Output %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_3 = OpConstant %float 3
%_ptr_Function_float = OpTypePointer Function %float
%16 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%round_773a8f = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_float Function %8
OpStore %res %float_3
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %16
%18 = OpLabel
%19 = OpFunctionCall %void %round_773a8f
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
%25 = OpLabel
%26 = OpFunctionCall %void %round_773a8f
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%28 = OpLabel
%29 = OpFunctionCall %void %round_773a8f
OpReturn
OpFunctionEnd

View File

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

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 round(vec<2, fa>) -> vec<2, fa>
fn round_8fdca3() {
var res = round(vec2(3.4));
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
round_8fdca3();
return vec4<f32>();
}
@fragment
fn fragment_main() {
round_8fdca3();
}
@compute @workgroup_size(1)
fn compute_main() {
round_8fdca3();
}

View File

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

View File

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

View File

@ -0,0 +1,49 @@
#version 310 es
void round_8fdca3() {
vec2 res = vec2(3.0f);
}
vec4 vertex_main() {
round_8fdca3();
return vec4(0.0f);
}
void main() {
gl_PointSize = 1.0;
vec4 inner_result = vertex_main();
gl_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 round_8fdca3() {
vec2 res = vec2(3.0f);
}
void fragment_main() {
round_8fdca3();
}
void main() {
fragment_main();
return;
}
#version 310 es
void round_8fdca3() {
vec2 res = vec2(3.0f);
}
void compute_main() {
round_8fdca3();
}
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 round_8fdca3() {
float2 res = float2(3.0f);
}
struct tint_symbol {
float4 value [[position]];
};
float4 vertex_main_inner() {
round_8fdca3();
return float4(0.0f);
}
vertex tint_symbol vertex_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_8fdca3();
return;
}
kernel void compute_main() {
round_8fdca3();
return;
}

View File

@ -0,0 +1,67 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 33
; 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 %round_8fdca3 "round_8fdca3"
OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %value BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%value = OpVariable %_ptr_Output_v4float Output %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_3 = OpConstant %float 3
%15 = OpConstantComposite %v2float %float_3 %float_3
%_ptr_Function_v2float = OpTypePointer Function %v2float
%18 = OpConstantNull %v2float
%19 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%round_8fdca3 = 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 %round_8fdca3
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_8fdca3
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%31 = OpLabel
%32 = OpFunctionCall %void %round_8fdca3
OpReturn
OpFunctionEnd

View File

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

View File

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

View File

@ -1,5 +1,5 @@
void round_9078ef() {
float16_t res = round(float16_t(1.0h));
float16_t res = float16_t(3.0h);
}
struct tint_symbol {

View File

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

View File

@ -2,7 +2,7 @@
using namespace metal;
void round_9078ef() {
half res = rint(1.0h);
half res = 3.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"
@ -36,37 +35,36 @@
%void = OpTypeVoid
%9 = OpTypeFunction %void
%half = OpTypeFloat 16
%half_0x1p_0 = OpConstant %half 0x1p+0
%half_0x1_8p_1 = OpConstant %half 0x1.8p+1
%_ptr_Function_half = OpTypePointer Function %half
%19 = OpConstantNull %half
%20 = OpTypeFunction %v4float
%17 = OpConstantNull %half
%18 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%round_9078ef = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_half Function %19
%13 = OpExtInst %half %15 RoundEven %half_0x1p_0
OpStore %res %13
%res = OpVariable %_ptr_Function_half Function %17
OpStore %res %half_0x1_8p_1
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %20
%22 = OpLabel
%23 = OpFunctionCall %void %round_9078ef
%vertex_main_inner = OpFunction %v4float None %18
%20 = OpLabel
%21 = OpFunctionCall %void %round_9078ef
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 %round_9078ef
%27 = OpLabel
%28 = OpFunctionCall %void %round_9078ef
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%32 = OpLabel
%33 = OpFunctionCall %void %round_9078ef
%30 = OpLabel
%31 = OpFunctionCall %void %round_9078ef
OpReturn
OpFunctionEnd

View File

@ -1,7 +1,7 @@
enable f16;
fn round_9078ef() {
var res : f16 = round(1.0h);
var res : f16 = round(3.3984375h);
}
@vertex

View File

@ -23,7 +23,7 @@
// fn round(f32) -> f32
fn round_9edc38() {
var res: f32 = round(1.f);
var res: f32 = round(3.4f);
}
@vertex

View File

@ -1,5 +1,5 @@
void round_9edc38() {
float res = round(1.0f);
float res = 3.0f;
}
struct tint_symbol {

View File

@ -1,5 +1,5 @@
void round_9edc38() {
float res = round(1.0f);
float res = 3.0f;
}
struct tint_symbol {

View File

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

View File

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

View File

@ -1,10 +1,9 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 31
; 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"
@ -31,35 +30,35 @@
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
%void = OpTypeVoid
%9 = OpTypeFunction %void
%float_1 = OpConstant %float 1
%float_3 = OpConstant %float 3
%_ptr_Function_float = OpTypePointer Function %float
%18 = OpTypeFunction %v4float
%16 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%round_9edc38 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_float Function %8
%13 = OpExtInst %float %14 RoundEven %float_1
OpStore %res %13
OpStore %res %float_3
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %18
%20 = OpLabel
%21 = OpFunctionCall %void %round_9edc38
%vertex_main_inner = OpFunction %v4float None %16
%18 = OpLabel
%19 = OpFunctionCall %void %round_9edc38
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 %round_9edc38
%25 = OpLabel
%26 = OpFunctionCall %void %round_9edc38
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%29 = OpLabel
%30 = OpFunctionCall %void %round_9edc38
%28 = OpLabel
%29 = OpFunctionCall %void %round_9edc38
OpReturn
OpFunctionEnd

View File

@ -1,5 +1,5 @@
fn round_9edc38() {
var res : f32 = round(1.0f);
var res : f32 = round(3.400000095f);
}
@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 round(vec<3, fa>) -> vec<3, fa>
fn round_a1673d() {
var res = round(vec3(3.4));
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
round_a1673d();
return vec4<f32>();
}
@fragment
fn fragment_main() {
round_a1673d();
}
@compute @workgroup_size(1)
fn compute_main() {
round_a1673d();
}

View File

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

View File

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

View File

@ -0,0 +1,49 @@
#version 310 es
void round_a1673d() {
vec3 res = vec3(3.0f);
}
vec4 vertex_main() {
round_a1673d();
return vec4(0.0f);
}
void main() {
gl_PointSize = 1.0;
vec4 inner_result = vertex_main();
gl_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 round_a1673d() {
vec3 res = vec3(3.0f);
}
void fragment_main() {
round_a1673d();
}
void main() {
fragment_main();
return;
}
#version 310 es
void round_a1673d() {
vec3 res = vec3(3.0f);
}
void compute_main() {
round_a1673d();
}
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 round_a1673d() {
float3 res = float3(3.0f);
}
struct tint_symbol {
float4 value [[position]];
};
float4 vertex_main_inner() {
round_a1673d();
return float4(0.0f);
}
vertex tint_symbol vertex_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_a1673d();
return;
}
kernel void compute_main() {
round_a1673d();
return;
}

View File

@ -0,0 +1,67 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 33
; 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 %round_a1673d "round_a1673d"
OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %value BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%value = OpVariable %_ptr_Output_v4float Output %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_3 = OpConstant %float 3
%15 = OpConstantComposite %v3float %float_3 %float_3 %float_3
%_ptr_Function_v3float = OpTypePointer Function %v3float
%18 = OpConstantNull %v3float
%19 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%round_a1673d = 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 %round_a1673d
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_a1673d
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%31 = OpLabel
%32 = OpFunctionCall %void %round_a1673d
OpReturn
OpFunctionEnd

View File

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

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
using namespace metal;
void round_d87e84() {
half2 res = rint(half2(1.0h));
half2 res = half2(3.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"
@ -37,38 +36,37 @@
%9 = OpTypeFunction %void
%half = OpTypeFloat 16
%v2half = OpTypeVector %half 2
%half_0x1p_0 = OpConstant %half 0x1p+0
%18 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_0
%half_0x1_8p_1 = OpConstant %half 0x1.8p+1
%16 = OpConstantComposite %v2half %half_0x1_8p_1 %half_0x1_8p_1
%_ptr_Function_v2half = OpTypePointer Function %v2half
%21 = OpConstantNull %v2half
%22 = OpTypeFunction %v4float
%19 = OpConstantNull %v2half
%20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%round_d87e84 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v2half Function %21
%13 = OpExtInst %v2half %16 RoundEven %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 %round_d87e84
%vertex_main_inner = OpFunction %v4float None %20
%22 = OpLabel
%23 = OpFunctionCall %void %round_d87e84
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 %round_d87e84
%29 = OpLabel
%30 = OpFunctionCall %void %round_d87e84
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%34 = OpLabel
%35 = OpFunctionCall %void %round_d87e84
%32 = OpLabel
%33 = OpFunctionCall %void %round_d87e84
OpReturn
OpFunctionEnd

View File

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

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
using namespace metal;
void round_e1bba2() {
half3 res = rint(half3(1.0h));
half3 res = half3(3.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"
@ -37,38 +36,37 @@
%9 = OpTypeFunction %void
%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
%half_0x1_8p_1 = OpConstant %half 0x1.8p+1
%16 = OpConstantComposite %v3half %half_0x1_8p_1 %half_0x1_8p_1 %half_0x1_8p_1
%_ptr_Function_v3half = OpTypePointer Function %v3half
%21 = OpConstantNull %v3half
%22 = OpTypeFunction %v4float
%19 = OpConstantNull %v3half
%20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%round_e1bba2 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v3half Function %21
%13 = OpExtInst %v3half %16 RoundEven %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 %round_e1bba2
%vertex_main_inner = OpFunction %v4float None %20
%22 = OpLabel
%23 = OpFunctionCall %void %round_e1bba2
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 %round_e1bba2
%29 = OpLabel
%30 = OpFunctionCall %void %round_e1bba2
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%34 = OpLabel
%35 = OpFunctionCall %void %round_e1bba2
%32 = OpLabel
%33 = OpFunctionCall %void %round_e1bba2
OpReturn
OpFunctionEnd

View File

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

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
using namespace metal;
void round_f665b5() {
half4 res = rint(half4(1.0h));
half4 res = half4(3.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"
@ -37,38 +36,37 @@
%9 = OpTypeFunction %void
%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
%half_0x1_8p_1 = OpConstant %half 0x1.8p+1
%16 = OpConstantComposite %v4half %half_0x1_8p_1 %half_0x1_8p_1 %half_0x1_8p_1 %half_0x1_8p_1
%_ptr_Function_v4half = OpTypePointer Function %v4half
%21 = OpConstantNull %v4half
%22 = OpTypeFunction %v4float
%19 = OpConstantNull %v4half
%20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%round_f665b5 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v4half Function %21
%13 = OpExtInst %v4half %16 RoundEven %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 %round_f665b5
%vertex_main_inner = OpFunction %v4float None %20
%22 = OpLabel
%23 = OpFunctionCall %void %round_f665b5
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 %round_f665b5
%29 = OpLabel
%30 = OpFunctionCall %void %round_f665b5
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%34 = OpLabel
%35 = OpFunctionCall %void %round_f665b5
%32 = OpLabel
%33 = OpFunctionCall %void %round_f665b5
OpReturn
OpFunctionEnd

View File

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

View File

@ -23,7 +23,7 @@
// fn round(vec<4, f32>) -> vec<4, f32>
fn round_106c0b() {
var arg_0 = vec4<f32>(1.f);
var arg_0 = vec4<f32>(3.4f);
var res: vec4<f32> = round(arg_0);
}

View File

@ -1,5 +1,5 @@
void round_106c0b() {
float4 arg_0 = (1.0f).xxxx;
float4 arg_0 = (3.400000095f).xxxx;
float4 res = round(arg_0);
}

View File

@ -1,5 +1,5 @@
void round_106c0b() {
float4 arg_0 = (1.0f).xxxx;
float4 arg_0 = (3.400000095f).xxxx;
float4 res = round(arg_0);
}

View File

@ -1,7 +1,7 @@
#version 310 es
void round_106c0b() {
vec4 arg_0 = vec4(1.0f);
vec4 arg_0 = vec4(3.400000095f);
vec4 res = round(arg_0);
}
@ -22,7 +22,7 @@ void main() {
precision mediump float;
void round_106c0b() {
vec4 arg_0 = vec4(1.0f);
vec4 arg_0 = vec4(3.400000095f);
vec4 res = round(arg_0);
}
@ -37,7 +37,7 @@ void main() {
#version 310 es
void round_106c0b() {
vec4 arg_0 = vec4(1.0f);
vec4 arg_0 = vec4(3.400000095f);
vec4 res = round(arg_0);
}

View File

@ -2,7 +2,7 @@
using namespace metal;
void round_106c0b() {
float4 arg_0 = float4(1.0f);
float4 arg_0 = float4(3.400000095f);
float4 res = rint(arg_0);
}

View File

@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 34
; Bound: 35
; Schema: 0
OpCapability Shader
%18 = OpExtInstImport "GLSL.std.450"
@ -32,10 +32,11 @@
%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
%float_3_4000001 = OpConstant %float 3.4000001
%14 = OpConstantComposite %v4float %float_3_4000001 %float_3_4000001 %float_3_4000001 %float_3_4000001
%_ptr_Function_v4float = OpTypePointer Function %v4float
%21 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%round_106c0b = OpFunction %void None %9
%12 = OpLabel
%arg_0 = OpVariable %_ptr_Function_v4float Function %5
@ -59,12 +60,12 @@
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
%29 = OpLabel
%30 = OpFunctionCall %void %round_106c0b
%30 = OpLabel
%31 = OpFunctionCall %void %round_106c0b
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%32 = OpLabel
%33 = OpFunctionCall %void %round_106c0b
%33 = OpLabel
%34 = OpFunctionCall %void %round_106c0b
OpReturn
OpFunctionEnd

View File

@ -1,5 +1,5 @@
fn round_106c0b() {
var arg_0 = vec4<f32>(1.0f);
var arg_0 = vec4<f32>(3.400000095f);
var res : vec4<f32> = round(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 round(vec<4, fa>) -> vec<4, fa>
fn round_184d5a() {
const arg_0 = vec4(3.4);
var res = round(arg_0);
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
round_184d5a();
return vec4<f32>();
}
@fragment
fn fragment_main() {
round_184d5a();
}
@compute @workgroup_size(1)
fn compute_main() {
round_184d5a();
}

View File

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

View File

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

View File

@ -0,0 +1,49 @@
#version 310 es
void round_184d5a() {
vec4 res = vec4(3.0f);
}
vec4 vertex_main() {
round_184d5a();
return vec4(0.0f);
}
void main() {
gl_PointSize = 1.0;
vec4 inner_result = vertex_main();
gl_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 round_184d5a() {
vec4 res = vec4(3.0f);
}
void fragment_main() {
round_184d5a();
}
void main() {
fragment_main();
return;
}
#version 310 es
void round_184d5a() {
vec4 res = vec4(3.0f);
}
void compute_main() {
round_184d5a();
}
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 round_184d5a() {
float4 res = float4(3.0f);
}
struct tint_symbol {
float4 value [[position]];
};
float4 vertex_main_inner() {
round_184d5a();
return float4(0.0f);
}
vertex tint_symbol vertex_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_184d5a();
return;
}
kernel void compute_main() {
round_184d5a();
return;
}

View File

@ -0,0 +1,65 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 31
; 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 %round_184d5a "round_184d5a"
OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %value BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%value = OpVariable %_ptr_Output_v4float Output %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_3 = OpConstant %float 3
%14 = OpConstantComposite %v4float %float_3 %float_3 %float_3 %float_3
%_ptr_Function_v4float = OpTypePointer Function %v4float
%17 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%round_184d5a = 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 %round_184d5a
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 %round_184d5a
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%29 = OpLabel
%30 = OpFunctionCall %void %round_184d5a
OpReturn
OpFunctionEnd

View File

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

View File

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

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