Add refract intrinsic
See: https://github.com/gpuweb/gpuweb/pull/1901 Bug: tint:950 Change-Id: I6f00ab753a2ddf2374352ddf636e1abfebe86ba7 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/56777 Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
parent
892aaf377f
commit
b0455217fa
File diff suppressed because it is too large
Load Diff
|
@ -354,6 +354,7 @@ fn pow(f32, f32) -> f32
|
|||
fn pow<N: num>(vec<N, f32>, vec<N, f32>) -> vec<N, f32>
|
||||
fn reflect(f32, f32) -> f32
|
||||
fn reflect<N: num>(vec<N, f32>, vec<N, f32>) -> vec<N, f32>
|
||||
fn refract<N: num>(vec<N, f32>, vec<N, f32>, f32) -> vec<N, f32>
|
||||
fn reverseBits<T: iu32>(T) -> T
|
||||
fn reverseBits<N: num, T: iu32>(vec<N, T>) -> vec<N, T>
|
||||
fn round(f32) -> f32
|
||||
|
|
|
@ -365,6 +365,8 @@ std::string GetGlslStd450FuncName(uint32_t ext_opcode) {
|
|||
return "sign";
|
||||
case GLSLstd450Reflect:
|
||||
return "reflect";
|
||||
case GLSLstd450Refract:
|
||||
return "refract";
|
||||
case GLSLstd450Round:
|
||||
case GLSLstd450RoundEven:
|
||||
return "round";
|
||||
|
@ -419,8 +421,6 @@ std::string GetGlslStd450FuncName(uint32_t ext_opcode) {
|
|||
case GLSLstd450PackDouble2x32:
|
||||
case GLSLstd450UnpackDouble2x32:
|
||||
|
||||
case GLSLstd450Refract:
|
||||
|
||||
case GLSLstd450FindILsb:
|
||||
case GLSLstd450FindSMsb:
|
||||
case GLSLstd450FindUMsb:
|
||||
|
@ -1055,9 +1055,8 @@ void FunctionEmitter::IncrementLocation(ast::DecorationList* decos) {
|
|||
}
|
||||
}
|
||||
|
||||
ast::Decoration* FunctionEmitter::SetLocation(
|
||||
ast::DecorationList* decos,
|
||||
ast::Decoration* replacement) {
|
||||
ast::Decoration* FunctionEmitter::SetLocation(ast::DecorationList* decos,
|
||||
ast::Decoration* replacement) {
|
||||
if (!replacement) {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -193,6 +193,9 @@ IntrinsicType ParseIntrinsicType(const std::string& name) {
|
|||
if (name == "reflect") {
|
||||
return IntrinsicType::kReflect;
|
||||
}
|
||||
if (name == "refract") {
|
||||
return IntrinsicType::kRefract;
|
||||
}
|
||||
if (name == "reverseBits") {
|
||||
return IntrinsicType::kReverseBits;
|
||||
}
|
||||
|
@ -436,6 +439,8 @@ const char* str(IntrinsicType i) {
|
|||
return "pow";
|
||||
case IntrinsicType::kReflect:
|
||||
return "reflect";
|
||||
case IntrinsicType::kRefract:
|
||||
return "refract";
|
||||
case IntrinsicType::kReverseBits:
|
||||
return "reverseBits";
|
||||
case IntrinsicType::kRound:
|
||||
|
|
|
@ -88,6 +88,7 @@ enum class IntrinsicType {
|
|||
kPack4x8unorm,
|
||||
kPow,
|
||||
kReflect,
|
||||
kRefract,
|
||||
kReverseBits,
|
||||
kRound,
|
||||
kSelect,
|
||||
|
|
|
@ -1840,6 +1840,7 @@ std::string GeneratorImpl::generate_builtin_name(
|
|||
case sem::IntrinsicType::kNormalize:
|
||||
case sem::IntrinsicType::kPow:
|
||||
case sem::IntrinsicType::kReflect:
|
||||
case sem::IntrinsicType::kRefract:
|
||||
case sem::IntrinsicType::kRound:
|
||||
case sem::IntrinsicType::kSign:
|
||||
case sem::IntrinsicType::kSin:
|
||||
|
|
|
@ -832,6 +832,7 @@ std::string GeneratorImpl::generate_builtin_name(
|
|||
case sem::IntrinsicType::kNormalize:
|
||||
case sem::IntrinsicType::kPow:
|
||||
case sem::IntrinsicType::kReflect:
|
||||
case sem::IntrinsicType::kRefract:
|
||||
case sem::IntrinsicType::kSelect:
|
||||
case sem::IntrinsicType::kSin:
|
||||
case sem::IntrinsicType::kSinh:
|
||||
|
|
|
@ -209,6 +209,8 @@ uint32_t intrinsic_to_glsl_method(const sem::Intrinsic* intrinsic) {
|
|||
return GLSLstd450Pow;
|
||||
case IntrinsicType::kReflect:
|
||||
return GLSLstd450Reflect;
|
||||
case IntrinsicType::kRefract:
|
||||
return GLSLstd450Refract;
|
||||
case IntrinsicType::kRound:
|
||||
return GLSLstd450RoundEven;
|
||||
case IntrinsicType::kSign:
|
||||
|
|
|
@ -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 refract(vec<4, f32>, vec<4, f32>, f32) -> vec<4, f32>
|
||||
fn refract_7e02e6() {
|
||||
var res: vec4<f32> = refract(vec4<f32>(), vec4<f32>(), 1.0);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
refract_7e02e6();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
refract_7e02e6();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
refract_7e02e6();
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
void refract_7e02e6() {
|
||||
float4 res = refract(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() {
|
||||
refract_7e02e6();
|
||||
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
|
||||
return tint_symbol_1;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
refract_7e02e6();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
refract_7e02e6();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
void refract_7e02e6() {
|
||||
float4 res = refract(float4(), float4(), 1.0f);
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main() {
|
||||
refract_7e02e6();
|
||||
tint_symbol const tint_symbol_1 = {.value=float4()};
|
||||
return tint_symbol_1;
|
||||
}
|
||||
|
||||
fragment void fragment_main() {
|
||||
refract_7e02e6();
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main() {
|
||||
refract_7e02e6();
|
||||
return;
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 32
|
||||
; 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 %refract_7e02e6 "refract_7e02e6"
|
||||
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
|
||||
%18 = OpTypeFunction %void %v4float
|
||||
%refract_7e02e6 = OpFunction %void None %9
|
||||
%12 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_v4float Function %8
|
||||
%13 = OpExtInst %v4float %14 Refract %8 %8 %float_1
|
||||
OpStore %res %13
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%tint_symbol_2 = OpFunction %void None %18
|
||||
%tint_symbol = OpFunctionParameter %v4float
|
||||
%21 = OpLabel
|
||||
OpStore %tint_symbol_1 %tint_symbol
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %9
|
||||
%23 = OpLabel
|
||||
OpStore %tint_pointsize %float_1
|
||||
%24 = OpFunctionCall %void %refract_7e02e6
|
||||
%25 = OpFunctionCall %void %tint_symbol_2 %8
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %9
|
||||
%27 = OpLabel
|
||||
%28 = OpFunctionCall %void %refract_7e02e6
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %9
|
||||
%30 = OpLabel
|
||||
%31 = OpFunctionCall %void %refract_7e02e6
|
||||
OpReturn
|
||||
OpFunctionEnd
|
|
@ -0,0 +1,19 @@
|
|||
fn refract_7e02e6() {
|
||||
var res : vec4<f32> = refract(vec4<f32>(), vec4<f32>(), 1.0);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
refract_7e02e6();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
refract_7e02e6();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
refract_7e02e6();
|
||||
}
|
|
@ -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 refract(vec<3, f32>, vec<3, f32>, f32) -> vec<3, f32>
|
||||
fn refract_cbc1d2() {
|
||||
var res: vec3<f32> = refract(vec3<f32>(), vec3<f32>(), 1.0);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
refract_cbc1d2();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
refract_cbc1d2();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
refract_cbc1d2();
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
void refract_cbc1d2() {
|
||||
float3 res = refract(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() {
|
||||
refract_cbc1d2();
|
||||
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
|
||||
return tint_symbol_1;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
refract_cbc1d2();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
refract_cbc1d2();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
void refract_cbc1d2() {
|
||||
float3 res = refract(float3(), float3(), 1.0f);
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main() {
|
||||
refract_cbc1d2();
|
||||
tint_symbol const tint_symbol_1 = {.value=float4()};
|
||||
return tint_symbol_1;
|
||||
}
|
||||
|
||||
fragment void fragment_main() {
|
||||
refract_cbc1d2();
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main() {
|
||||
refract_cbc1d2();
|
||||
return;
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 34
|
||||
; 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 %refract_cbc1d2 "refract_cbc1d2"
|
||||
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
|
||||
%20 = OpTypeFunction %void %v4float
|
||||
%refract_cbc1d2 = OpFunction %void None %9
|
||||
%12 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_v3float Function %16
|
||||
%13 = OpExtInst %v3float %15 Refract %16 %16 %float_1
|
||||
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 %refract_cbc1d2
|
||||
%27 = OpFunctionCall %void %tint_symbol_2 %8
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %9
|
||||
%29 = OpLabel
|
||||
%30 = OpFunctionCall %void %refract_cbc1d2
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %9
|
||||
%32 = OpLabel
|
||||
%33 = OpFunctionCall %void %refract_cbc1d2
|
||||
OpReturn
|
||||
OpFunctionEnd
|
|
@ -0,0 +1,19 @@
|
|||
fn refract_cbc1d2() {
|
||||
var res : vec3<f32> = refract(vec3<f32>(), vec3<f32>(), 1.0);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
refract_cbc1d2();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
refract_cbc1d2();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
refract_cbc1d2();
|
||||
}
|
|
@ -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 refract(vec<2, f32>, vec<2, f32>, f32) -> vec<2, f32>
|
||||
fn refract_cd905f() {
|
||||
var res: vec2<f32> = refract(vec2<f32>(), vec2<f32>(), 1.0);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
refract_cd905f();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
refract_cd905f();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
refract_cd905f();
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
void refract_cd905f() {
|
||||
float2 res = refract(float2(0.0f, 0.0f), float2(0.0f, 0.0f), 1.0f);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
refract_cd905f();
|
||||
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
|
||||
return tint_symbol_1;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
refract_cd905f();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
refract_cd905f();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
void refract_cd905f() {
|
||||
float2 res = refract(float2(), float2(), 1.0f);
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main() {
|
||||
refract_cd905f();
|
||||
tint_symbol const tint_symbol_1 = {.value=float4()};
|
||||
return tint_symbol_1;
|
||||
}
|
||||
|
||||
fragment void fragment_main() {
|
||||
refract_cd905f();
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main() {
|
||||
refract_cd905f();
|
||||
return;
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 34
|
||||
; 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 %refract_cd905f "refract_cd905f"
|
||||
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
|
||||
%20 = OpTypeFunction %void %v4float
|
||||
%refract_cd905f = OpFunction %void None %9
|
||||
%12 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_v2float Function %16
|
||||
%13 = OpExtInst %v2float %15 Refract %16 %16 %float_1
|
||||
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 %refract_cd905f
|
||||
%27 = OpFunctionCall %void %tint_symbol_2 %8
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %9
|
||||
%29 = OpLabel
|
||||
%30 = OpFunctionCall %void %refract_cd905f
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %9
|
||||
%32 = OpLabel
|
||||
%33 = OpFunctionCall %void %refract_cd905f
|
||||
OpReturn
|
||||
OpFunctionEnd
|
|
@ -0,0 +1,19 @@
|
|||
fn refract_cd905f() {
|
||||
var res : vec2<f32> = refract(vec2<f32>(), vec2<f32>(), 1.0);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
refract_cd905f();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
refract_cd905f();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
refract_cd905f();
|
||||
}
|
Loading…
Reference in New Issue