tint/intrinsics.def: Implement saturate()
Fixed: tint:1591 Change-Id: I0b1397d74abd49cd44caf326a2063e50c5cf07de Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101480 Reviewed-by: Dan Sinclair <dsinclair@chromium.org> Auto-Submit: Ben Clayton <bclayton@google.com> Commit-Queue: Ben Clayton <bclayton@google.com> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
parent
f3d9ea4bea
commit
751e6686aa
|
@ -6,6 +6,7 @@
|
|||
|
||||
* `array()` constructor can now infer type and count. [tint:1628](crbug.com/tint/1628)
|
||||
* `static_assert` statement has been added. [tint:1625](crbug.com/tint/1625)
|
||||
* `saturate()` has been implemented. [tint:1591](crbug.com/tint/1591)
|
||||
|
||||
### Breaking changes
|
||||
|
||||
|
|
|
@ -508,6 +508,8 @@ fn reverseBits<T: iu32>(T) -> T
|
|||
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>
|
||||
fn saturate<T: f32_f16>(T) -> T
|
||||
fn saturate<T: f32_f16, N: num>(vec<N, T>) -> vec<N, T>
|
||||
fn select<T: scalar>(T, T, bool) -> T
|
||||
fn select<T: scalar, N: num>(vec<N, T>, vec<N, T>, bool) -> vec<N, T>
|
||||
fn select<N: num, T: scalar>(vec<N, T>, vec<N, T>, vec<N, bool>) -> vec<N, T>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -225,6 +225,9 @@ BuiltinType ParseBuiltinType(const std::string& name) {
|
|||
if (name == "round") {
|
||||
return BuiltinType::kRound;
|
||||
}
|
||||
if (name == "saturate") {
|
||||
return BuiltinType::kSaturate;
|
||||
}
|
||||
if (name == "select") {
|
||||
return BuiltinType::kSelect;
|
||||
}
|
||||
|
@ -493,6 +496,8 @@ const char* str(BuiltinType i) {
|
|||
return "reverseBits";
|
||||
case BuiltinType::kRound:
|
||||
return "round";
|
||||
case BuiltinType::kSaturate:
|
||||
return "saturate";
|
||||
case BuiltinType::kSelect:
|
||||
return "select";
|
||||
case BuiltinType::kSign:
|
||||
|
|
|
@ -97,6 +97,7 @@ enum class BuiltinType {
|
|||
kRefract,
|
||||
kReverseBits,
|
||||
kRound,
|
||||
kSaturate,
|
||||
kSelect,
|
||||
kSign,
|
||||
kSin,
|
||||
|
|
|
@ -495,6 +495,23 @@ struct BuiltinPolyfill::State {
|
|||
return name;
|
||||
}
|
||||
|
||||
/// Builds the polyfill function for the `saturate` builtin
|
||||
/// @param ty the parameter and return type for the function
|
||||
/// @return the polyfill function name
|
||||
Symbol saturate(const sem::Type* ty) {
|
||||
auto name = b.Symbols().New("tint_saturate");
|
||||
auto body = utils::Vector{
|
||||
b.Return(b.Call("clamp", "v", b.Construct(T(ty), 0_a), b.Construct(T(ty), 1_a))),
|
||||
};
|
||||
b.Func(name,
|
||||
utils::Vector{
|
||||
b.Param("v", T(ty)),
|
||||
},
|
||||
T(ty), body);
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
private:
|
||||
/// @returns the AST type for the given sem type
|
||||
const ast::Type* T(const sem::Type* ty) const { return CreateASTTypeFor(ctx, ty); }
|
||||
|
@ -575,6 +592,11 @@ bool BuiltinPolyfill::ShouldRun(const Program* program, const DataMap& data) con
|
|||
return true;
|
||||
}
|
||||
break;
|
||||
case sem::BuiltinType::kSaturate:
|
||||
if (builtins.saturate) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -661,6 +683,13 @@ void BuiltinPolyfill::Run(CloneContext& ctx, const DataMap& data, DataMap&) cons
|
|||
});
|
||||
}
|
||||
break;
|
||||
case sem::BuiltinType::kSaturate:
|
||||
if (builtins.saturate) {
|
||||
polyfill = utils::GetOrCreate(polyfills, builtin, [&] {
|
||||
return s.saturate(builtin->ReturnType());
|
||||
});
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -59,6 +59,8 @@ class BuiltinPolyfill final : public Castable<BuiltinPolyfill, Transform> {
|
|||
bool first_trailing_bit = false;
|
||||
/// Should `insertBits()` be polyfilled?
|
||||
Level insert_bits = Level::kNone;
|
||||
/// Should `saturate()` be polyfilled?
|
||||
bool saturate = false;
|
||||
};
|
||||
|
||||
/// Config is consumed by the BuiltinPolyfill transform.
|
||||
|
|
|
@ -1387,5 +1387,167 @@ fn f() {
|
|||
EXPECT_EQ(expect, str(got));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// saturate
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
DataMap polyfillSaturate() {
|
||||
BuiltinPolyfill::Builtins builtins;
|
||||
builtins.saturate = true;
|
||||
DataMap data;
|
||||
data.Add<BuiltinPolyfill::Config>(builtins);
|
||||
return data;
|
||||
}
|
||||
|
||||
TEST_F(BuiltinPolyfillTest, ShouldRunSaturate) {
|
||||
auto* src = R"(
|
||||
fn f() {
|
||||
saturate(0.5);
|
||||
}
|
||||
)";
|
||||
|
||||
EXPECT_FALSE(ShouldRun<BuiltinPolyfill>(src));
|
||||
EXPECT_TRUE(ShouldRun<BuiltinPolyfill>(src, polyfillSaturate()));
|
||||
}
|
||||
|
||||
TEST_F(BuiltinPolyfillTest, Saturate_f32) {
|
||||
auto* src = R"(
|
||||
fn f() {
|
||||
let r : f32 = saturate(0.5f);
|
||||
}
|
||||
)";
|
||||
|
||||
auto* expect = R"(
|
||||
fn tint_saturate(v : f32) -> f32 {
|
||||
return clamp(v, f32(0), f32(1));
|
||||
}
|
||||
|
||||
fn f() {
|
||||
let r : f32 = tint_saturate(0.5f);
|
||||
}
|
||||
)";
|
||||
|
||||
auto got = Run<BuiltinPolyfill>(src, polyfillSaturate());
|
||||
|
||||
EXPECT_EQ(expect, str(got));
|
||||
}
|
||||
|
||||
TEST_F(BuiltinPolyfillTest, Saturate_f32_from_abstract_float) {
|
||||
auto* src = R"(
|
||||
fn f() {
|
||||
let r : f32 = saturate(0.5);
|
||||
}
|
||||
)";
|
||||
|
||||
auto* expect = R"(
|
||||
fn tint_saturate(v : f32) -> f32 {
|
||||
return clamp(v, f32(0), f32(1));
|
||||
}
|
||||
|
||||
fn f() {
|
||||
let r : f32 = tint_saturate(0.5);
|
||||
}
|
||||
)";
|
||||
|
||||
auto got = Run<BuiltinPolyfill>(src, polyfillSaturate());
|
||||
|
||||
EXPECT_EQ(expect, str(got));
|
||||
}
|
||||
|
||||
TEST_F(BuiltinPolyfillTest, Saturate_f16) {
|
||||
auto* src = R"(
|
||||
enable f16;
|
||||
|
||||
fn f() {
|
||||
let r : f16 = saturate(0.5h);
|
||||
}
|
||||
)";
|
||||
|
||||
auto* expect = R"(
|
||||
enable f16;
|
||||
|
||||
fn tint_saturate(v : f16) -> f16 {
|
||||
return clamp(v, f16(0), f16(1));
|
||||
}
|
||||
|
||||
fn f() {
|
||||
let r : f16 = tint_saturate(0.5h);
|
||||
}
|
||||
)";
|
||||
|
||||
auto got = Run<BuiltinPolyfill>(src, polyfillSaturate());
|
||||
|
||||
EXPECT_EQ(expect, str(got));
|
||||
}
|
||||
|
||||
TEST_F(BuiltinPolyfillTest, Saturate_vec3_f32) {
|
||||
auto* src = R"(
|
||||
fn f() {
|
||||
let r : vec3<f32> = saturate(vec3<f32>(0.5f));
|
||||
}
|
||||
)";
|
||||
|
||||
auto* expect = R"(
|
||||
fn tint_saturate(v : vec3<f32>) -> vec3<f32> {
|
||||
return clamp(v, vec3<f32>(0), vec3<f32>(1));
|
||||
}
|
||||
|
||||
fn f() {
|
||||
let r : vec3<f32> = tint_saturate(vec3<f32>(0.5f));
|
||||
}
|
||||
)";
|
||||
|
||||
auto got = Run<BuiltinPolyfill>(src, polyfillSaturate());
|
||||
|
||||
EXPECT_EQ(expect, str(got));
|
||||
}
|
||||
|
||||
TEST_F(BuiltinPolyfillTest, Saturate_vec3_f32_from_abstract_float) {
|
||||
auto* src = R"(
|
||||
fn f() {
|
||||
let r : vec3<f32> = saturate(vec3(0.5));
|
||||
}
|
||||
)";
|
||||
|
||||
auto* expect = R"(
|
||||
fn tint_saturate(v : vec3<f32>) -> vec3<f32> {
|
||||
return clamp(v, vec3<f32>(0), vec3<f32>(1));
|
||||
}
|
||||
|
||||
fn f() {
|
||||
let r : vec3<f32> = tint_saturate(vec3(0.5));
|
||||
}
|
||||
)";
|
||||
|
||||
auto got = Run<BuiltinPolyfill>(src, polyfillSaturate());
|
||||
|
||||
EXPECT_EQ(expect, str(got));
|
||||
}
|
||||
|
||||
TEST_F(BuiltinPolyfillTest, Saturate_vec3_f16) {
|
||||
auto* src = R"(
|
||||
enable f16;
|
||||
|
||||
fn f() {
|
||||
let r : vec3<f16> = saturate(vec3<f16>(0.5h));
|
||||
}
|
||||
)";
|
||||
|
||||
auto* expect = R"(
|
||||
enable f16;
|
||||
|
||||
fn tint_saturate(v : vec3<f16>) -> vec3<f16> {
|
||||
return clamp(v, vec3<f16>(0), vec3<f16>(1));
|
||||
}
|
||||
|
||||
fn f() {
|
||||
let r : vec3<f16> = tint_saturate(vec3<f16>(0.5h));
|
||||
}
|
||||
)";
|
||||
|
||||
auto got = Run<BuiltinPolyfill>(src, polyfillSaturate());
|
||||
|
||||
EXPECT_EQ(expect, str(got));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace tint::transform
|
||||
|
|
|
@ -194,6 +194,7 @@ SanitizedResult Sanitize(const Program* in,
|
|||
polyfills.first_leading_bit = true;
|
||||
polyfills.first_trailing_bit = true;
|
||||
polyfills.insert_bits = transform::BuiltinPolyfill::Level::kClampParameters;
|
||||
polyfills.saturate = true;
|
||||
data.Add<transform::BuiltinPolyfill::Config>(polyfills);
|
||||
manager.Add<transform::BuiltinPolyfill>();
|
||||
}
|
||||
|
|
|
@ -2510,6 +2510,7 @@ std::string GeneratorImpl::generate_builtin_name(const sem::Builtin* builtin) {
|
|||
case sem::BuiltinType::kReflect:
|
||||
case sem::BuiltinType::kRefract:
|
||||
case sem::BuiltinType::kRound:
|
||||
case sem::BuiltinType::kSaturate:
|
||||
case sem::BuiltinType::kSign:
|
||||
case sem::BuiltinType::kSin:
|
||||
case sem::BuiltinType::kSinh:
|
||||
|
|
|
@ -1400,6 +1400,7 @@ std::string GeneratorImpl::generate_builtin_name(const sem::Builtin* builtin) {
|
|||
case sem::BuiltinType::kPow:
|
||||
case sem::BuiltinType::kReflect:
|
||||
case sem::BuiltinType::kRefract:
|
||||
case sem::BuiltinType::kSaturate:
|
||||
case sem::BuiltinType::kSelect:
|
||||
case sem::BuiltinType::kSin:
|
||||
case sem::BuiltinType::kSinh:
|
||||
|
|
|
@ -57,6 +57,7 @@ SanitizedResult Sanitize(const Program* in, const Options& options) {
|
|||
polyfills.first_leading_bit = true;
|
||||
polyfills.first_trailing_bit = true;
|
||||
polyfills.insert_bits = transform::BuiltinPolyfill::Level::kClampParameters;
|
||||
polyfills.saturate = true;
|
||||
data.Add<transform::BuiltinPolyfill::Config>(polyfills);
|
||||
manager.Add<transform::BuiltinPolyfill>();
|
||||
}
|
||||
|
|
|
@ -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 saturate(f32) -> f32
|
||||
fn saturate_270da5() {
|
||||
var res: f32 = saturate(1.f);
|
||||
}
|
||||
|
||||
@vertex
|
||||
fn vertex_main() -> @builtin(position) vec4<f32> {
|
||||
saturate_270da5();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn fragment_main() {
|
||||
saturate_270da5();
|
||||
}
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn compute_main() {
|
||||
saturate_270da5();
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
void saturate_270da5() {
|
||||
float res = saturate(1.0f);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
saturate_270da5();
|
||||
return (0.0f).xxxx;
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
saturate_270da5();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
saturate_270da5();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
void saturate_270da5() {
|
||||
float res = saturate(1.0f);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
saturate_270da5();
|
||||
return (0.0f).xxxx;
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
saturate_270da5();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
saturate_270da5();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
#version 310 es
|
||||
|
||||
float tint_saturate(float v) {
|
||||
return clamp(v, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
void saturate_270da5() {
|
||||
float res = tint_saturate(1.0f);
|
||||
}
|
||||
|
||||
vec4 vertex_main() {
|
||||
saturate_270da5();
|
||||
return vec4(0.0f);
|
||||
}
|
||||
|
||||
void main() {
|
||||
gl_PointSize = 1.0;
|
||||
vec4 inner_result = vertex_main();
|
||||
gl_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;
|
||||
|
||||
float tint_saturate(float v) {
|
||||
return clamp(v, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
void saturate_270da5() {
|
||||
float res = tint_saturate(1.0f);
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
saturate_270da5();
|
||||
}
|
||||
|
||||
void main() {
|
||||
fragment_main();
|
||||
return;
|
||||
}
|
||||
#version 310 es
|
||||
|
||||
float tint_saturate(float v) {
|
||||
return clamp(v, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
void saturate_270da5() {
|
||||
float res = tint_saturate(1.0f);
|
||||
}
|
||||
|
||||
void compute_main() {
|
||||
saturate_270da5();
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
compute_main();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
void saturate_270da5() {
|
||||
float res = saturate(1.0f);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
saturate_270da5();
|
||||
return float4(0.0f);
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main() {
|
||||
float4 const inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
fragment void fragment_main() {
|
||||
saturate_270da5();
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main() {
|
||||
saturate_270da5();
|
||||
return;
|
||||
}
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 36
|
||||
; 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"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %tint_saturate "tint_saturate"
|
||||
OpName %v "v"
|
||||
OpName %saturate_270da5 "saturate_270da5"
|
||||
OpName %res "res"
|
||||
OpName %vertex_main_inner "vertex_main_inner"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%8 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||
%9 = OpTypeFunction %float %float
|
||||
%float_1 = OpConstant %float 1
|
||||
%void = OpTypeVoid
|
||||
%16 = OpTypeFunction %void
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%23 = OpTypeFunction %v4float
|
||||
%tint_saturate = OpFunction %float None %9
|
||||
%v = OpFunctionParameter %float
|
||||
%12 = OpLabel
|
||||
%13 = OpExtInst %float %14 NClamp %v %8 %float_1
|
||||
OpReturnValue %13
|
||||
OpFunctionEnd
|
||||
%saturate_270da5 = OpFunction %void None %16
|
||||
%19 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_float Function %8
|
||||
%20 = OpFunctionCall %float %tint_saturate %float_1
|
||||
OpStore %res %20
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %23
|
||||
%25 = OpLabel
|
||||
%26 = OpFunctionCall %void %saturate_270da5
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %16
|
||||
%28 = OpLabel
|
||||
%29 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %29
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %16
|
||||
%31 = OpLabel
|
||||
%32 = OpFunctionCall %void %saturate_270da5
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %16
|
||||
%34 = OpLabel
|
||||
%35 = OpFunctionCall %void %saturate_270da5
|
||||
OpReturn
|
||||
OpFunctionEnd
|
|
@ -0,0 +1,19 @@
|
|||
fn saturate_270da5() {
|
||||
var res : f32 = saturate(1.0f);
|
||||
}
|
||||
|
||||
@vertex
|
||||
fn vertex_main() -> @builtin(position) vec4<f32> {
|
||||
saturate_270da5();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn fragment_main() {
|
||||
saturate_270da5();
|
||||
}
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn compute_main() {
|
||||
saturate_270da5();
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
// Copyright 2022 The Tint Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// File generated by tools/src/cmd/gen
|
||||
// using the template:
|
||||
// test/tint/builtins/gen/gen.wgsl.tmpl
|
||||
//
|
||||
// Do not modify this file directly
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
enable f16;
|
||||
|
||||
// fn saturate(vec<3, f16>) -> vec<3, f16>
|
||||
fn saturate_462535() {
|
||||
var res: vec3<f16> = saturate(vec3<f16>(f16()));
|
||||
}
|
||||
|
||||
@vertex
|
||||
fn vertex_main() -> @builtin(position) vec4<f32> {
|
||||
saturate_462535();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn fragment_main() {
|
||||
saturate_462535();
|
||||
}
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn compute_main() {
|
||||
saturate_462535();
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
void saturate_462535() {
|
||||
vector<float16_t, 3> res = saturate((float16_t(0.0h)).xxx);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
saturate_462535();
|
||||
return (0.0f).xxxx;
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
saturate_462535();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
saturate_462535();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
SKIP: FAILED - f16 not supported with FXC
|
||||
|
||||
void saturate_462535() {
|
||||
vector<float16_t, 3> res = saturate((float16_t(0.0h)).xxx);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
saturate_462535();
|
||||
return (0.0f).xxxx;
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
saturate_462535();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
saturate_462535();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
#version 310 es
|
||||
#extension GL_AMD_gpu_shader_half_float : require
|
||||
|
||||
f16vec3 tint_saturate(f16vec3 v) {
|
||||
return clamp(v, f16vec3(0.0hf), f16vec3(1.0hf));
|
||||
}
|
||||
|
||||
void saturate_462535() {
|
||||
f16vec3 res = tint_saturate(f16vec3(0.0hf));
|
||||
}
|
||||
|
||||
vec4 vertex_main() {
|
||||
saturate_462535();
|
||||
return vec4(0.0f);
|
||||
}
|
||||
|
||||
void main() {
|
||||
gl_PointSize = 1.0;
|
||||
vec4 inner_result = vertex_main();
|
||||
gl_Position = inner_result;
|
||||
gl_Position.y = -(gl_Position.y);
|
||||
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
|
||||
return;
|
||||
}
|
||||
#version 310 es
|
||||
#extension GL_AMD_gpu_shader_half_float : require
|
||||
precision mediump float;
|
||||
|
||||
f16vec3 tint_saturate(f16vec3 v) {
|
||||
return clamp(v, f16vec3(0.0hf), f16vec3(1.0hf));
|
||||
}
|
||||
|
||||
void saturate_462535() {
|
||||
f16vec3 res = tint_saturate(f16vec3(0.0hf));
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
saturate_462535();
|
||||
}
|
||||
|
||||
void main() {
|
||||
fragment_main();
|
||||
return;
|
||||
}
|
||||
#version 310 es
|
||||
#extension GL_AMD_gpu_shader_half_float : require
|
||||
|
||||
f16vec3 tint_saturate(f16vec3 v) {
|
||||
return clamp(v, f16vec3(0.0hf), f16vec3(1.0hf));
|
||||
}
|
||||
|
||||
void saturate_462535() {
|
||||
f16vec3 res = tint_saturate(f16vec3(0.0hf));
|
||||
}
|
||||
|
||||
void compute_main() {
|
||||
saturate_462535();
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
compute_main();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
void saturate_462535() {
|
||||
half3 res = saturate(half3(0.0h));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
saturate_462535();
|
||||
return float4(0.0f);
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main() {
|
||||
float4 const inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
fragment void fragment_main() {
|
||||
saturate_462535();
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main() {
|
||||
saturate_462535();
|
||||
return;
|
||||
}
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 41
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpCapability Float16
|
||||
OpCapability UniformAndStorageBuffer16BitAccess
|
||||
OpCapability StorageBuffer16BitAccess
|
||||
OpCapability StorageInputOutput16
|
||||
%16 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %tint_saturate "tint_saturate"
|
||||
OpName %v "v"
|
||||
OpName %saturate_462535 "saturate_462535"
|
||||
OpName %res "res"
|
||||
OpName %vertex_main_inner "vertex_main_inner"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%8 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||
%half = OpTypeFloat 16
|
||||
%v3half = OpTypeVector %half 3
|
||||
%9 = OpTypeFunction %v3half %v3half
|
||||
%17 = OpConstantNull %v3half
|
||||
%half_0x1p_0 = OpConstant %half 0x1p+0
|
||||
%19 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0
|
||||
%void = OpTypeVoid
|
||||
%20 = OpTypeFunction %void
|
||||
%_ptr_Function_v3half = OpTypePointer Function %v3half
|
||||
%27 = OpTypeFunction %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%tint_saturate = OpFunction %v3half None %9
|
||||
%v = OpFunctionParameter %v3half
|
||||
%14 = OpLabel
|
||||
%15 = OpExtInst %v3half %16 NClamp %v %17 %19
|
||||
OpReturnValue %15
|
||||
OpFunctionEnd
|
||||
%saturate_462535 = OpFunction %void None %20
|
||||
%23 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_v3half Function %17
|
||||
%24 = OpFunctionCall %v3half %tint_saturate %17
|
||||
OpStore %res %24
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %27
|
||||
%29 = OpLabel
|
||||
%30 = OpFunctionCall %void %saturate_462535
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %20
|
||||
%32 = OpLabel
|
||||
%33 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %33
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %20
|
||||
%36 = OpLabel
|
||||
%37 = OpFunctionCall %void %saturate_462535
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %20
|
||||
%39 = OpLabel
|
||||
%40 = OpFunctionCall %void %saturate_462535
|
||||
OpReturn
|
||||
OpFunctionEnd
|
|
@ -0,0 +1,21 @@
|
|||
enable f16;
|
||||
|
||||
fn saturate_462535() {
|
||||
var res : vec3<f16> = saturate(vec3<f16>(f16()));
|
||||
}
|
||||
|
||||
@vertex
|
||||
fn vertex_main() -> @builtin(position) vec4<f32> {
|
||||
saturate_462535();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn fragment_main() {
|
||||
saturate_462535();
|
||||
}
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn compute_main() {
|
||||
saturate_462535();
|
||||
}
|
|
@ -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 saturate(vec<2, f32>) -> vec<2, f32>
|
||||
fn saturate_51567f() {
|
||||
var res: vec2<f32> = saturate(vec2<f32>(1.f));
|
||||
}
|
||||
|
||||
@vertex
|
||||
fn vertex_main() -> @builtin(position) vec4<f32> {
|
||||
saturate_51567f();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn fragment_main() {
|
||||
saturate_51567f();
|
||||
}
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn compute_main() {
|
||||
saturate_51567f();
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
void saturate_51567f() {
|
||||
float2 res = saturate((1.0f).xx);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
saturate_51567f();
|
||||
return (0.0f).xxxx;
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
saturate_51567f();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
saturate_51567f();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
void saturate_51567f() {
|
||||
float2 res = saturate((1.0f).xx);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
saturate_51567f();
|
||||
return (0.0f).xxxx;
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
saturate_51567f();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
saturate_51567f();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
#version 310 es
|
||||
|
||||
vec2 tint_saturate(vec2 v) {
|
||||
return clamp(v, vec2(0.0f), vec2(1.0f));
|
||||
}
|
||||
|
||||
void saturate_51567f() {
|
||||
vec2 res = tint_saturate(vec2(1.0f));
|
||||
}
|
||||
|
||||
vec4 vertex_main() {
|
||||
saturate_51567f();
|
||||
return vec4(0.0f);
|
||||
}
|
||||
|
||||
void main() {
|
||||
gl_PointSize = 1.0;
|
||||
vec4 inner_result = vertex_main();
|
||||
gl_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;
|
||||
|
||||
vec2 tint_saturate(vec2 v) {
|
||||
return clamp(v, vec2(0.0f), vec2(1.0f));
|
||||
}
|
||||
|
||||
void saturate_51567f() {
|
||||
vec2 res = tint_saturate(vec2(1.0f));
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
saturate_51567f();
|
||||
}
|
||||
|
||||
void main() {
|
||||
fragment_main();
|
||||
return;
|
||||
}
|
||||
#version 310 es
|
||||
|
||||
vec2 tint_saturate(vec2 v) {
|
||||
return clamp(v, vec2(0.0f), vec2(1.0f));
|
||||
}
|
||||
|
||||
void saturate_51567f() {
|
||||
vec2 res = tint_saturate(vec2(1.0f));
|
||||
}
|
||||
|
||||
void compute_main() {
|
||||
saturate_51567f();
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
compute_main();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
void saturate_51567f() {
|
||||
float2 res = saturate(float2(1.0f));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
saturate_51567f();
|
||||
return float4(0.0f);
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main() {
|
||||
float4 const inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
fragment void fragment_main() {
|
||||
saturate_51567f();
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main() {
|
||||
saturate_51567f();
|
||||
return;
|
||||
}
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 39
|
||||
; 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"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %tint_saturate "tint_saturate"
|
||||
OpName %v "v"
|
||||
OpName %saturate_51567f "saturate_51567f"
|
||||
OpName %res "res"
|
||||
OpName %vertex_main_inner "vertex_main_inner"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%8 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||
%v2float = OpTypeVector %float 2
|
||||
%9 = OpTypeFunction %v2float %v2float
|
||||
%16 = OpConstantNull %v2float
|
||||
%float_1 = OpConstant %float 1
|
||||
%18 = OpConstantComposite %v2float %float_1 %float_1
|
||||
%void = OpTypeVoid
|
||||
%19 = OpTypeFunction %void
|
||||
%_ptr_Function_v2float = OpTypePointer Function %v2float
|
||||
%26 = OpTypeFunction %v4float
|
||||
%tint_saturate = OpFunction %v2float None %9
|
||||
%v = OpFunctionParameter %v2float
|
||||
%13 = OpLabel
|
||||
%14 = OpExtInst %v2float %15 NClamp %v %16 %18
|
||||
OpReturnValue %14
|
||||
OpFunctionEnd
|
||||
%saturate_51567f = OpFunction %void None %19
|
||||
%22 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_v2float Function %16
|
||||
%23 = OpFunctionCall %v2float %tint_saturate %18
|
||||
OpStore %res %23
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %26
|
||||
%28 = OpLabel
|
||||
%29 = OpFunctionCall %void %saturate_51567f
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %19
|
||||
%31 = OpLabel
|
||||
%32 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %32
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %19
|
||||
%34 = OpLabel
|
||||
%35 = OpFunctionCall %void %saturate_51567f
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %19
|
||||
%37 = OpLabel
|
||||
%38 = OpFunctionCall %void %saturate_51567f
|
||||
OpReturn
|
||||
OpFunctionEnd
|
|
@ -0,0 +1,19 @@
|
|||
fn saturate_51567f() {
|
||||
var res : vec2<f32> = saturate(vec2<f32>(1.0f));
|
||||
}
|
||||
|
||||
@vertex
|
||||
fn vertex_main() -> @builtin(position) vec4<f32> {
|
||||
saturate_51567f();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn fragment_main() {
|
||||
saturate_51567f();
|
||||
}
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn compute_main() {
|
||||
saturate_51567f();
|
||||
}
|
|
@ -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 saturate(vec<3, f32>) -> vec<3, f32>
|
||||
fn saturate_6bcddf() {
|
||||
var res: vec3<f32> = saturate(vec3<f32>(1.f));
|
||||
}
|
||||
|
||||
@vertex
|
||||
fn vertex_main() -> @builtin(position) vec4<f32> {
|
||||
saturate_6bcddf();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn fragment_main() {
|
||||
saturate_6bcddf();
|
||||
}
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn compute_main() {
|
||||
saturate_6bcddf();
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
void saturate_6bcddf() {
|
||||
float3 res = saturate((1.0f).xxx);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
saturate_6bcddf();
|
||||
return (0.0f).xxxx;
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
saturate_6bcddf();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
saturate_6bcddf();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
void saturate_6bcddf() {
|
||||
float3 res = saturate((1.0f).xxx);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
saturate_6bcddf();
|
||||
return (0.0f).xxxx;
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
saturate_6bcddf();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
saturate_6bcddf();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
#version 310 es
|
||||
|
||||
vec3 tint_saturate(vec3 v) {
|
||||
return clamp(v, vec3(0.0f), vec3(1.0f));
|
||||
}
|
||||
|
||||
void saturate_6bcddf() {
|
||||
vec3 res = tint_saturate(vec3(1.0f));
|
||||
}
|
||||
|
||||
vec4 vertex_main() {
|
||||
saturate_6bcddf();
|
||||
return vec4(0.0f);
|
||||
}
|
||||
|
||||
void main() {
|
||||
gl_PointSize = 1.0;
|
||||
vec4 inner_result = vertex_main();
|
||||
gl_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;
|
||||
|
||||
vec3 tint_saturate(vec3 v) {
|
||||
return clamp(v, vec3(0.0f), vec3(1.0f));
|
||||
}
|
||||
|
||||
void saturate_6bcddf() {
|
||||
vec3 res = tint_saturate(vec3(1.0f));
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
saturate_6bcddf();
|
||||
}
|
||||
|
||||
void main() {
|
||||
fragment_main();
|
||||
return;
|
||||
}
|
||||
#version 310 es
|
||||
|
||||
vec3 tint_saturate(vec3 v) {
|
||||
return clamp(v, vec3(0.0f), vec3(1.0f));
|
||||
}
|
||||
|
||||
void saturate_6bcddf() {
|
||||
vec3 res = tint_saturate(vec3(1.0f));
|
||||
}
|
||||
|
||||
void compute_main() {
|
||||
saturate_6bcddf();
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
compute_main();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
void saturate_6bcddf() {
|
||||
float3 res = saturate(float3(1.0f));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
saturate_6bcddf();
|
||||
return float4(0.0f);
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main() {
|
||||
float4 const inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
fragment void fragment_main() {
|
||||
saturate_6bcddf();
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main() {
|
||||
saturate_6bcddf();
|
||||
return;
|
||||
}
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 39
|
||||
; 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"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %tint_saturate "tint_saturate"
|
||||
OpName %v "v"
|
||||
OpName %saturate_6bcddf "saturate_6bcddf"
|
||||
OpName %res "res"
|
||||
OpName %vertex_main_inner "vertex_main_inner"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%8 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||
%v3float = OpTypeVector %float 3
|
||||
%9 = OpTypeFunction %v3float %v3float
|
||||
%16 = OpConstantNull %v3float
|
||||
%float_1 = OpConstant %float 1
|
||||
%18 = OpConstantComposite %v3float %float_1 %float_1 %float_1
|
||||
%void = OpTypeVoid
|
||||
%19 = OpTypeFunction %void
|
||||
%_ptr_Function_v3float = OpTypePointer Function %v3float
|
||||
%26 = OpTypeFunction %v4float
|
||||
%tint_saturate = OpFunction %v3float None %9
|
||||
%v = OpFunctionParameter %v3float
|
||||
%13 = OpLabel
|
||||
%14 = OpExtInst %v3float %15 NClamp %v %16 %18
|
||||
OpReturnValue %14
|
||||
OpFunctionEnd
|
||||
%saturate_6bcddf = OpFunction %void None %19
|
||||
%22 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_v3float Function %16
|
||||
%23 = OpFunctionCall %v3float %tint_saturate %18
|
||||
OpStore %res %23
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %26
|
||||
%28 = OpLabel
|
||||
%29 = OpFunctionCall %void %saturate_6bcddf
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %19
|
||||
%31 = OpLabel
|
||||
%32 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %32
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %19
|
||||
%34 = OpLabel
|
||||
%35 = OpFunctionCall %void %saturate_6bcddf
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %19
|
||||
%37 = OpLabel
|
||||
%38 = OpFunctionCall %void %saturate_6bcddf
|
||||
OpReturn
|
||||
OpFunctionEnd
|
|
@ -0,0 +1,19 @@
|
|||
fn saturate_6bcddf() {
|
||||
var res : vec3<f32> = saturate(vec3<f32>(1.0f));
|
||||
}
|
||||
|
||||
@vertex
|
||||
fn vertex_main() -> @builtin(position) vec4<f32> {
|
||||
saturate_6bcddf();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn fragment_main() {
|
||||
saturate_6bcddf();
|
||||
}
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn compute_main() {
|
||||
saturate_6bcddf();
|
||||
}
|
|
@ -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 saturate(vec<4, f32>) -> vec<4, f32>
|
||||
fn saturate_a5b571() {
|
||||
var res: vec4<f32> = saturate(vec4<f32>(1.f));
|
||||
}
|
||||
|
||||
@vertex
|
||||
fn vertex_main() -> @builtin(position) vec4<f32> {
|
||||
saturate_a5b571();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn fragment_main() {
|
||||
saturate_a5b571();
|
||||
}
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn compute_main() {
|
||||
saturate_a5b571();
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
void saturate_a5b571() {
|
||||
float4 res = saturate((1.0f).xxxx);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
saturate_a5b571();
|
||||
return (0.0f).xxxx;
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
saturate_a5b571();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
saturate_a5b571();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
void saturate_a5b571() {
|
||||
float4 res = saturate((1.0f).xxxx);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
saturate_a5b571();
|
||||
return (0.0f).xxxx;
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
saturate_a5b571();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
saturate_a5b571();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
#version 310 es
|
||||
|
||||
vec4 tint_saturate(vec4 v) {
|
||||
return clamp(v, vec4(0.0f), vec4(1.0f));
|
||||
}
|
||||
|
||||
void saturate_a5b571() {
|
||||
vec4 res = tint_saturate(vec4(1.0f));
|
||||
}
|
||||
|
||||
vec4 vertex_main() {
|
||||
saturate_a5b571();
|
||||
return vec4(0.0f);
|
||||
}
|
||||
|
||||
void main() {
|
||||
gl_PointSize = 1.0;
|
||||
vec4 inner_result = vertex_main();
|
||||
gl_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;
|
||||
|
||||
vec4 tint_saturate(vec4 v) {
|
||||
return clamp(v, vec4(0.0f), vec4(1.0f));
|
||||
}
|
||||
|
||||
void saturate_a5b571() {
|
||||
vec4 res = tint_saturate(vec4(1.0f));
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
saturate_a5b571();
|
||||
}
|
||||
|
||||
void main() {
|
||||
fragment_main();
|
||||
return;
|
||||
}
|
||||
#version 310 es
|
||||
|
||||
vec4 tint_saturate(vec4 v) {
|
||||
return clamp(v, vec4(0.0f), vec4(1.0f));
|
||||
}
|
||||
|
||||
void saturate_a5b571() {
|
||||
vec4 res = tint_saturate(vec4(1.0f));
|
||||
}
|
||||
|
||||
void compute_main() {
|
||||
saturate_a5b571();
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
compute_main();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
void saturate_a5b571() {
|
||||
float4 res = saturate(float4(1.0f));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
saturate_a5b571();
|
||||
return float4(0.0f);
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main() {
|
||||
float4 const inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
fragment void fragment_main() {
|
||||
saturate_a5b571();
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main() {
|
||||
saturate_a5b571();
|
||||
return;
|
||||
}
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 37
|
||||
; 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"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %tint_saturate "tint_saturate"
|
||||
OpName %v "v"
|
||||
OpName %saturate_a5b571 "saturate_a5b571"
|
||||
OpName %res "res"
|
||||
OpName %vertex_main_inner "vertex_main_inner"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%8 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||
%9 = OpTypeFunction %v4float %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
|
||||
%void = OpTypeVoid
|
||||
%17 = OpTypeFunction %void
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%24 = OpTypeFunction %v4float
|
||||
%tint_saturate = OpFunction %v4float None %9
|
||||
%v = OpFunctionParameter %v4float
|
||||
%12 = OpLabel
|
||||
%13 = OpExtInst %v4float %14 NClamp %v %5 %16
|
||||
OpReturnValue %13
|
||||
OpFunctionEnd
|
||||
%saturate_a5b571 = OpFunction %void None %17
|
||||
%20 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_v4float Function %5
|
||||
%21 = OpFunctionCall %v4float %tint_saturate %16
|
||||
OpStore %res %21
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %24
|
||||
%26 = OpLabel
|
||||
%27 = OpFunctionCall %void %saturate_a5b571
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %17
|
||||
%29 = OpLabel
|
||||
%30 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %30
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %17
|
||||
%32 = OpLabel
|
||||
%33 = OpFunctionCall %void %saturate_a5b571
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %17
|
||||
%35 = OpLabel
|
||||
%36 = OpFunctionCall %void %saturate_a5b571
|
||||
OpReturn
|
||||
OpFunctionEnd
|
|
@ -0,0 +1,19 @@
|
|||
fn saturate_a5b571() {
|
||||
var res : vec4<f32> = saturate(vec4<f32>(1.0f));
|
||||
}
|
||||
|
||||
@vertex
|
||||
fn vertex_main() -> @builtin(position) vec4<f32> {
|
||||
saturate_a5b571();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn fragment_main() {
|
||||
saturate_a5b571();
|
||||
}
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn compute_main() {
|
||||
saturate_a5b571();
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
// Copyright 2022 The Tint Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// File generated by tools/src/cmd/gen
|
||||
// using the template:
|
||||
// test/tint/builtins/gen/gen.wgsl.tmpl
|
||||
//
|
||||
// Do not modify this file directly
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
enable f16;
|
||||
|
||||
// fn saturate(vec<2, f16>) -> vec<2, f16>
|
||||
fn saturate_cd2028() {
|
||||
var res: vec2<f16> = saturate(vec2<f16>(f16()));
|
||||
}
|
||||
|
||||
@vertex
|
||||
fn vertex_main() -> @builtin(position) vec4<f32> {
|
||||
saturate_cd2028();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn fragment_main() {
|
||||
saturate_cd2028();
|
||||
}
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn compute_main() {
|
||||
saturate_cd2028();
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
void saturate_cd2028() {
|
||||
vector<float16_t, 2> res = saturate((float16_t(0.0h)).xx);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
saturate_cd2028();
|
||||
return (0.0f).xxxx;
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
saturate_cd2028();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
saturate_cd2028();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
SKIP: FAILED - f16 not supported with FXC
|
||||
|
||||
void saturate_cd2028() {
|
||||
vector<float16_t, 2> res = saturate((float16_t(0.0h)).xx);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
saturate_cd2028();
|
||||
return (0.0f).xxxx;
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
saturate_cd2028();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
saturate_cd2028();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
#version 310 es
|
||||
#extension GL_AMD_gpu_shader_half_float : require
|
||||
|
||||
f16vec2 tint_saturate(f16vec2 v) {
|
||||
return clamp(v, f16vec2(0.0hf), f16vec2(1.0hf));
|
||||
}
|
||||
|
||||
void saturate_cd2028() {
|
||||
f16vec2 res = tint_saturate(f16vec2(0.0hf));
|
||||
}
|
||||
|
||||
vec4 vertex_main() {
|
||||
saturate_cd2028();
|
||||
return vec4(0.0f);
|
||||
}
|
||||
|
||||
void main() {
|
||||
gl_PointSize = 1.0;
|
||||
vec4 inner_result = vertex_main();
|
||||
gl_Position = inner_result;
|
||||
gl_Position.y = -(gl_Position.y);
|
||||
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
|
||||
return;
|
||||
}
|
||||
#version 310 es
|
||||
#extension GL_AMD_gpu_shader_half_float : require
|
||||
precision mediump float;
|
||||
|
||||
f16vec2 tint_saturate(f16vec2 v) {
|
||||
return clamp(v, f16vec2(0.0hf), f16vec2(1.0hf));
|
||||
}
|
||||
|
||||
void saturate_cd2028() {
|
||||
f16vec2 res = tint_saturate(f16vec2(0.0hf));
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
saturate_cd2028();
|
||||
}
|
||||
|
||||
void main() {
|
||||
fragment_main();
|
||||
return;
|
||||
}
|
||||
#version 310 es
|
||||
#extension GL_AMD_gpu_shader_half_float : require
|
||||
|
||||
f16vec2 tint_saturate(f16vec2 v) {
|
||||
return clamp(v, f16vec2(0.0hf), f16vec2(1.0hf));
|
||||
}
|
||||
|
||||
void saturate_cd2028() {
|
||||
f16vec2 res = tint_saturate(f16vec2(0.0hf));
|
||||
}
|
||||
|
||||
void compute_main() {
|
||||
saturate_cd2028();
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
compute_main();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
void saturate_cd2028() {
|
||||
half2 res = saturate(half2(0.0h));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
saturate_cd2028();
|
||||
return float4(0.0f);
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main() {
|
||||
float4 const inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
fragment void fragment_main() {
|
||||
saturate_cd2028();
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main() {
|
||||
saturate_cd2028();
|
||||
return;
|
||||
}
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 41
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpCapability Float16
|
||||
OpCapability UniformAndStorageBuffer16BitAccess
|
||||
OpCapability StorageBuffer16BitAccess
|
||||
OpCapability StorageInputOutput16
|
||||
%16 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %tint_saturate "tint_saturate"
|
||||
OpName %v "v"
|
||||
OpName %saturate_cd2028 "saturate_cd2028"
|
||||
OpName %res "res"
|
||||
OpName %vertex_main_inner "vertex_main_inner"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%8 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||
%half = OpTypeFloat 16
|
||||
%v2half = OpTypeVector %half 2
|
||||
%9 = OpTypeFunction %v2half %v2half
|
||||
%17 = OpConstantNull %v2half
|
||||
%half_0x1p_0 = OpConstant %half 0x1p+0
|
||||
%19 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_0
|
||||
%void = OpTypeVoid
|
||||
%20 = OpTypeFunction %void
|
||||
%_ptr_Function_v2half = OpTypePointer Function %v2half
|
||||
%27 = OpTypeFunction %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%tint_saturate = OpFunction %v2half None %9
|
||||
%v = OpFunctionParameter %v2half
|
||||
%14 = OpLabel
|
||||
%15 = OpExtInst %v2half %16 NClamp %v %17 %19
|
||||
OpReturnValue %15
|
||||
OpFunctionEnd
|
||||
%saturate_cd2028 = OpFunction %void None %20
|
||||
%23 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_v2half Function %17
|
||||
%24 = OpFunctionCall %v2half %tint_saturate %17
|
||||
OpStore %res %24
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %27
|
||||
%29 = OpLabel
|
||||
%30 = OpFunctionCall %void %saturate_cd2028
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %20
|
||||
%32 = OpLabel
|
||||
%33 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %33
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %20
|
||||
%36 = OpLabel
|
||||
%37 = OpFunctionCall %void %saturate_cd2028
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %20
|
||||
%39 = OpLabel
|
||||
%40 = OpFunctionCall %void %saturate_cd2028
|
||||
OpReturn
|
||||
OpFunctionEnd
|
|
@ -0,0 +1,21 @@
|
|||
enable f16;
|
||||
|
||||
fn saturate_cd2028() {
|
||||
var res : vec2<f16> = saturate(vec2<f16>(f16()));
|
||||
}
|
||||
|
||||
@vertex
|
||||
fn vertex_main() -> @builtin(position) vec4<f32> {
|
||||
saturate_cd2028();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn fragment_main() {
|
||||
saturate_cd2028();
|
||||
}
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn compute_main() {
|
||||
saturate_cd2028();
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
// Copyright 2022 The Tint Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// File generated by tools/src/cmd/gen
|
||||
// using the template:
|
||||
// test/tint/builtins/gen/gen.wgsl.tmpl
|
||||
//
|
||||
// Do not modify this file directly
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
enable f16;
|
||||
|
||||
// fn saturate(vec<4, f16>) -> vec<4, f16>
|
||||
fn saturate_dcde71() {
|
||||
var res: vec4<f16> = saturate(vec4<f16>(f16()));
|
||||
}
|
||||
|
||||
@vertex
|
||||
fn vertex_main() -> @builtin(position) vec4<f32> {
|
||||
saturate_dcde71();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn fragment_main() {
|
||||
saturate_dcde71();
|
||||
}
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn compute_main() {
|
||||
saturate_dcde71();
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
void saturate_dcde71() {
|
||||
vector<float16_t, 4> res = saturate((float16_t(0.0h)).xxxx);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
saturate_dcde71();
|
||||
return (0.0f).xxxx;
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
saturate_dcde71();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
saturate_dcde71();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
SKIP: FAILED - f16 not supported with FXC
|
||||
|
||||
void saturate_dcde71() {
|
||||
vector<float16_t, 4> res = saturate((float16_t(0.0h)).xxxx);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
saturate_dcde71();
|
||||
return (0.0f).xxxx;
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
saturate_dcde71();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
saturate_dcde71();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
#version 310 es
|
||||
#extension GL_AMD_gpu_shader_half_float : require
|
||||
|
||||
f16vec4 tint_saturate(f16vec4 v) {
|
||||
return clamp(v, f16vec4(0.0hf), f16vec4(1.0hf));
|
||||
}
|
||||
|
||||
void saturate_dcde71() {
|
||||
f16vec4 res = tint_saturate(f16vec4(0.0hf));
|
||||
}
|
||||
|
||||
vec4 vertex_main() {
|
||||
saturate_dcde71();
|
||||
return vec4(0.0f);
|
||||
}
|
||||
|
||||
void main() {
|
||||
gl_PointSize = 1.0;
|
||||
vec4 inner_result = vertex_main();
|
||||
gl_Position = inner_result;
|
||||
gl_Position.y = -(gl_Position.y);
|
||||
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
|
||||
return;
|
||||
}
|
||||
#version 310 es
|
||||
#extension GL_AMD_gpu_shader_half_float : require
|
||||
precision mediump float;
|
||||
|
||||
f16vec4 tint_saturate(f16vec4 v) {
|
||||
return clamp(v, f16vec4(0.0hf), f16vec4(1.0hf));
|
||||
}
|
||||
|
||||
void saturate_dcde71() {
|
||||
f16vec4 res = tint_saturate(f16vec4(0.0hf));
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
saturate_dcde71();
|
||||
}
|
||||
|
||||
void main() {
|
||||
fragment_main();
|
||||
return;
|
||||
}
|
||||
#version 310 es
|
||||
#extension GL_AMD_gpu_shader_half_float : require
|
||||
|
||||
f16vec4 tint_saturate(f16vec4 v) {
|
||||
return clamp(v, f16vec4(0.0hf), f16vec4(1.0hf));
|
||||
}
|
||||
|
||||
void saturate_dcde71() {
|
||||
f16vec4 res = tint_saturate(f16vec4(0.0hf));
|
||||
}
|
||||
|
||||
void compute_main() {
|
||||
saturate_dcde71();
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
compute_main();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
void saturate_dcde71() {
|
||||
half4 res = saturate(half4(0.0h));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
saturate_dcde71();
|
||||
return float4(0.0f);
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main() {
|
||||
float4 const inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
fragment void fragment_main() {
|
||||
saturate_dcde71();
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main() {
|
||||
saturate_dcde71();
|
||||
return;
|
||||
}
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 41
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpCapability Float16
|
||||
OpCapability UniformAndStorageBuffer16BitAccess
|
||||
OpCapability StorageBuffer16BitAccess
|
||||
OpCapability StorageInputOutput16
|
||||
%16 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %tint_saturate "tint_saturate"
|
||||
OpName %v "v"
|
||||
OpName %saturate_dcde71 "saturate_dcde71"
|
||||
OpName %res "res"
|
||||
OpName %vertex_main_inner "vertex_main_inner"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%8 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||
%half = OpTypeFloat 16
|
||||
%v4half = OpTypeVector %half 4
|
||||
%9 = OpTypeFunction %v4half %v4half
|
||||
%17 = OpConstantNull %v4half
|
||||
%half_0x1p_0 = OpConstant %half 0x1p+0
|
||||
%19 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 %half_0x1p_0
|
||||
%void = OpTypeVoid
|
||||
%20 = OpTypeFunction %void
|
||||
%_ptr_Function_v4half = OpTypePointer Function %v4half
|
||||
%27 = OpTypeFunction %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%tint_saturate = OpFunction %v4half None %9
|
||||
%v = OpFunctionParameter %v4half
|
||||
%14 = OpLabel
|
||||
%15 = OpExtInst %v4half %16 NClamp %v %17 %19
|
||||
OpReturnValue %15
|
||||
OpFunctionEnd
|
||||
%saturate_dcde71 = OpFunction %void None %20
|
||||
%23 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_v4half Function %17
|
||||
%24 = OpFunctionCall %v4half %tint_saturate %17
|
||||
OpStore %res %24
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %27
|
||||
%29 = OpLabel
|
||||
%30 = OpFunctionCall %void %saturate_dcde71
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %20
|
||||
%32 = OpLabel
|
||||
%33 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %33
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %20
|
||||
%36 = OpLabel
|
||||
%37 = OpFunctionCall %void %saturate_dcde71
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %20
|
||||
%39 = OpLabel
|
||||
%40 = OpFunctionCall %void %saturate_dcde71
|
||||
OpReturn
|
||||
OpFunctionEnd
|
|
@ -0,0 +1,21 @@
|
|||
enable f16;
|
||||
|
||||
fn saturate_dcde71() {
|
||||
var res : vec4<f16> = saturate(vec4<f16>(f16()));
|
||||
}
|
||||
|
||||
@vertex
|
||||
fn vertex_main() -> @builtin(position) vec4<f32> {
|
||||
saturate_dcde71();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn fragment_main() {
|
||||
saturate_dcde71();
|
||||
}
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn compute_main() {
|
||||
saturate_dcde71();
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
// Copyright 2022 The Tint Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// File generated by tools/src/cmd/gen
|
||||
// using the template:
|
||||
// test/tint/builtins/gen/gen.wgsl.tmpl
|
||||
//
|
||||
// Do not modify this file directly
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
enable f16;
|
||||
|
||||
// fn saturate(f16) -> f16
|
||||
fn saturate_e8df56() {
|
||||
var res: f16 = saturate(f16());
|
||||
}
|
||||
|
||||
@vertex
|
||||
fn vertex_main() -> @builtin(position) vec4<f32> {
|
||||
saturate_e8df56();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn fragment_main() {
|
||||
saturate_e8df56();
|
||||
}
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn compute_main() {
|
||||
saturate_e8df56();
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
void saturate_e8df56() {
|
||||
float16_t res = saturate(float16_t(0.0h));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
saturate_e8df56();
|
||||
return (0.0f).xxxx;
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
saturate_e8df56();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
saturate_e8df56();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
SKIP: FAILED - f16 not supported with FXC
|
||||
|
||||
void saturate_e8df56() {
|
||||
float16_t res = saturate(float16_t(0.0h));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
saturate_e8df56();
|
||||
return (0.0f).xxxx;
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
saturate_e8df56();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
saturate_e8df56();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
#version 310 es
|
||||
#extension GL_AMD_gpu_shader_half_float : require
|
||||
|
||||
float16_t tint_saturate(float16_t v) {
|
||||
return clamp(v, 0.0hf, 1.0hf);
|
||||
}
|
||||
|
||||
void saturate_e8df56() {
|
||||
float16_t res = tint_saturate(0.0hf);
|
||||
}
|
||||
|
||||
vec4 vertex_main() {
|
||||
saturate_e8df56();
|
||||
return vec4(0.0f);
|
||||
}
|
||||
|
||||
void main() {
|
||||
gl_PointSize = 1.0;
|
||||
vec4 inner_result = vertex_main();
|
||||
gl_Position = inner_result;
|
||||
gl_Position.y = -(gl_Position.y);
|
||||
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
|
||||
return;
|
||||
}
|
||||
#version 310 es
|
||||
#extension GL_AMD_gpu_shader_half_float : require
|
||||
precision mediump float;
|
||||
|
||||
float16_t tint_saturate(float16_t v) {
|
||||
return clamp(v, 0.0hf, 1.0hf);
|
||||
}
|
||||
|
||||
void saturate_e8df56() {
|
||||
float16_t res = tint_saturate(0.0hf);
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
saturate_e8df56();
|
||||
}
|
||||
|
||||
void main() {
|
||||
fragment_main();
|
||||
return;
|
||||
}
|
||||
#version 310 es
|
||||
#extension GL_AMD_gpu_shader_half_float : require
|
||||
|
||||
float16_t tint_saturate(float16_t v) {
|
||||
return clamp(v, 0.0hf, 1.0hf);
|
||||
}
|
||||
|
||||
void saturate_e8df56() {
|
||||
float16_t res = tint_saturate(0.0hf);
|
||||
}
|
||||
|
||||
void compute_main() {
|
||||
saturate_e8df56();
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
compute_main();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
void saturate_e8df56() {
|
||||
half res = saturate(0.0h);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
saturate_e8df56();
|
||||
return float4(0.0f);
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main() {
|
||||
float4 const inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
fragment void fragment_main() {
|
||||
saturate_e8df56();
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main() {
|
||||
saturate_e8df56();
|
||||
return;
|
||||
}
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 39
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpCapability Float16
|
||||
OpCapability UniformAndStorageBuffer16BitAccess
|
||||
OpCapability StorageBuffer16BitAccess
|
||||
OpCapability StorageInputOutput16
|
||||
%15 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %tint_saturate "tint_saturate"
|
||||
OpName %v "v"
|
||||
OpName %saturate_e8df56 "saturate_e8df56"
|
||||
OpName %res "res"
|
||||
OpName %vertex_main_inner "vertex_main_inner"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%8 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||
%half = OpTypeFloat 16
|
||||
%9 = OpTypeFunction %half %half
|
||||
%16 = OpConstantNull %half
|
||||
%half_0x1p_0 = OpConstant %half 0x1p+0
|
||||
%void = OpTypeVoid
|
||||
%18 = OpTypeFunction %void
|
||||
%_ptr_Function_half = OpTypePointer Function %half
|
||||
%25 = OpTypeFunction %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%tint_saturate = OpFunction %half None %9
|
||||
%v = OpFunctionParameter %half
|
||||
%13 = OpLabel
|
||||
%14 = OpExtInst %half %15 NClamp %v %16 %half_0x1p_0
|
||||
OpReturnValue %14
|
||||
OpFunctionEnd
|
||||
%saturate_e8df56 = OpFunction %void None %18
|
||||
%21 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_half Function %16
|
||||
%22 = OpFunctionCall %half %tint_saturate %16
|
||||
OpStore %res %22
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %25
|
||||
%27 = OpLabel
|
||||
%28 = OpFunctionCall %void %saturate_e8df56
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %18
|
||||
%30 = OpLabel
|
||||
%31 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %31
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %18
|
||||
%34 = OpLabel
|
||||
%35 = OpFunctionCall %void %saturate_e8df56
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %18
|
||||
%37 = OpLabel
|
||||
%38 = OpFunctionCall %void %saturate_e8df56
|
||||
OpReturn
|
||||
OpFunctionEnd
|
|
@ -0,0 +1,21 @@
|
|||
enable f16;
|
||||
|
||||
fn saturate_e8df56() {
|
||||
var res : f16 = saturate(f16());
|
||||
}
|
||||
|
||||
@vertex
|
||||
fn vertex_main() -> @builtin(position) vec4<f32> {
|
||||
saturate_e8df56();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn fragment_main() {
|
||||
saturate_e8df56();
|
||||
}
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn compute_main() {
|
||||
saturate_e8df56();
|
||||
}
|
|
@ -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 saturate(f32) -> f32
|
||||
fn saturate_270da5() {
|
||||
var arg_0 = 1.f;
|
||||
var res: f32 = saturate(arg_0);
|
||||
}
|
||||
|
||||
@vertex
|
||||
fn vertex_main() -> @builtin(position) vec4<f32> {
|
||||
saturate_270da5();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn fragment_main() {
|
||||
saturate_270da5();
|
||||
}
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn compute_main() {
|
||||
saturate_270da5();
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
void saturate_270da5() {
|
||||
float arg_0 = 1.0f;
|
||||
float res = saturate(arg_0);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
saturate_270da5();
|
||||
return (0.0f).xxxx;
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
saturate_270da5();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
saturate_270da5();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
void saturate_270da5() {
|
||||
float arg_0 = 1.0f;
|
||||
float res = saturate(arg_0);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
saturate_270da5();
|
||||
return (0.0f).xxxx;
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
saturate_270da5();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
saturate_270da5();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
#version 310 es
|
||||
|
||||
float tint_saturate(float v) {
|
||||
return clamp(v, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
void saturate_270da5() {
|
||||
float arg_0 = 1.0f;
|
||||
float res = tint_saturate(arg_0);
|
||||
}
|
||||
|
||||
vec4 vertex_main() {
|
||||
saturate_270da5();
|
||||
return vec4(0.0f);
|
||||
}
|
||||
|
||||
void main() {
|
||||
gl_PointSize = 1.0;
|
||||
vec4 inner_result = vertex_main();
|
||||
gl_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;
|
||||
|
||||
float tint_saturate(float v) {
|
||||
return clamp(v, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
void saturate_270da5() {
|
||||
float arg_0 = 1.0f;
|
||||
float res = tint_saturate(arg_0);
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
saturate_270da5();
|
||||
}
|
||||
|
||||
void main() {
|
||||
fragment_main();
|
||||
return;
|
||||
}
|
||||
#version 310 es
|
||||
|
||||
float tint_saturate(float v) {
|
||||
return clamp(v, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
void saturate_270da5() {
|
||||
float arg_0 = 1.0f;
|
||||
float res = tint_saturate(arg_0);
|
||||
}
|
||||
|
||||
void compute_main() {
|
||||
saturate_270da5();
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
compute_main();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
void saturate_270da5() {
|
||||
float arg_0 = 1.0f;
|
||||
float res = saturate(arg_0);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
saturate_270da5();
|
||||
return float4(0.0f);
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main() {
|
||||
float4 const inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
fragment void fragment_main() {
|
||||
saturate_270da5();
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main() {
|
||||
saturate_270da5();
|
||||
return;
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 38
|
||||
; 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"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %tint_saturate "tint_saturate"
|
||||
OpName %v "v"
|
||||
OpName %saturate_270da5 "saturate_270da5"
|
||||
OpName %arg_0 "arg_0"
|
||||
OpName %res "res"
|
||||
OpName %vertex_main_inner "vertex_main_inner"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%8 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||
%9 = OpTypeFunction %float %float
|
||||
%float_1 = OpConstant %float 1
|
||||
%void = OpTypeVoid
|
||||
%16 = OpTypeFunction %void
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%25 = OpTypeFunction %v4float
|
||||
%tint_saturate = OpFunction %float None %9
|
||||
%v = OpFunctionParameter %float
|
||||
%12 = OpLabel
|
||||
%13 = OpExtInst %float %14 NClamp %v %8 %float_1
|
||||
OpReturnValue %13
|
||||
OpFunctionEnd
|
||||
%saturate_270da5 = OpFunction %void None %16
|
||||
%19 = OpLabel
|
||||
%arg_0 = OpVariable %_ptr_Function_float Function %8
|
||||
%res = OpVariable %_ptr_Function_float Function %8
|
||||
OpStore %arg_0 %float_1
|
||||
%23 = OpLoad %float %arg_0
|
||||
%22 = OpFunctionCall %float %tint_saturate %23
|
||||
OpStore %res %22
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %25
|
||||
%27 = OpLabel
|
||||
%28 = OpFunctionCall %void %saturate_270da5
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %16
|
||||
%30 = OpLabel
|
||||
%31 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %31
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %16
|
||||
%33 = OpLabel
|
||||
%34 = OpFunctionCall %void %saturate_270da5
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %16
|
||||
%36 = OpLabel
|
||||
%37 = OpFunctionCall %void %saturate_270da5
|
||||
OpReturn
|
||||
OpFunctionEnd
|
|
@ -0,0 +1,20 @@
|
|||
fn saturate_270da5() {
|
||||
var arg_0 = 1.0f;
|
||||
var res : f32 = saturate(arg_0);
|
||||
}
|
||||
|
||||
@vertex
|
||||
fn vertex_main() -> @builtin(position) vec4<f32> {
|
||||
saturate_270da5();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn fragment_main() {
|
||||
saturate_270da5();
|
||||
}
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn compute_main() {
|
||||
saturate_270da5();
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
// Copyright 2022 The Tint Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// File generated by tools/src/cmd/gen
|
||||
// using the template:
|
||||
// test/tint/builtins/gen/gen.wgsl.tmpl
|
||||
//
|
||||
// Do not modify this file directly
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
enable f16;
|
||||
|
||||
// fn saturate(vec<3, f16>) -> vec<3, f16>
|
||||
fn saturate_462535() {
|
||||
var arg_0 = vec3<f16>(f16());
|
||||
var res: vec3<f16> = saturate(arg_0);
|
||||
}
|
||||
|
||||
@vertex
|
||||
fn vertex_main() -> @builtin(position) vec4<f32> {
|
||||
saturate_462535();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn fragment_main() {
|
||||
saturate_462535();
|
||||
}
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn compute_main() {
|
||||
saturate_462535();
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
void saturate_462535() {
|
||||
vector<float16_t, 3> arg_0 = (float16_t(0.0h)).xxx;
|
||||
vector<float16_t, 3> res = saturate(arg_0);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
saturate_462535();
|
||||
return (0.0f).xxxx;
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
saturate_462535();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
saturate_462535();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
SKIP: FAILED - f16 not supported with FXC
|
||||
|
||||
void saturate_462535() {
|
||||
vector<float16_t, 3> arg_0 = (float16_t(0.0h)).xxx;
|
||||
vector<float16_t, 3> res = saturate(arg_0);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
saturate_462535();
|
||||
return (0.0f).xxxx;
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
saturate_462535();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
saturate_462535();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
#version 310 es
|
||||
#extension GL_AMD_gpu_shader_half_float : require
|
||||
|
||||
f16vec3 tint_saturate(f16vec3 v) {
|
||||
return clamp(v, f16vec3(0.0hf), f16vec3(1.0hf));
|
||||
}
|
||||
|
||||
void saturate_462535() {
|
||||
f16vec3 arg_0 = f16vec3(0.0hf);
|
||||
f16vec3 res = tint_saturate(arg_0);
|
||||
}
|
||||
|
||||
vec4 vertex_main() {
|
||||
saturate_462535();
|
||||
return vec4(0.0f);
|
||||
}
|
||||
|
||||
void main() {
|
||||
gl_PointSize = 1.0;
|
||||
vec4 inner_result = vertex_main();
|
||||
gl_Position = inner_result;
|
||||
gl_Position.y = -(gl_Position.y);
|
||||
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
|
||||
return;
|
||||
}
|
||||
#version 310 es
|
||||
#extension GL_AMD_gpu_shader_half_float : require
|
||||
precision mediump float;
|
||||
|
||||
f16vec3 tint_saturate(f16vec3 v) {
|
||||
return clamp(v, f16vec3(0.0hf), f16vec3(1.0hf));
|
||||
}
|
||||
|
||||
void saturate_462535() {
|
||||
f16vec3 arg_0 = f16vec3(0.0hf);
|
||||
f16vec3 res = tint_saturate(arg_0);
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
saturate_462535();
|
||||
}
|
||||
|
||||
void main() {
|
||||
fragment_main();
|
||||
return;
|
||||
}
|
||||
#version 310 es
|
||||
#extension GL_AMD_gpu_shader_half_float : require
|
||||
|
||||
f16vec3 tint_saturate(f16vec3 v) {
|
||||
return clamp(v, f16vec3(0.0hf), f16vec3(1.0hf));
|
||||
}
|
||||
|
||||
void saturate_462535() {
|
||||
f16vec3 arg_0 = f16vec3(0.0hf);
|
||||
f16vec3 res = tint_saturate(arg_0);
|
||||
}
|
||||
|
||||
void compute_main() {
|
||||
saturate_462535();
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
compute_main();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
void saturate_462535() {
|
||||
half3 arg_0 = half3(0.0h);
|
||||
half3 res = saturate(arg_0);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
saturate_462535();
|
||||
return float4(0.0f);
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main() {
|
||||
float4 const inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
fragment void fragment_main() {
|
||||
saturate_462535();
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main() {
|
||||
saturate_462535();
|
||||
return;
|
||||
}
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 43
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpCapability Float16
|
||||
OpCapability UniformAndStorageBuffer16BitAccess
|
||||
OpCapability StorageBuffer16BitAccess
|
||||
OpCapability StorageInputOutput16
|
||||
%16 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %tint_saturate "tint_saturate"
|
||||
OpName %v "v"
|
||||
OpName %saturate_462535 "saturate_462535"
|
||||
OpName %arg_0 "arg_0"
|
||||
OpName %res "res"
|
||||
OpName %vertex_main_inner "vertex_main_inner"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%8 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||
%half = OpTypeFloat 16
|
||||
%v3half = OpTypeVector %half 3
|
||||
%9 = OpTypeFunction %v3half %v3half
|
||||
%17 = OpConstantNull %v3half
|
||||
%half_0x1p_0 = OpConstant %half 0x1p+0
|
||||
%19 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0
|
||||
%void = OpTypeVoid
|
||||
%20 = OpTypeFunction %void
|
||||
%_ptr_Function_v3half = OpTypePointer Function %v3half
|
||||
%29 = OpTypeFunction %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%tint_saturate = OpFunction %v3half None %9
|
||||
%v = OpFunctionParameter %v3half
|
||||
%14 = OpLabel
|
||||
%15 = OpExtInst %v3half %16 NClamp %v %17 %19
|
||||
OpReturnValue %15
|
||||
OpFunctionEnd
|
||||
%saturate_462535 = OpFunction %void None %20
|
||||
%23 = OpLabel
|
||||
%arg_0 = OpVariable %_ptr_Function_v3half Function %17
|
||||
%res = OpVariable %_ptr_Function_v3half Function %17
|
||||
OpStore %arg_0 %17
|
||||
%27 = OpLoad %v3half %arg_0
|
||||
%26 = OpFunctionCall %v3half %tint_saturate %27
|
||||
OpStore %res %26
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %29
|
||||
%31 = OpLabel
|
||||
%32 = OpFunctionCall %void %saturate_462535
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %20
|
||||
%34 = OpLabel
|
||||
%35 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %35
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %20
|
||||
%38 = OpLabel
|
||||
%39 = OpFunctionCall %void %saturate_462535
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %20
|
||||
%41 = OpLabel
|
||||
%42 = OpFunctionCall %void %saturate_462535
|
||||
OpReturn
|
||||
OpFunctionEnd
|
|
@ -0,0 +1,22 @@
|
|||
enable f16;
|
||||
|
||||
fn saturate_462535() {
|
||||
var arg_0 = vec3<f16>(f16());
|
||||
var res : vec3<f16> = saturate(arg_0);
|
||||
}
|
||||
|
||||
@vertex
|
||||
fn vertex_main() -> @builtin(position) vec4<f32> {
|
||||
saturate_462535();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn fragment_main() {
|
||||
saturate_462535();
|
||||
}
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn compute_main() {
|
||||
saturate_462535();
|
||||
}
|
|
@ -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 saturate(vec<2, f32>) -> vec<2, f32>
|
||||
fn saturate_51567f() {
|
||||
var arg_0 = vec2<f32>(1.f);
|
||||
var res: vec2<f32> = saturate(arg_0);
|
||||
}
|
||||
|
||||
@vertex
|
||||
fn vertex_main() -> @builtin(position) vec4<f32> {
|
||||
saturate_51567f();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn fragment_main() {
|
||||
saturate_51567f();
|
||||
}
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn compute_main() {
|
||||
saturate_51567f();
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
void saturate_51567f() {
|
||||
float2 arg_0 = (1.0f).xx;
|
||||
float2 res = saturate(arg_0);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
saturate_51567f();
|
||||
return (0.0f).xxxx;
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
saturate_51567f();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
saturate_51567f();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
void saturate_51567f() {
|
||||
float2 arg_0 = (1.0f).xx;
|
||||
float2 res = saturate(arg_0);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
saturate_51567f();
|
||||
return (0.0f).xxxx;
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
saturate_51567f();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
saturate_51567f();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
#version 310 es
|
||||
|
||||
vec2 tint_saturate(vec2 v) {
|
||||
return clamp(v, vec2(0.0f), vec2(1.0f));
|
||||
}
|
||||
|
||||
void saturate_51567f() {
|
||||
vec2 arg_0 = vec2(1.0f);
|
||||
vec2 res = tint_saturate(arg_0);
|
||||
}
|
||||
|
||||
vec4 vertex_main() {
|
||||
saturate_51567f();
|
||||
return vec4(0.0f);
|
||||
}
|
||||
|
||||
void main() {
|
||||
gl_PointSize = 1.0;
|
||||
vec4 inner_result = vertex_main();
|
||||
gl_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;
|
||||
|
||||
vec2 tint_saturate(vec2 v) {
|
||||
return clamp(v, vec2(0.0f), vec2(1.0f));
|
||||
}
|
||||
|
||||
void saturate_51567f() {
|
||||
vec2 arg_0 = vec2(1.0f);
|
||||
vec2 res = tint_saturate(arg_0);
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
saturate_51567f();
|
||||
}
|
||||
|
||||
void main() {
|
||||
fragment_main();
|
||||
return;
|
||||
}
|
||||
#version 310 es
|
||||
|
||||
vec2 tint_saturate(vec2 v) {
|
||||
return clamp(v, vec2(0.0f), vec2(1.0f));
|
||||
}
|
||||
|
||||
void saturate_51567f() {
|
||||
vec2 arg_0 = vec2(1.0f);
|
||||
vec2 res = tint_saturate(arg_0);
|
||||
}
|
||||
|
||||
void compute_main() {
|
||||
saturate_51567f();
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
compute_main();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
void saturate_51567f() {
|
||||
float2 arg_0 = float2(1.0f);
|
||||
float2 res = saturate(arg_0);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
saturate_51567f();
|
||||
return float4(0.0f);
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main() {
|
||||
float4 const inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
fragment void fragment_main() {
|
||||
saturate_51567f();
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main() {
|
||||
saturate_51567f();
|
||||
return;
|
||||
}
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 41
|
||||
; 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"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %tint_saturate "tint_saturate"
|
||||
OpName %v "v"
|
||||
OpName %saturate_51567f "saturate_51567f"
|
||||
OpName %arg_0 "arg_0"
|
||||
OpName %res "res"
|
||||
OpName %vertex_main_inner "vertex_main_inner"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%8 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||
%v2float = OpTypeVector %float 2
|
||||
%9 = OpTypeFunction %v2float %v2float
|
||||
%16 = OpConstantNull %v2float
|
||||
%float_1 = OpConstant %float 1
|
||||
%18 = OpConstantComposite %v2float %float_1 %float_1
|
||||
%void = OpTypeVoid
|
||||
%19 = OpTypeFunction %void
|
||||
%_ptr_Function_v2float = OpTypePointer Function %v2float
|
||||
%28 = OpTypeFunction %v4float
|
||||
%tint_saturate = OpFunction %v2float None %9
|
||||
%v = OpFunctionParameter %v2float
|
||||
%13 = OpLabel
|
||||
%14 = OpExtInst %v2float %15 NClamp %v %16 %18
|
||||
OpReturnValue %14
|
||||
OpFunctionEnd
|
||||
%saturate_51567f = OpFunction %void None %19
|
||||
%22 = OpLabel
|
||||
%arg_0 = OpVariable %_ptr_Function_v2float Function %16
|
||||
%res = OpVariable %_ptr_Function_v2float Function %16
|
||||
OpStore %arg_0 %18
|
||||
%26 = OpLoad %v2float %arg_0
|
||||
%25 = OpFunctionCall %v2float %tint_saturate %26
|
||||
OpStore %res %25
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %28
|
||||
%30 = OpLabel
|
||||
%31 = OpFunctionCall %void %saturate_51567f
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %19
|
||||
%33 = OpLabel
|
||||
%34 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %34
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %19
|
||||
%36 = OpLabel
|
||||
%37 = OpFunctionCall %void %saturate_51567f
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %19
|
||||
%39 = OpLabel
|
||||
%40 = OpFunctionCall %void %saturate_51567f
|
||||
OpReturn
|
||||
OpFunctionEnd
|
|
@ -0,0 +1,20 @@
|
|||
fn saturate_51567f() {
|
||||
var arg_0 = vec2<f32>(1.0f);
|
||||
var res : vec2<f32> = saturate(arg_0);
|
||||
}
|
||||
|
||||
@vertex
|
||||
fn vertex_main() -> @builtin(position) vec4<f32> {
|
||||
saturate_51567f();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn fragment_main() {
|
||||
saturate_51567f();
|
||||
}
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn compute_main() {
|
||||
saturate_51567f();
|
||||
}
|
|
@ -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 saturate(vec<3, f32>) -> vec<3, f32>
|
||||
fn saturate_6bcddf() {
|
||||
var arg_0 = vec3<f32>(1.f);
|
||||
var res: vec3<f32> = saturate(arg_0);
|
||||
}
|
||||
|
||||
@vertex
|
||||
fn vertex_main() -> @builtin(position) vec4<f32> {
|
||||
saturate_6bcddf();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn fragment_main() {
|
||||
saturate_6bcddf();
|
||||
}
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn compute_main() {
|
||||
saturate_6bcddf();
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
void saturate_6bcddf() {
|
||||
float3 arg_0 = (1.0f).xxx;
|
||||
float3 res = saturate(arg_0);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
saturate_6bcddf();
|
||||
return (0.0f).xxxx;
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
saturate_6bcddf();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
saturate_6bcddf();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
void saturate_6bcddf() {
|
||||
float3 arg_0 = (1.0f).xxx;
|
||||
float3 res = saturate(arg_0);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
saturate_6bcddf();
|
||||
return (0.0f).xxxx;
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
saturate_6bcddf();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
saturate_6bcddf();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
#version 310 es
|
||||
|
||||
vec3 tint_saturate(vec3 v) {
|
||||
return clamp(v, vec3(0.0f), vec3(1.0f));
|
||||
}
|
||||
|
||||
void saturate_6bcddf() {
|
||||
vec3 arg_0 = vec3(1.0f);
|
||||
vec3 res = tint_saturate(arg_0);
|
||||
}
|
||||
|
||||
vec4 vertex_main() {
|
||||
saturate_6bcddf();
|
||||
return vec4(0.0f);
|
||||
}
|
||||
|
||||
void main() {
|
||||
gl_PointSize = 1.0;
|
||||
vec4 inner_result = vertex_main();
|
||||
gl_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;
|
||||
|
||||
vec3 tint_saturate(vec3 v) {
|
||||
return clamp(v, vec3(0.0f), vec3(1.0f));
|
||||
}
|
||||
|
||||
void saturate_6bcddf() {
|
||||
vec3 arg_0 = vec3(1.0f);
|
||||
vec3 res = tint_saturate(arg_0);
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
saturate_6bcddf();
|
||||
}
|
||||
|
||||
void main() {
|
||||
fragment_main();
|
||||
return;
|
||||
}
|
||||
#version 310 es
|
||||
|
||||
vec3 tint_saturate(vec3 v) {
|
||||
return clamp(v, vec3(0.0f), vec3(1.0f));
|
||||
}
|
||||
|
||||
void saturate_6bcddf() {
|
||||
vec3 arg_0 = vec3(1.0f);
|
||||
vec3 res = tint_saturate(arg_0);
|
||||
}
|
||||
|
||||
void compute_main() {
|
||||
saturate_6bcddf();
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
compute_main();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
void saturate_6bcddf() {
|
||||
float3 arg_0 = float3(1.0f);
|
||||
float3 res = saturate(arg_0);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
saturate_6bcddf();
|
||||
return float4(0.0f);
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main() {
|
||||
float4 const inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
fragment void fragment_main() {
|
||||
saturate_6bcddf();
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main() {
|
||||
saturate_6bcddf();
|
||||
return;
|
||||
}
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 41
|
||||
; 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"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %tint_saturate "tint_saturate"
|
||||
OpName %v "v"
|
||||
OpName %saturate_6bcddf "saturate_6bcddf"
|
||||
OpName %arg_0 "arg_0"
|
||||
OpName %res "res"
|
||||
OpName %vertex_main_inner "vertex_main_inner"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%8 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||
%v3float = OpTypeVector %float 3
|
||||
%9 = OpTypeFunction %v3float %v3float
|
||||
%16 = OpConstantNull %v3float
|
||||
%float_1 = OpConstant %float 1
|
||||
%18 = OpConstantComposite %v3float %float_1 %float_1 %float_1
|
||||
%void = OpTypeVoid
|
||||
%19 = OpTypeFunction %void
|
||||
%_ptr_Function_v3float = OpTypePointer Function %v3float
|
||||
%28 = OpTypeFunction %v4float
|
||||
%tint_saturate = OpFunction %v3float None %9
|
||||
%v = OpFunctionParameter %v3float
|
||||
%13 = OpLabel
|
||||
%14 = OpExtInst %v3float %15 NClamp %v %16 %18
|
||||
OpReturnValue %14
|
||||
OpFunctionEnd
|
||||
%saturate_6bcddf = OpFunction %void None %19
|
||||
%22 = OpLabel
|
||||
%arg_0 = OpVariable %_ptr_Function_v3float Function %16
|
||||
%res = OpVariable %_ptr_Function_v3float Function %16
|
||||
OpStore %arg_0 %18
|
||||
%26 = OpLoad %v3float %arg_0
|
||||
%25 = OpFunctionCall %v3float %tint_saturate %26
|
||||
OpStore %res %25
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %28
|
||||
%30 = OpLabel
|
||||
%31 = OpFunctionCall %void %saturate_6bcddf
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %19
|
||||
%33 = OpLabel
|
||||
%34 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %34
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %19
|
||||
%36 = OpLabel
|
||||
%37 = OpFunctionCall %void %saturate_6bcddf
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %19
|
||||
%39 = OpLabel
|
||||
%40 = OpFunctionCall %void %saturate_6bcddf
|
||||
OpReturn
|
||||
OpFunctionEnd
|
|
@ -0,0 +1,20 @@
|
|||
fn saturate_6bcddf() {
|
||||
var arg_0 = vec3<f32>(1.0f);
|
||||
var res : vec3<f32> = saturate(arg_0);
|
||||
}
|
||||
|
||||
@vertex
|
||||
fn vertex_main() -> @builtin(position) vec4<f32> {
|
||||
saturate_6bcddf();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn fragment_main() {
|
||||
saturate_6bcddf();
|
||||
}
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn compute_main() {
|
||||
saturate_6bcddf();
|
||||
}
|
|
@ -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 saturate(vec<4, f32>) -> vec<4, f32>
|
||||
fn saturate_a5b571() {
|
||||
var arg_0 = vec4<f32>(1.f);
|
||||
var res: vec4<f32> = saturate(arg_0);
|
||||
}
|
||||
|
||||
@vertex
|
||||
fn vertex_main() -> @builtin(position) vec4<f32> {
|
||||
saturate_a5b571();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn fragment_main() {
|
||||
saturate_a5b571();
|
||||
}
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn compute_main() {
|
||||
saturate_a5b571();
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
void saturate_a5b571() {
|
||||
float4 arg_0 = (1.0f).xxxx;
|
||||
float4 res = saturate(arg_0);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
saturate_a5b571();
|
||||
return (0.0f).xxxx;
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
saturate_a5b571();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
saturate_a5b571();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
void saturate_a5b571() {
|
||||
float4 arg_0 = (1.0f).xxxx;
|
||||
float4 res = saturate(arg_0);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
saturate_a5b571();
|
||||
return (0.0f).xxxx;
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
saturate_a5b571();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
saturate_a5b571();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
#version 310 es
|
||||
|
||||
vec4 tint_saturate(vec4 v) {
|
||||
return clamp(v, vec4(0.0f), vec4(1.0f));
|
||||
}
|
||||
|
||||
void saturate_a5b571() {
|
||||
vec4 arg_0 = vec4(1.0f);
|
||||
vec4 res = tint_saturate(arg_0);
|
||||
}
|
||||
|
||||
vec4 vertex_main() {
|
||||
saturate_a5b571();
|
||||
return vec4(0.0f);
|
||||
}
|
||||
|
||||
void main() {
|
||||
gl_PointSize = 1.0;
|
||||
vec4 inner_result = vertex_main();
|
||||
gl_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;
|
||||
|
||||
vec4 tint_saturate(vec4 v) {
|
||||
return clamp(v, vec4(0.0f), vec4(1.0f));
|
||||
}
|
||||
|
||||
void saturate_a5b571() {
|
||||
vec4 arg_0 = vec4(1.0f);
|
||||
vec4 res = tint_saturate(arg_0);
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
saturate_a5b571();
|
||||
}
|
||||
|
||||
void main() {
|
||||
fragment_main();
|
||||
return;
|
||||
}
|
||||
#version 310 es
|
||||
|
||||
vec4 tint_saturate(vec4 v) {
|
||||
return clamp(v, vec4(0.0f), vec4(1.0f));
|
||||
}
|
||||
|
||||
void saturate_a5b571() {
|
||||
vec4 arg_0 = vec4(1.0f);
|
||||
vec4 res = tint_saturate(arg_0);
|
||||
}
|
||||
|
||||
void compute_main() {
|
||||
saturate_a5b571();
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
compute_main();
|
||||
return;
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue