mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-07-13 16:45:56 +00:00
intrinsics: Add mix(vec, vec, f32)
overload
Fixed: tint:1029 Change-Id: Ie367947bd9bf65ad6bb2c278bbe4bd0740512faa Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/59446 Reviewed-by: David Neto <dneto@google.com> Reviewed-by: James Price <jrprice@google.com> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
parent
053559d051
commit
7204756d4d
File diff suppressed because it is too large
Load Diff
@ -348,6 +348,7 @@ fn min<T: fiu32>(T, T) -> T
|
||||
fn min<N: num, T: fiu32>(vec<N, T>, vec<N, T>) -> vec<N, T>
|
||||
fn mix(f32, f32, f32) -> f32
|
||||
fn mix<N: num>(vec<N, f32>, vec<N, f32>, vec<N, f32>) -> vec<N, f32>
|
||||
fn mix<N: num>(vec<N, f32>, vec<N, f32>, f32) -> vec<N, f32>
|
||||
[[deprecated]] fn modf<S: function_private_workgroup, A: access>(f32, ptr<S, f32, A>) -> f32
|
||||
[[deprecated]] fn modf<N: num, S: function_private_workgroup, A: access>(vec<N, f32>, ptr<S, vec<N, f32>, A>) -> vec<N, f32>
|
||||
fn modf(f32) -> _modf_result
|
||||
|
@ -1494,13 +1494,8 @@ TEST_P(ResolverIntrinsicTest_ThreeParam, Error_NoParams) {
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
|
||||
EXPECT_EQ(r()->error(),
|
||||
"error: no matching call to " + std::string(param.name) +
|
||||
"()\n\n"
|
||||
"2 candidate functions:\n " +
|
||||
std::string(param.name) + "(f32, f32, f32) -> f32\n " +
|
||||
std::string(param.name) +
|
||||
"(vecN<f32>, vecN<f32>, vecN<f32>) -> vecN<f32>\n");
|
||||
EXPECT_THAT(r()->error(), HasSubstr("error: no matching call to " +
|
||||
std::string(param.name) + "()"));
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
|
@ -2514,6 +2514,35 @@ uint32_t Builder::GenerateIntrinsic(ast::CallExpression* call,
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
case IntrinsicType::kMix: {
|
||||
auto std450 = Operand::Int(GetGLSLstd450Import());
|
||||
|
||||
auto a_id = get_param_as_value_id(0);
|
||||
auto b_id = get_param_as_value_id(1);
|
||||
auto f_id = get_param_as_value_id(2);
|
||||
if (!a_id || !b_id || !f_id) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// If the interpolant is scalar but the objects are vectors, we need to
|
||||
// splat the interpolant into a vector of the same size.
|
||||
auto* result_vector_type = intrinsic->ReturnType()->As<sem::Vector>();
|
||||
if (result_vector_type &&
|
||||
intrinsic->Parameters()[2]->Type()->is_scalar()) {
|
||||
f_id = GenerateSplat(f_id, intrinsic->Parameters()[0]->Type());
|
||||
if (f_id == 0) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!push_function_inst(spv::Op::OpExtInst,
|
||||
{Operand::Int(result_type_id), result, std450,
|
||||
Operand::Int(GLSLstd450FMix), Operand::Int(a_id),
|
||||
Operand::Int(b_id), Operand::Int(f_id)})) {
|
||||
return 0;
|
||||
}
|
||||
return result_id;
|
||||
}
|
||||
case IntrinsicType::kReverseBits:
|
||||
op = spv::Op::OpBitReverse;
|
||||
break;
|
||||
|
45
test/intrinsics/gen/mix/1faeb1.wgsl
Normal file
45
test/intrinsics/gen/mix/1faeb1.wgsl
Normal file
@ -0,0 +1,45 @@
|
||||
// Copyright 2021 The Tint Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// File generated by tools/intrinsic-gen
|
||||
// using the template:
|
||||
// test/intrinsics/intrinsics.wgsl.tmpl
|
||||
// and the intrinsic defintion file:
|
||||
// src/intrinsics.def
|
||||
//
|
||||
// Do not modify this file directly
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
// fn mix(vec<4, f32>, vec<4, f32>, f32) -> vec<4, f32>
|
||||
fn mix_1faeb1() {
|
||||
var res: vec4<f32> = mix(vec4<f32>(), vec4<f32>(), 1.0);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
mix_1faeb1();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
mix_1faeb1();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
mix_1faeb1();
|
||||
}
|
24
test/intrinsics/gen/mix/1faeb1.wgsl.expected.hlsl
Normal file
24
test/intrinsics/gen/mix/1faeb1.wgsl.expected.hlsl
Normal file
@ -0,0 +1,24 @@
|
||||
void mix_1faeb1() {
|
||||
float4 res = lerp(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), 1.0f);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
mix_1faeb1();
|
||||
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
|
||||
return tint_symbol_1;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
mix_1faeb1();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
mix_1faeb1();
|
||||
return;
|
||||
}
|
27
test/intrinsics/gen/mix/1faeb1.wgsl.expected.msl
Normal file
27
test/intrinsics/gen/mix/1faeb1.wgsl.expected.msl
Normal file
@ -0,0 +1,27 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
void mix_1faeb1() {
|
||||
float4 res = mix(float4(), float4(), 1.0f);
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main() {
|
||||
mix_1faeb1();
|
||||
tint_symbol const tint_symbol_1 = {.value=float4()};
|
||||
return tint_symbol_1;
|
||||
}
|
||||
|
||||
fragment void fragment_main() {
|
||||
mix_1faeb1();
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main() {
|
||||
mix_1faeb1();
|
||||
return;
|
||||
}
|
||||
|
69
test/intrinsics/gen/mix/1faeb1.wgsl.expected.spvasm
Normal file
69
test/intrinsics/gen/mix/1faeb1.wgsl.expected.spvasm
Normal file
@ -0,0 +1,69 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 34
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%14 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize %tint_symbol_1
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %tint_pointsize "tint_pointsize"
|
||||
OpName %tint_symbol_1 "tint_symbol_1"
|
||||
OpName %mix_1faeb1 "mix_1faeb1"
|
||||
OpName %res "res"
|
||||
OpName %tint_symbol_2 "tint_symbol_2"
|
||||
OpName %tint_symbol "tint_symbol"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %tint_pointsize BuiltIn PointSize
|
||||
OpDecorate %tint_symbol_1 BuiltIn Position
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%4 = OpConstantNull %float
|
||||
%tint_pointsize = OpVariable %_ptr_Output_float Output %4
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%8 = OpConstantNull %v4float
|
||||
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8
|
||||
%void = OpTypeVoid
|
||||
%9 = OpTypeFunction %void
|
||||
%float_1 = OpConstant %float 1
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%20 = OpTypeFunction %void %v4float
|
||||
%mix_1faeb1 = OpFunction %void None %9
|
||||
%12 = OpLabel
|
||||
%16 = OpVariable %_ptr_Function_v4float Function %8
|
||||
%res = OpVariable %_ptr_Function_v4float Function %8
|
||||
%18 = OpCompositeConstruct %v4float %float_1 %float_1 %float_1 %float_1
|
||||
%13 = OpExtInst %v4float %14 FMix %8 %8 %18
|
||||
OpStore %res %13
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%tint_symbol_2 = OpFunction %void None %20
|
||||
%tint_symbol = OpFunctionParameter %v4float
|
||||
%23 = OpLabel
|
||||
OpStore %tint_symbol_1 %tint_symbol
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %9
|
||||
%25 = OpLabel
|
||||
OpStore %tint_pointsize %float_1
|
||||
%26 = OpFunctionCall %void %mix_1faeb1
|
||||
%27 = OpFunctionCall %void %tint_symbol_2 %8
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %9
|
||||
%29 = OpLabel
|
||||
%30 = OpFunctionCall %void %mix_1faeb1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %9
|
||||
%32 = OpLabel
|
||||
%33 = OpFunctionCall %void %mix_1faeb1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
19
test/intrinsics/gen/mix/1faeb1.wgsl.expected.wgsl
Normal file
19
test/intrinsics/gen/mix/1faeb1.wgsl.expected.wgsl
Normal file
@ -0,0 +1,19 @@
|
||||
fn mix_1faeb1() {
|
||||
var res : vec4<f32> = mix(vec4<f32>(), vec4<f32>(), 1.0);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
mix_1faeb1();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
mix_1faeb1();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
mix_1faeb1();
|
||||
}
|
45
test/intrinsics/gen/mix/2fadab.wgsl
Normal file
45
test/intrinsics/gen/mix/2fadab.wgsl
Normal file
@ -0,0 +1,45 @@
|
||||
// Copyright 2021 The Tint Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// File generated by tools/intrinsic-gen
|
||||
// using the template:
|
||||
// test/intrinsics/intrinsics.wgsl.tmpl
|
||||
// and the intrinsic defintion file:
|
||||
// src/intrinsics.def
|
||||
//
|
||||
// Do not modify this file directly
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
// fn mix(vec<2, f32>, vec<2, f32>, f32) -> vec<2, f32>
|
||||
fn mix_2fadab() {
|
||||
var res: vec2<f32> = mix(vec2<f32>(), vec2<f32>(), 1.0);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
mix_2fadab();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
mix_2fadab();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
mix_2fadab();
|
||||
}
|
24
test/intrinsics/gen/mix/2fadab.wgsl.expected.hlsl
Normal file
24
test/intrinsics/gen/mix/2fadab.wgsl.expected.hlsl
Normal file
@ -0,0 +1,24 @@
|
||||
void mix_2fadab() {
|
||||
float2 res = lerp(float2(0.0f, 0.0f), float2(0.0f, 0.0f), 1.0f);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
mix_2fadab();
|
||||
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
|
||||
return tint_symbol_1;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
mix_2fadab();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
mix_2fadab();
|
||||
return;
|
||||
}
|
27
test/intrinsics/gen/mix/2fadab.wgsl.expected.msl
Normal file
27
test/intrinsics/gen/mix/2fadab.wgsl.expected.msl
Normal file
@ -0,0 +1,27 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
void mix_2fadab() {
|
||||
float2 res = mix(float2(), float2(), 1.0f);
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main() {
|
||||
mix_2fadab();
|
||||
tint_symbol const tint_symbol_1 = {.value=float4()};
|
||||
return tint_symbol_1;
|
||||
}
|
||||
|
||||
fragment void fragment_main() {
|
||||
mix_2fadab();
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main() {
|
||||
mix_2fadab();
|
||||
return;
|
||||
}
|
||||
|
71
test/intrinsics/gen/mix/2fadab.wgsl.expected.spvasm
Normal file
71
test/intrinsics/gen/mix/2fadab.wgsl.expected.spvasm
Normal file
@ -0,0 +1,71 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 36
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%15 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize %tint_symbol_1
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %tint_pointsize "tint_pointsize"
|
||||
OpName %tint_symbol_1 "tint_symbol_1"
|
||||
OpName %mix_2fadab "mix_2fadab"
|
||||
OpName %res "res"
|
||||
OpName %tint_symbol_2 "tint_symbol_2"
|
||||
OpName %tint_symbol "tint_symbol"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %tint_pointsize BuiltIn PointSize
|
||||
OpDecorate %tint_symbol_1 BuiltIn Position
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%4 = OpConstantNull %float
|
||||
%tint_pointsize = OpVariable %_ptr_Output_float Output %4
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%8 = OpConstantNull %v4float
|
||||
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8
|
||||
%void = OpTypeVoid
|
||||
%9 = OpTypeFunction %void
|
||||
%v2float = OpTypeVector %float 2
|
||||
%16 = OpConstantNull %v2float
|
||||
%float_1 = OpConstant %float 1
|
||||
%_ptr_Function_v2float = OpTypePointer Function %v2float
|
||||
%22 = OpTypeFunction %void %v4float
|
||||
%mix_2fadab = OpFunction %void None %9
|
||||
%12 = OpLabel
|
||||
%18 = OpVariable %_ptr_Function_v2float Function %16
|
||||
%res = OpVariable %_ptr_Function_v2float Function %16
|
||||
%20 = OpCompositeConstruct %v2float %float_1 %float_1
|
||||
%13 = OpExtInst %v2float %15 FMix %16 %16 %20
|
||||
OpStore %res %13
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%tint_symbol_2 = OpFunction %void None %22
|
||||
%tint_symbol = OpFunctionParameter %v4float
|
||||
%25 = OpLabel
|
||||
OpStore %tint_symbol_1 %tint_symbol
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %9
|
||||
%27 = OpLabel
|
||||
OpStore %tint_pointsize %float_1
|
||||
%28 = OpFunctionCall %void %mix_2fadab
|
||||
%29 = OpFunctionCall %void %tint_symbol_2 %8
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %9
|
||||
%31 = OpLabel
|
||||
%32 = OpFunctionCall %void %mix_2fadab
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %9
|
||||
%34 = OpLabel
|
||||
%35 = OpFunctionCall %void %mix_2fadab
|
||||
OpReturn
|
||||
OpFunctionEnd
|
19
test/intrinsics/gen/mix/2fadab.wgsl.expected.wgsl
Normal file
19
test/intrinsics/gen/mix/2fadab.wgsl.expected.wgsl
Normal file
@ -0,0 +1,19 @@
|
||||
fn mix_2fadab() {
|
||||
var res : vec2<f32> = mix(vec2<f32>(), vec2<f32>(), 1.0);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
mix_2fadab();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
mix_2fadab();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
mix_2fadab();
|
||||
}
|
45
test/intrinsics/gen/mix/315264.wgsl
Normal file
45
test/intrinsics/gen/mix/315264.wgsl
Normal file
@ -0,0 +1,45 @@
|
||||
// Copyright 2021 The Tint Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// File generated by tools/intrinsic-gen
|
||||
// using the template:
|
||||
// test/intrinsics/intrinsics.wgsl.tmpl
|
||||
// and the intrinsic defintion file:
|
||||
// src/intrinsics.def
|
||||
//
|
||||
// Do not modify this file directly
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
// fn mix(vec<3, f32>, vec<3, f32>, f32) -> vec<3, f32>
|
||||
fn mix_315264() {
|
||||
var res: vec3<f32> = mix(vec3<f32>(), vec3<f32>(), 1.0);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
mix_315264();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
mix_315264();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
mix_315264();
|
||||
}
|
24
test/intrinsics/gen/mix/315264.wgsl.expected.hlsl
Normal file
24
test/intrinsics/gen/mix/315264.wgsl.expected.hlsl
Normal file
@ -0,0 +1,24 @@
|
||||
void mix_315264() {
|
||||
float3 res = lerp(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), 1.0f);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
mix_315264();
|
||||
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
|
||||
return tint_symbol_1;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
mix_315264();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
mix_315264();
|
||||
return;
|
||||
}
|
27
test/intrinsics/gen/mix/315264.wgsl.expected.msl
Normal file
27
test/intrinsics/gen/mix/315264.wgsl.expected.msl
Normal file
@ -0,0 +1,27 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
void mix_315264() {
|
||||
float3 res = mix(float3(), float3(), 1.0f);
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main() {
|
||||
mix_315264();
|
||||
tint_symbol const tint_symbol_1 = {.value=float4()};
|
||||
return tint_symbol_1;
|
||||
}
|
||||
|
||||
fragment void fragment_main() {
|
||||
mix_315264();
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main() {
|
||||
mix_315264();
|
||||
return;
|
||||
}
|
||||
|
71
test/intrinsics/gen/mix/315264.wgsl.expected.spvasm
Normal file
71
test/intrinsics/gen/mix/315264.wgsl.expected.spvasm
Normal file
@ -0,0 +1,71 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 36
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%15 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize %tint_symbol_1
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %tint_pointsize "tint_pointsize"
|
||||
OpName %tint_symbol_1 "tint_symbol_1"
|
||||
OpName %mix_315264 "mix_315264"
|
||||
OpName %res "res"
|
||||
OpName %tint_symbol_2 "tint_symbol_2"
|
||||
OpName %tint_symbol "tint_symbol"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %tint_pointsize BuiltIn PointSize
|
||||
OpDecorate %tint_symbol_1 BuiltIn Position
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%4 = OpConstantNull %float
|
||||
%tint_pointsize = OpVariable %_ptr_Output_float Output %4
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%8 = OpConstantNull %v4float
|
||||
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8
|
||||
%void = OpTypeVoid
|
||||
%9 = OpTypeFunction %void
|
||||
%v3float = OpTypeVector %float 3
|
||||
%16 = OpConstantNull %v3float
|
||||
%float_1 = OpConstant %float 1
|
||||
%_ptr_Function_v3float = OpTypePointer Function %v3float
|
||||
%22 = OpTypeFunction %void %v4float
|
||||
%mix_315264 = OpFunction %void None %9
|
||||
%12 = OpLabel
|
||||
%18 = OpVariable %_ptr_Function_v3float Function %16
|
||||
%res = OpVariable %_ptr_Function_v3float Function %16
|
||||
%20 = OpCompositeConstruct %v3float %float_1 %float_1 %float_1
|
||||
%13 = OpExtInst %v3float %15 FMix %16 %16 %20
|
||||
OpStore %res %13
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%tint_symbol_2 = OpFunction %void None %22
|
||||
%tint_symbol = OpFunctionParameter %v4float
|
||||
%25 = OpLabel
|
||||
OpStore %tint_symbol_1 %tint_symbol
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %9
|
||||
%27 = OpLabel
|
||||
OpStore %tint_pointsize %float_1
|
||||
%28 = OpFunctionCall %void %mix_315264
|
||||
%29 = OpFunctionCall %void %tint_symbol_2 %8
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %9
|
||||
%31 = OpLabel
|
||||
%32 = OpFunctionCall %void %mix_315264
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %9
|
||||
%34 = OpLabel
|
||||
%35 = OpFunctionCall %void %mix_315264
|
||||
OpReturn
|
||||
OpFunctionEnd
|
19
test/intrinsics/gen/mix/315264.wgsl.expected.wgsl
Normal file
19
test/intrinsics/gen/mix/315264.wgsl.expected.wgsl
Normal file
@ -0,0 +1,19 @@
|
||||
fn mix_315264() {
|
||||
var res : vec3<f32> = mix(vec3<f32>(), vec3<f32>(), 1.0);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
mix_315264();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
mix_315264();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
mix_315264();
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user