mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-07-13 08:36:08 +00:00
tint: const eval of refract builtin
Bug: tint:1581 Change-Id: Iff64e8a680fbbc82e1f8efe2e2f8e05af8e3692c Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111920 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
parent
be49ed5719
commit
3728a505d6
@ -519,7 +519,7 @@ fn pow<N: num, T: f32_f16>(vec<N, T>, vec<N, T>) -> vec<N, T>
|
|||||||
@const fn radians<T: fa_f32_f16>(T) -> T
|
@const fn radians<T: fa_f32_f16>(T) -> T
|
||||||
@const fn radians<N: num, T: fa_f32_f16>(vec<N, T>) -> vec<N, T>
|
@const fn radians<N: num, T: fa_f32_f16>(vec<N, T>) -> vec<N, T>
|
||||||
@const fn reflect<N: num, T: fa_f32_f16>(vec<N, T>, vec<N, T>) -> vec<N, T>
|
@const fn reflect<N: num, T: fa_f32_f16>(vec<N, T>, vec<N, T>) -> vec<N, T>
|
||||||
fn refract<N: num, T: f32_f16>(vec<N, T>, vec<N, T>, T) -> vec<N, T>
|
@const fn refract<N: num, T: fa_f32_f16>(vec<N, T>, vec<N, T>, T) -> vec<N, T>
|
||||||
@const fn reverseBits<T: iu32>(T) -> T
|
@const fn reverseBits<T: iu32>(T) -> T
|
||||||
@const fn reverseBits<N: num, T: iu32>(vec<N, T>) -> vec<N, T>
|
@const fn reverseBits<N: num, T: iu32>(vec<N, T>) -> vec<N, T>
|
||||||
@const fn round<T: fa_f32_f16>(@test_value(3.4) T) -> T
|
@const fn round<T: fa_f32_f16>(@test_value(3.4) T) -> T
|
||||||
|
@ -2954,6 +2954,104 @@ ConstEval::Result ConstEval::reflect(const sem::Type* ty,
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ConstEval::Result ConstEval::refract(const sem::Type* ty,
|
||||||
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
const Source& source) {
|
||||||
|
auto* vec_ty = ty->As<sem::Vector>();
|
||||||
|
auto* el_ty = vec_ty->type();
|
||||||
|
|
||||||
|
auto compute_k = [&](auto e3, auto dot_e2_e1) -> ConstEval::Result {
|
||||||
|
using NumberT = decltype(e3);
|
||||||
|
// let k = 1.0 - e3 * e3 * (1.0 - dot(e2, e1) * dot(e2, e1))
|
||||||
|
auto e3_squared = Mul(source, e3, e3);
|
||||||
|
if (!e3_squared) {
|
||||||
|
return utils::Failure;
|
||||||
|
}
|
||||||
|
auto dot_e2_e1_squared = Mul(source, dot_e2_e1, dot_e2_e1);
|
||||||
|
if (!dot_e2_e1_squared) {
|
||||||
|
return utils::Failure;
|
||||||
|
}
|
||||||
|
auto r = Sub(source, NumberT(1), dot_e2_e1_squared.Get());
|
||||||
|
if (!r) {
|
||||||
|
return utils::Failure;
|
||||||
|
}
|
||||||
|
r = Mul(source, e3_squared.Get(), r.Get());
|
||||||
|
if (!r) {
|
||||||
|
return utils::Failure;
|
||||||
|
}
|
||||||
|
r = Sub(source, NumberT(1), r.Get());
|
||||||
|
if (!r) {
|
||||||
|
return utils::Failure;
|
||||||
|
}
|
||||||
|
return CreateElement(builder, source, el_ty, r.Get());
|
||||||
|
};
|
||||||
|
|
||||||
|
auto compute_e2_scale = [&](auto e3, auto dot_e2_e1, auto k) -> ConstEval::Result {
|
||||||
|
// e3 * dot(e2, e1) + sqrt(k)
|
||||||
|
auto sqrt_k = Sqrt(source, k);
|
||||||
|
if (!sqrt_k) {
|
||||||
|
return utils::Failure;
|
||||||
|
}
|
||||||
|
auto r = Mul(source, e3, dot_e2_e1);
|
||||||
|
if (!r) {
|
||||||
|
return utils::Failure;
|
||||||
|
}
|
||||||
|
r = Add(source, r.Get(), sqrt_k.Get());
|
||||||
|
if (!r) {
|
||||||
|
return utils::Failure;
|
||||||
|
}
|
||||||
|
return CreateElement(builder, source, el_ty, r.Get());
|
||||||
|
};
|
||||||
|
|
||||||
|
auto calculate = [&]() -> ConstEval::Result {
|
||||||
|
auto* e1 = args[0];
|
||||||
|
auto* e2 = args[1];
|
||||||
|
auto* e3 = args[2];
|
||||||
|
|
||||||
|
// For the incident vector e1 and surface normal e2, and the ratio of indices of refraction
|
||||||
|
// e3, let k = 1.0 - e3 * e3 * (1.0 - dot(e2, e1) * dot(e2, e1)). If k < 0.0, returns the
|
||||||
|
// refraction vector 0.0, otherwise return the refraction vector e3 * e1 - (e3 * dot(e2, e1)
|
||||||
|
// + sqrt(k)) * e2.
|
||||||
|
|
||||||
|
// dot(e2, e1)
|
||||||
|
auto dot_e2_e1 = Dot(source, e2, e1);
|
||||||
|
if (!dot_e2_e1) {
|
||||||
|
return utils::Failure;
|
||||||
|
}
|
||||||
|
|
||||||
|
// let k = 1.0 - e3 * e3 * (1.0 - dot(e2, e1) * dot(e2, e1))
|
||||||
|
auto k = Dispatch_fa_f32_f16(compute_k, e3, dot_e2_e1.Get());
|
||||||
|
if (!k) {
|
||||||
|
return utils::Failure;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If k < 0.0, returns the refraction vector 0.0
|
||||||
|
if (k.Get()->As<AFloat>() < 0) {
|
||||||
|
return ZeroValue(builder, ty);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Otherwise return the refraction vector e3 * e1 - (e3 * dot(e2, e1) + sqrt(k)) * e2
|
||||||
|
auto e1_scaled = Mul(source, ty, e3, e1);
|
||||||
|
if (!e1_scaled) {
|
||||||
|
return utils::Failure;
|
||||||
|
}
|
||||||
|
auto e2_scale = Dispatch_fa_f32_f16(compute_e2_scale, e3, dot_e2_e1.Get(), k.Get());
|
||||||
|
if (!e2_scale) {
|
||||||
|
return utils::Failure;
|
||||||
|
}
|
||||||
|
auto e2_scaled = Mul(source, ty, e2_scale.Get(), e2);
|
||||||
|
if (!e1_scaled) {
|
||||||
|
return utils::Failure;
|
||||||
|
}
|
||||||
|
return Sub(source, ty, e1_scaled.Get(), e2_scaled.Get());
|
||||||
|
};
|
||||||
|
auto r = calculate();
|
||||||
|
if (!r) {
|
||||||
|
AddNote("when calculating refract", source);
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
ConstEval::Result ConstEval::reverseBits(const sem::Type* ty,
|
ConstEval::Result ConstEval::reverseBits(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
const Source& source) {
|
const Source& source) {
|
||||||
|
@ -800,6 +800,15 @@ class ConstEval {
|
|||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
const Source& source);
|
const Source& source);
|
||||||
|
|
||||||
|
/// refract builtin
|
||||||
|
/// @param ty the expression type
|
||||||
|
/// @param args the input arguments
|
||||||
|
/// @param source the source location of the conversion
|
||||||
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
|
Result refract(const sem::Type* ty,
|
||||||
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
const Source& source);
|
||||||
|
|
||||||
/// reverseBits builtin
|
/// reverseBits builtin
|
||||||
/// @param ty the expression type
|
/// @param ty the expression type
|
||||||
/// @param args the input arguments
|
/// @param args the input arguments
|
||||||
|
@ -1983,11 +1983,91 @@ INSTANTIATE_TEST_SUITE_P( //
|
|||||||
Reflect,
|
Reflect,
|
||||||
ResolverConstEvalBuiltinTest,
|
ResolverConstEvalBuiltinTest,
|
||||||
testing::Combine(testing::Values(sem::BuiltinType::kReflect),
|
testing::Combine(testing::Values(sem::BuiltinType::kReflect),
|
||||||
testing::ValuesIn(
|
testing::ValuesIn(Concat(ReflectCases<AFloat>(), //
|
||||||
// ReflectCases<f32>())));
|
ReflectCases<f32>(), //
|
||||||
Concat(ReflectCases<AFloat>(), //
|
ReflectCases<f16>()))));
|
||||||
ReflectCases<f32>(), //
|
|
||||||
ReflectCases<f16>()))));
|
template <typename T>
|
||||||
|
std::vector<Case> RefractCases() {
|
||||||
|
// Returns "eta" (Greek letter) that denotes the ratio of indices of refraction for the input
|
||||||
|
// and output vector angles from the normal vector.
|
||||||
|
auto eta = [](auto angle1, auto angle2) {
|
||||||
|
// Snell's law: sin(angle1) / sin(angle2) == n2 / n1
|
||||||
|
// We want the ratio of n1 to n2, so sin(angle2) / sin(angle1)
|
||||||
|
auto angle1_rads = T(angle1) * kPi<T> / T(180);
|
||||||
|
auto angle2_rads = T(angle2) * kPi<T> / T(180);
|
||||||
|
return T(std::sin(angle2_rads) / std::sin(angle1_rads));
|
||||||
|
};
|
||||||
|
|
||||||
|
auto zero = Vec(T(0), T(0), T(0));
|
||||||
|
auto pos_y = Vec(T(0), T(1), T(0));
|
||||||
|
auto neg_y = Vec(T(0), -T(1), T(0));
|
||||||
|
auto pos_x = Vec(T(1), T(0), T(0));
|
||||||
|
auto neg_x = Vec(-T(1), T(0), T(0));
|
||||||
|
auto cos_45 = T(0.70710678118654752440084436210485);
|
||||||
|
auto cos_30 = T(0.86602540378443864676372317075294);
|
||||||
|
auto down_right = Vec(T(cos_45), -T(cos_45), T(0));
|
||||||
|
auto up_right = Vec(T(cos_45), T(cos_45), T(0));
|
||||||
|
|
||||||
|
auto eps = 0.001;
|
||||||
|
if constexpr (std::is_same_v<T, f16>) {
|
||||||
|
eps = 0.1;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto r = std::vector<Case>{
|
||||||
|
// e3 (eta) == 1, no refraction, so input is same as output
|
||||||
|
C({down_right, pos_y, Val(T(1))}, down_right),
|
||||||
|
C({neg_y, pos_y, Val(T(1))}, neg_y),
|
||||||
|
// Varying etas
|
||||||
|
C({down_right, pos_y, Val(eta(45, 45))}, down_right).FloatComp(eps), // e3 == 1
|
||||||
|
C({down_right, pos_y, Val(eta(45, 30))}, Vec(T(0.5), -T(cos_30), T(0))).FloatComp(eps),
|
||||||
|
C({down_right, pos_y, Val(eta(45, 60))}, Vec(T(cos_30), -T(0.5), T(0))).FloatComp(eps),
|
||||||
|
C({down_right, pos_y, Val(eta(45, 90))}, Vec(T(1), T(0), T(0))).FloatComp(eps),
|
||||||
|
// Flip input and normal, same result
|
||||||
|
C({up_right, neg_y, Val(eta(45, 45))}, up_right).FloatComp(eps), // e3 == 1
|
||||||
|
C({up_right, neg_y, Val(eta(45, 30))}, Vec(T(0.5), T(cos_30), T(0))).FloatComp(eps),
|
||||||
|
C({up_right, neg_y, Val(eta(45, 60))}, Vec(T(cos_30), T(0.5), T(0))).FloatComp(eps),
|
||||||
|
C({up_right, neg_y, Val(eta(45, 90))}, Vec(T(1), T(0), T(0))).FloatComp(eps),
|
||||||
|
// Flip only normal, result is flipped
|
||||||
|
C({down_right, neg_y, Val(eta(45, 45))}, up_right).FloatComp(eps), // e3 == 1
|
||||||
|
C({down_right, neg_y, Val(eta(45, 30))}, Vec(T(0.5), T(cos_30), T(0))).FloatComp(eps),
|
||||||
|
C({down_right, neg_y, Val(eta(45, 60))}, Vec(T(cos_30), T(0.5), T(0))).FloatComp(eps),
|
||||||
|
C({down_right, neg_y, Val(eta(45, 90))}, Vec(T(1), T(0), T(0))).FloatComp(eps),
|
||||||
|
|
||||||
|
// If k < 0.0, returns the refraction vector 0.0
|
||||||
|
C({down_right, pos_y, Val(T(2))}, zero).FloatComp(eps),
|
||||||
|
|
||||||
|
// A few more with a different normal (e2)
|
||||||
|
C({down_right, neg_x, Val(eta(45, 45))}, down_right).FloatComp(eps), // e3 == 1
|
||||||
|
C({down_right, neg_x, Val(eta(45, 30))}, Vec(cos_30, -T(0.5), T(0))).FloatComp(eps),
|
||||||
|
C({down_right, neg_x, Val(eta(45, 60))}, Vec(T(0.5), -T(cos_30), T(0))).FloatComp(eps),
|
||||||
|
};
|
||||||
|
|
||||||
|
auto error_msg = [](auto a, const char* op, auto b) {
|
||||||
|
return "12:34 error: " + OverflowErrorMessage(a, op, b) + R"(
|
||||||
|
12:34 note: when calculating refract)";
|
||||||
|
};
|
||||||
|
ConcatInto( //
|
||||||
|
r,
|
||||||
|
std::vector<Case>{
|
||||||
|
// Overflow the dot product operation
|
||||||
|
E({Vec(T::Highest(), T::Highest(), T(0)), Vec(T(1), T(1), T(0)), Val(T(1))},
|
||||||
|
error_msg(T::Highest(), "+", T::Highest())),
|
||||||
|
E({Vec(T::Lowest(), T::Lowest(), T(0)), Vec(T(1), T(1), T(0)), Val(T(1))},
|
||||||
|
error_msg(T::Lowest(), "+", T::Lowest())),
|
||||||
|
// Overflow the k^2 operation
|
||||||
|
E({down_right, pos_y, Val(T::Highest())}, error_msg(T::Highest(), "*", T::Highest())),
|
||||||
|
});
|
||||||
|
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
INSTANTIATE_TEST_SUITE_P( //
|
||||||
|
Refract,
|
||||||
|
ResolverConstEvalBuiltinTest,
|
||||||
|
testing::Combine(testing::Values(sem::BuiltinType::kRefract),
|
||||||
|
testing::ValuesIn(Concat(RefractCases<AFloat>(), //
|
||||||
|
RefractCases<f32>(), //
|
||||||
|
RefractCases<f16>()))));
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
std::vector<Case> RadiansCases() {
|
std::vector<Case> RadiansCases() {
|
||||||
|
@ -13710,12 +13710,12 @@ constexpr OverloadInfo kOverloads[] = {
|
|||||||
/* num parameters */ 3,
|
/* num parameters */ 3,
|
||||||
/* num template types */ 1,
|
/* num template types */ 1,
|
||||||
/* num template numbers */ 1,
|
/* num template numbers */ 1,
|
||||||
/* template types */ &kTemplateTypes[26],
|
/* template types */ &kTemplateTypes[23],
|
||||||
/* template numbers */ &kTemplateNumbers[4],
|
/* template numbers */ &kTemplateNumbers[4],
|
||||||
/* parameters */ &kParameters[477],
|
/* parameters */ &kParameters[477],
|
||||||
/* return matcher indices */ &kMatcherIndices[30],
|
/* return matcher indices */ &kMatcherIndices[30],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
|
/* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
|
||||||
/* const eval */ nullptr,
|
/* const eval */ &ConstEval::refract,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
/* [450] */
|
/* [450] */
|
||||||
@ -14421,7 +14421,7 @@ constexpr IntrinsicInfo kBuiltins[] = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
/* [64] */
|
/* [64] */
|
||||||
/* fn refract<N : num, T : f32_f16>(vec<N, T>, vec<N, T>, T) -> vec<N, T> */
|
/* fn refract<N : num, T : fa_f32_f16>(vec<N, T>, vec<N, T>, T) -> vec<N, T> */
|
||||||
/* num overloads */ 1,
|
/* num overloads */ 1,
|
||||||
/* overloads */ &kOverloads[449],
|
/* overloads */ &kOverloads[449],
|
||||||
},
|
},
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
void refract_0594ba() {
|
void refract_0594ba() {
|
||||||
vector<float16_t, 4> res = refract((float16_t(1.0h)).xxxx, (float16_t(1.0h)).xxxx, float16_t(1.0h));
|
vector<float16_t, 4> res = (float16_t(-7.0h)).xxxx;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tint_symbol {
|
struct tint_symbol {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#extension GL_AMD_gpu_shader_half_float : require
|
#extension GL_AMD_gpu_shader_half_float : require
|
||||||
|
|
||||||
void refract_0594ba() {
|
void refract_0594ba() {
|
||||||
f16vec4 res = refract(f16vec4(1.0hf), f16vec4(1.0hf), 1.0hf);
|
f16vec4 res = f16vec4(-7.0hf);
|
||||||
}
|
}
|
||||||
|
|
||||||
vec4 vertex_main() {
|
vec4 vertex_main() {
|
||||||
@ -23,7 +23,7 @@ void main() {
|
|||||||
precision mediump float;
|
precision mediump float;
|
||||||
|
|
||||||
void refract_0594ba() {
|
void refract_0594ba() {
|
||||||
f16vec4 res = refract(f16vec4(1.0hf), f16vec4(1.0hf), 1.0hf);
|
f16vec4 res = f16vec4(-7.0hf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fragment_main() {
|
void fragment_main() {
|
||||||
@ -38,7 +38,7 @@ void main() {
|
|||||||
#extension GL_AMD_gpu_shader_half_float : require
|
#extension GL_AMD_gpu_shader_half_float : require
|
||||||
|
|
||||||
void refract_0594ba() {
|
void refract_0594ba() {
|
||||||
f16vec4 res = refract(f16vec4(1.0hf), f16vec4(1.0hf), 1.0hf);
|
f16vec4 res = f16vec4(-7.0hf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void compute_main() {
|
void compute_main() {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
using namespace metal;
|
using namespace metal;
|
||||||
void refract_0594ba() {
|
void refract_0594ba() {
|
||||||
half4 res = refract(half4(1.0h), half4(1.0h), 1.0h);
|
half4 res = half4(-7.0h);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tint_symbol {
|
struct tint_symbol {
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
; SPIR-V
|
; SPIR-V
|
||||||
; Version: 1.3
|
; Version: 1.3
|
||||||
; Generator: Google Tint Compiler; 0
|
; Generator: Google Tint Compiler; 0
|
||||||
; Bound: 36
|
; Bound: 34
|
||||||
; Schema: 0
|
; Schema: 0
|
||||||
OpCapability Shader
|
OpCapability Shader
|
||||||
OpCapability Float16
|
OpCapability Float16
|
||||||
OpCapability UniformAndStorageBuffer16BitAccess
|
OpCapability UniformAndStorageBuffer16BitAccess
|
||||||
OpCapability StorageBuffer16BitAccess
|
OpCapability StorageBuffer16BitAccess
|
||||||
OpCapability StorageInputOutput16
|
OpCapability StorageInputOutput16
|
||||||
%16 = OpExtInstImport "GLSL.std.450"
|
|
||||||
OpMemoryModel Logical GLSL450
|
OpMemoryModel Logical GLSL450
|
||||||
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||||
@ -37,38 +36,37 @@
|
|||||||
%9 = OpTypeFunction %void
|
%9 = OpTypeFunction %void
|
||||||
%half = OpTypeFloat 16
|
%half = OpTypeFloat 16
|
||||||
%v4half = OpTypeVector %half 4
|
%v4half = OpTypeVector %half 4
|
||||||
%half_0x1p_0 = OpConstant %half 0x1p+0
|
%half_n0x1_cp_2 = OpConstant %half -0x1.cp+2
|
||||||
%18 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 %half_0x1p_0
|
%16 = OpConstantComposite %v4half %half_n0x1_cp_2 %half_n0x1_cp_2 %half_n0x1_cp_2 %half_n0x1_cp_2
|
||||||
%_ptr_Function_v4half = OpTypePointer Function %v4half
|
%_ptr_Function_v4half = OpTypePointer Function %v4half
|
||||||
%21 = OpConstantNull %v4half
|
%19 = OpConstantNull %v4half
|
||||||
%22 = OpTypeFunction %v4float
|
%20 = OpTypeFunction %v4float
|
||||||
%float_1 = OpConstant %float 1
|
%float_1 = OpConstant %float 1
|
||||||
%refract_0594ba = OpFunction %void None %9
|
%refract_0594ba = OpFunction %void None %9
|
||||||
%12 = OpLabel
|
%12 = OpLabel
|
||||||
%res = OpVariable %_ptr_Function_v4half Function %21
|
%res = OpVariable %_ptr_Function_v4half Function %19
|
||||||
%13 = OpExtInst %v4half %16 Refract %18 %18 %half_0x1p_0
|
OpStore %res %16
|
||||||
OpStore %res %13
|
|
||||||
OpReturn
|
OpReturn
|
||||||
OpFunctionEnd
|
OpFunctionEnd
|
||||||
%vertex_main_inner = OpFunction %v4float None %22
|
%vertex_main_inner = OpFunction %v4float None %20
|
||||||
%24 = OpLabel
|
%22 = OpLabel
|
||||||
%25 = OpFunctionCall %void %refract_0594ba
|
%23 = OpFunctionCall %void %refract_0594ba
|
||||||
OpReturnValue %5
|
OpReturnValue %5
|
||||||
OpFunctionEnd
|
OpFunctionEnd
|
||||||
%vertex_main = OpFunction %void None %9
|
%vertex_main = OpFunction %void None %9
|
||||||
%27 = OpLabel
|
%25 = OpLabel
|
||||||
%28 = OpFunctionCall %v4float %vertex_main_inner
|
%26 = OpFunctionCall %v4float %vertex_main_inner
|
||||||
OpStore %value %28
|
OpStore %value %26
|
||||||
OpStore %vertex_point_size %float_1
|
OpStore %vertex_point_size %float_1
|
||||||
OpReturn
|
OpReturn
|
||||||
OpFunctionEnd
|
OpFunctionEnd
|
||||||
%fragment_main = OpFunction %void None %9
|
%fragment_main = OpFunction %void None %9
|
||||||
%31 = OpLabel
|
%29 = OpLabel
|
||||||
%32 = OpFunctionCall %void %refract_0594ba
|
%30 = OpFunctionCall %void %refract_0594ba
|
||||||
OpReturn
|
OpReturn
|
||||||
OpFunctionEnd
|
OpFunctionEnd
|
||||||
%compute_main = OpFunction %void None %9
|
%compute_main = OpFunction %void None %9
|
||||||
%34 = OpLabel
|
%32 = OpLabel
|
||||||
%35 = OpFunctionCall %void %refract_0594ba
|
%33 = OpFunctionCall %void %refract_0594ba
|
||||||
OpReturn
|
OpReturn
|
||||||
OpFunctionEnd
|
OpFunctionEnd
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
void refract_570cb3() {
|
void refract_570cb3() {
|
||||||
vector<float16_t, 2> res = refract((float16_t(1.0h)).xx, (float16_t(1.0h)).xx, float16_t(1.0h));
|
vector<float16_t, 2> res = (float16_t(-3.0h)).xx;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tint_symbol {
|
struct tint_symbol {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#extension GL_AMD_gpu_shader_half_float : require
|
#extension GL_AMD_gpu_shader_half_float : require
|
||||||
|
|
||||||
void refract_570cb3() {
|
void refract_570cb3() {
|
||||||
f16vec2 res = refract(f16vec2(1.0hf), f16vec2(1.0hf), 1.0hf);
|
f16vec2 res = f16vec2(-3.0hf);
|
||||||
}
|
}
|
||||||
|
|
||||||
vec4 vertex_main() {
|
vec4 vertex_main() {
|
||||||
@ -23,7 +23,7 @@ void main() {
|
|||||||
precision mediump float;
|
precision mediump float;
|
||||||
|
|
||||||
void refract_570cb3() {
|
void refract_570cb3() {
|
||||||
f16vec2 res = refract(f16vec2(1.0hf), f16vec2(1.0hf), 1.0hf);
|
f16vec2 res = f16vec2(-3.0hf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fragment_main() {
|
void fragment_main() {
|
||||||
@ -38,7 +38,7 @@ void main() {
|
|||||||
#extension GL_AMD_gpu_shader_half_float : require
|
#extension GL_AMD_gpu_shader_half_float : require
|
||||||
|
|
||||||
void refract_570cb3() {
|
void refract_570cb3() {
|
||||||
f16vec2 res = refract(f16vec2(1.0hf), f16vec2(1.0hf), 1.0hf);
|
f16vec2 res = f16vec2(-3.0hf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void compute_main() {
|
void compute_main() {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
using namespace metal;
|
using namespace metal;
|
||||||
void refract_570cb3() {
|
void refract_570cb3() {
|
||||||
half2 res = refract(half2(1.0h), half2(1.0h), 1.0h);
|
half2 res = half2(-3.0h);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tint_symbol {
|
struct tint_symbol {
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
; SPIR-V
|
; SPIR-V
|
||||||
; Version: 1.3
|
; Version: 1.3
|
||||||
; Generator: Google Tint Compiler; 0
|
; Generator: Google Tint Compiler; 0
|
||||||
; Bound: 36
|
; Bound: 34
|
||||||
; Schema: 0
|
; Schema: 0
|
||||||
OpCapability Shader
|
OpCapability Shader
|
||||||
OpCapability Float16
|
OpCapability Float16
|
||||||
OpCapability UniformAndStorageBuffer16BitAccess
|
OpCapability UniformAndStorageBuffer16BitAccess
|
||||||
OpCapability StorageBuffer16BitAccess
|
OpCapability StorageBuffer16BitAccess
|
||||||
OpCapability StorageInputOutput16
|
OpCapability StorageInputOutput16
|
||||||
%16 = OpExtInstImport "GLSL.std.450"
|
|
||||||
OpMemoryModel Logical GLSL450
|
OpMemoryModel Logical GLSL450
|
||||||
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||||
@ -37,38 +36,37 @@
|
|||||||
%9 = OpTypeFunction %void
|
%9 = OpTypeFunction %void
|
||||||
%half = OpTypeFloat 16
|
%half = OpTypeFloat 16
|
||||||
%v2half = OpTypeVector %half 2
|
%v2half = OpTypeVector %half 2
|
||||||
%half_0x1p_0 = OpConstant %half 0x1p+0
|
%half_n0x1_8p_1 = OpConstant %half -0x1.8p+1
|
||||||
%18 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_0
|
%16 = OpConstantComposite %v2half %half_n0x1_8p_1 %half_n0x1_8p_1
|
||||||
%_ptr_Function_v2half = OpTypePointer Function %v2half
|
%_ptr_Function_v2half = OpTypePointer Function %v2half
|
||||||
%21 = OpConstantNull %v2half
|
%19 = OpConstantNull %v2half
|
||||||
%22 = OpTypeFunction %v4float
|
%20 = OpTypeFunction %v4float
|
||||||
%float_1 = OpConstant %float 1
|
%float_1 = OpConstant %float 1
|
||||||
%refract_570cb3 = OpFunction %void None %9
|
%refract_570cb3 = OpFunction %void None %9
|
||||||
%12 = OpLabel
|
%12 = OpLabel
|
||||||
%res = OpVariable %_ptr_Function_v2half Function %21
|
%res = OpVariable %_ptr_Function_v2half Function %19
|
||||||
%13 = OpExtInst %v2half %16 Refract %18 %18 %half_0x1p_0
|
OpStore %res %16
|
||||||
OpStore %res %13
|
|
||||||
OpReturn
|
OpReturn
|
||||||
OpFunctionEnd
|
OpFunctionEnd
|
||||||
%vertex_main_inner = OpFunction %v4float None %22
|
%vertex_main_inner = OpFunction %v4float None %20
|
||||||
%24 = OpLabel
|
%22 = OpLabel
|
||||||
%25 = OpFunctionCall %void %refract_570cb3
|
%23 = OpFunctionCall %void %refract_570cb3
|
||||||
OpReturnValue %5
|
OpReturnValue %5
|
||||||
OpFunctionEnd
|
OpFunctionEnd
|
||||||
%vertex_main = OpFunction %void None %9
|
%vertex_main = OpFunction %void None %9
|
||||||
%27 = OpLabel
|
%25 = OpLabel
|
||||||
%28 = OpFunctionCall %v4float %vertex_main_inner
|
%26 = OpFunctionCall %v4float %vertex_main_inner
|
||||||
OpStore %value %28
|
OpStore %value %26
|
||||||
OpStore %vertex_point_size %float_1
|
OpStore %vertex_point_size %float_1
|
||||||
OpReturn
|
OpReturn
|
||||||
OpFunctionEnd
|
OpFunctionEnd
|
||||||
%fragment_main = OpFunction %void None %9
|
%fragment_main = OpFunction %void None %9
|
||||||
%31 = OpLabel
|
%29 = OpLabel
|
||||||
%32 = OpFunctionCall %void %refract_570cb3
|
%30 = OpFunctionCall %void %refract_570cb3
|
||||||
OpReturn
|
OpReturn
|
||||||
OpFunctionEnd
|
OpFunctionEnd
|
||||||
%compute_main = OpFunction %void None %9
|
%compute_main = OpFunction %void None %9
|
||||||
%34 = OpLabel
|
%32 = OpLabel
|
||||||
%35 = OpFunctionCall %void %refract_570cb3
|
%33 = OpFunctionCall %void %refract_570cb3
|
||||||
OpReturn
|
OpReturn
|
||||||
OpFunctionEnd
|
OpFunctionEnd
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
void refract_7e02e6() {
|
void refract_7e02e6() {
|
||||||
float4 res = refract((1.0f).xxxx, (1.0f).xxxx, 1.0f);
|
float4 res = (-7.0f).xxxx;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tint_symbol {
|
struct tint_symbol {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
void refract_7e02e6() {
|
void refract_7e02e6() {
|
||||||
float4 res = refract((1.0f).xxxx, (1.0f).xxxx, 1.0f);
|
float4 res = (-7.0f).xxxx;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tint_symbol {
|
struct tint_symbol {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#version 310 es
|
#version 310 es
|
||||||
|
|
||||||
void refract_7e02e6() {
|
void refract_7e02e6() {
|
||||||
vec4 res = refract(vec4(1.0f), vec4(1.0f), 1.0f);
|
vec4 res = vec4(-7.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
vec4 vertex_main() {
|
vec4 vertex_main() {
|
||||||
@ -21,7 +21,7 @@ void main() {
|
|||||||
precision mediump float;
|
precision mediump float;
|
||||||
|
|
||||||
void refract_7e02e6() {
|
void refract_7e02e6() {
|
||||||
vec4 res = refract(vec4(1.0f), vec4(1.0f), 1.0f);
|
vec4 res = vec4(-7.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fragment_main() {
|
void fragment_main() {
|
||||||
@ -35,7 +35,7 @@ void main() {
|
|||||||
#version 310 es
|
#version 310 es
|
||||||
|
|
||||||
void refract_7e02e6() {
|
void refract_7e02e6() {
|
||||||
vec4 res = refract(vec4(1.0f), vec4(1.0f), 1.0f);
|
vec4 res = vec4(-7.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void compute_main() {
|
void compute_main() {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
using namespace metal;
|
using namespace metal;
|
||||||
void refract_7e02e6() {
|
void refract_7e02e6() {
|
||||||
float4 res = refract(float4(1.0f), float4(1.0f), 1.0f);
|
float4 res = float4(-7.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tint_symbol {
|
struct tint_symbol {
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
; SPIR-V
|
; SPIR-V
|
||||||
; Version: 1.3
|
; Version: 1.3
|
||||||
; Generator: Google Tint Compiler; 0
|
; Generator: Google Tint Compiler; 0
|
||||||
; Bound: 32
|
; Bound: 31
|
||||||
; Schema: 0
|
; Schema: 0
|
||||||
OpCapability Shader
|
OpCapability Shader
|
||||||
%14 = OpExtInstImport "GLSL.std.450"
|
|
||||||
OpMemoryModel Logical GLSL450
|
OpMemoryModel Logical GLSL450
|
||||||
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||||
@ -31,36 +30,36 @@
|
|||||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||||
%void = OpTypeVoid
|
%void = OpTypeVoid
|
||||||
%9 = OpTypeFunction %void
|
%9 = OpTypeFunction %void
|
||||||
%float_1 = OpConstant %float 1
|
%float_n7 = OpConstant %float -7
|
||||||
%16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
|
%14 = OpConstantComposite %v4float %float_n7 %float_n7 %float_n7 %float_n7
|
||||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||||
%19 = OpTypeFunction %v4float
|
%17 = OpTypeFunction %v4float
|
||||||
|
%float_1 = OpConstant %float 1
|
||||||
%refract_7e02e6 = OpFunction %void None %9
|
%refract_7e02e6 = OpFunction %void None %9
|
||||||
%12 = OpLabel
|
%12 = OpLabel
|
||||||
%res = OpVariable %_ptr_Function_v4float Function %5
|
%res = OpVariable %_ptr_Function_v4float Function %5
|
||||||
%13 = OpExtInst %v4float %14 Refract %16 %16 %float_1
|
OpStore %res %14
|
||||||
OpStore %res %13
|
|
||||||
OpReturn
|
OpReturn
|
||||||
OpFunctionEnd
|
OpFunctionEnd
|
||||||
%vertex_main_inner = OpFunction %v4float None %19
|
%vertex_main_inner = OpFunction %v4float None %17
|
||||||
%21 = OpLabel
|
%19 = OpLabel
|
||||||
%22 = OpFunctionCall %void %refract_7e02e6
|
%20 = OpFunctionCall %void %refract_7e02e6
|
||||||
OpReturnValue %5
|
OpReturnValue %5
|
||||||
OpFunctionEnd
|
OpFunctionEnd
|
||||||
%vertex_main = OpFunction %void None %9
|
%vertex_main = OpFunction %void None %9
|
||||||
%24 = OpLabel
|
%22 = OpLabel
|
||||||
%25 = OpFunctionCall %v4float %vertex_main_inner
|
%23 = OpFunctionCall %v4float %vertex_main_inner
|
||||||
OpStore %value %25
|
OpStore %value %23
|
||||||
OpStore %vertex_point_size %float_1
|
OpStore %vertex_point_size %float_1
|
||||||
OpReturn
|
OpReturn
|
||||||
OpFunctionEnd
|
OpFunctionEnd
|
||||||
%fragment_main = OpFunction %void None %9
|
%fragment_main = OpFunction %void None %9
|
||||||
%27 = OpLabel
|
%26 = OpLabel
|
||||||
%28 = OpFunctionCall %void %refract_7e02e6
|
%27 = OpFunctionCall %void %refract_7e02e6
|
||||||
OpReturn
|
OpReturn
|
||||||
OpFunctionEnd
|
OpFunctionEnd
|
||||||
%compute_main = OpFunction %void None %9
|
%compute_main = OpFunction %void None %9
|
||||||
%30 = OpLabel
|
%29 = OpLabel
|
||||||
%31 = OpFunctionCall %void %refract_7e02e6
|
%30 = OpFunctionCall %void %refract_7e02e6
|
||||||
OpReturn
|
OpReturn
|
||||||
OpFunctionEnd
|
OpFunctionEnd
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
void refract_8984af() {
|
void refract_8984af() {
|
||||||
vector<float16_t, 3> res = refract((float16_t(1.0h)).xxx, (float16_t(1.0h)).xxx, float16_t(1.0h));
|
vector<float16_t, 3> res = (float16_t(-5.0h)).xxx;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tint_symbol {
|
struct tint_symbol {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#extension GL_AMD_gpu_shader_half_float : require
|
#extension GL_AMD_gpu_shader_half_float : require
|
||||||
|
|
||||||
void refract_8984af() {
|
void refract_8984af() {
|
||||||
f16vec3 res = refract(f16vec3(1.0hf), f16vec3(1.0hf), 1.0hf);
|
f16vec3 res = f16vec3(-5.0hf);
|
||||||
}
|
}
|
||||||
|
|
||||||
vec4 vertex_main() {
|
vec4 vertex_main() {
|
||||||
@ -23,7 +23,7 @@ void main() {
|
|||||||
precision mediump float;
|
precision mediump float;
|
||||||
|
|
||||||
void refract_8984af() {
|
void refract_8984af() {
|
||||||
f16vec3 res = refract(f16vec3(1.0hf), f16vec3(1.0hf), 1.0hf);
|
f16vec3 res = f16vec3(-5.0hf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fragment_main() {
|
void fragment_main() {
|
||||||
@ -38,7 +38,7 @@ void main() {
|
|||||||
#extension GL_AMD_gpu_shader_half_float : require
|
#extension GL_AMD_gpu_shader_half_float : require
|
||||||
|
|
||||||
void refract_8984af() {
|
void refract_8984af() {
|
||||||
f16vec3 res = refract(f16vec3(1.0hf), f16vec3(1.0hf), 1.0hf);
|
f16vec3 res = f16vec3(-5.0hf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void compute_main() {
|
void compute_main() {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
using namespace metal;
|
using namespace metal;
|
||||||
void refract_8984af() {
|
void refract_8984af() {
|
||||||
half3 res = refract(half3(1.0h), half3(1.0h), 1.0h);
|
half3 res = half3(-5.0h);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tint_symbol {
|
struct tint_symbol {
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
; SPIR-V
|
; SPIR-V
|
||||||
; Version: 1.3
|
; Version: 1.3
|
||||||
; Generator: Google Tint Compiler; 0
|
; Generator: Google Tint Compiler; 0
|
||||||
; Bound: 36
|
; Bound: 34
|
||||||
; Schema: 0
|
; Schema: 0
|
||||||
OpCapability Shader
|
OpCapability Shader
|
||||||
OpCapability Float16
|
OpCapability Float16
|
||||||
OpCapability UniformAndStorageBuffer16BitAccess
|
OpCapability UniformAndStorageBuffer16BitAccess
|
||||||
OpCapability StorageBuffer16BitAccess
|
OpCapability StorageBuffer16BitAccess
|
||||||
OpCapability StorageInputOutput16
|
OpCapability StorageInputOutput16
|
||||||
%16 = OpExtInstImport "GLSL.std.450"
|
|
||||||
OpMemoryModel Logical GLSL450
|
OpMemoryModel Logical GLSL450
|
||||||
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||||
@ -37,38 +36,37 @@
|
|||||||
%9 = OpTypeFunction %void
|
%9 = OpTypeFunction %void
|
||||||
%half = OpTypeFloat 16
|
%half = OpTypeFloat 16
|
||||||
%v3half = OpTypeVector %half 3
|
%v3half = OpTypeVector %half 3
|
||||||
%half_0x1p_0 = OpConstant %half 0x1p+0
|
%half_n0x1_4p_2 = OpConstant %half -0x1.4p+2
|
||||||
%18 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0
|
%16 = OpConstantComposite %v3half %half_n0x1_4p_2 %half_n0x1_4p_2 %half_n0x1_4p_2
|
||||||
%_ptr_Function_v3half = OpTypePointer Function %v3half
|
%_ptr_Function_v3half = OpTypePointer Function %v3half
|
||||||
%21 = OpConstantNull %v3half
|
%19 = OpConstantNull %v3half
|
||||||
%22 = OpTypeFunction %v4float
|
%20 = OpTypeFunction %v4float
|
||||||
%float_1 = OpConstant %float 1
|
%float_1 = OpConstant %float 1
|
||||||
%refract_8984af = OpFunction %void None %9
|
%refract_8984af = OpFunction %void None %9
|
||||||
%12 = OpLabel
|
%12 = OpLabel
|
||||||
%res = OpVariable %_ptr_Function_v3half Function %21
|
%res = OpVariable %_ptr_Function_v3half Function %19
|
||||||
%13 = OpExtInst %v3half %16 Refract %18 %18 %half_0x1p_0
|
OpStore %res %16
|
||||||
OpStore %res %13
|
|
||||||
OpReturn
|
OpReturn
|
||||||
OpFunctionEnd
|
OpFunctionEnd
|
||||||
%vertex_main_inner = OpFunction %v4float None %22
|
%vertex_main_inner = OpFunction %v4float None %20
|
||||||
%24 = OpLabel
|
%22 = OpLabel
|
||||||
%25 = OpFunctionCall %void %refract_8984af
|
%23 = OpFunctionCall %void %refract_8984af
|
||||||
OpReturnValue %5
|
OpReturnValue %5
|
||||||
OpFunctionEnd
|
OpFunctionEnd
|
||||||
%vertex_main = OpFunction %void None %9
|
%vertex_main = OpFunction %void None %9
|
||||||
%27 = OpLabel
|
%25 = OpLabel
|
||||||
%28 = OpFunctionCall %v4float %vertex_main_inner
|
%26 = OpFunctionCall %v4float %vertex_main_inner
|
||||||
OpStore %value %28
|
OpStore %value %26
|
||||||
OpStore %vertex_point_size %float_1
|
OpStore %vertex_point_size %float_1
|
||||||
OpReturn
|
OpReturn
|
||||||
OpFunctionEnd
|
OpFunctionEnd
|
||||||
%fragment_main = OpFunction %void None %9
|
%fragment_main = OpFunction %void None %9
|
||||||
%31 = OpLabel
|
%29 = OpLabel
|
||||||
%32 = OpFunctionCall %void %refract_8984af
|
%30 = OpFunctionCall %void %refract_8984af
|
||||||
OpReturn
|
OpReturn
|
||||||
OpFunctionEnd
|
OpFunctionEnd
|
||||||
%compute_main = OpFunction %void None %9
|
%compute_main = OpFunction %void None %9
|
||||||
%34 = OpLabel
|
%32 = OpLabel
|
||||||
%35 = OpFunctionCall %void %refract_8984af
|
%33 = OpFunctionCall %void %refract_8984af
|
||||||
OpReturn
|
OpReturn
|
||||||
OpFunctionEnd
|
OpFunctionEnd
|
||||||
|
43
test/tint/builtins/gen/literal/refract/8c192a.wgsl
Normal file
43
test/tint/builtins/gen/literal/refract/8c192a.wgsl
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
// Copyright 2022 The Tint Authors.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// File generated by tools/src/cmd/gen
|
||||||
|
// using the template:
|
||||||
|
// test/tint/builtins/gen/gen.wgsl.tmpl
|
||||||
|
//
|
||||||
|
// Do not modify this file directly
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
// fn refract(vec<4, fa>, vec<4, fa>, fa) -> vec<4, fa>
|
||||||
|
fn refract_8c192a() {
|
||||||
|
var res = refract(vec4(1.), vec4(1.), 1.);
|
||||||
|
}
|
||||||
|
|
||||||
|
@vertex
|
||||||
|
fn vertex_main() -> @builtin(position) vec4<f32> {
|
||||||
|
refract_8c192a();
|
||||||
|
return vec4<f32>();
|
||||||
|
}
|
||||||
|
|
||||||
|
@fragment
|
||||||
|
fn fragment_main() {
|
||||||
|
refract_8c192a();
|
||||||
|
}
|
||||||
|
|
||||||
|
@compute @workgroup_size(1)
|
||||||
|
fn compute_main() {
|
||||||
|
refract_8c192a();
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
void refract_8c192a() {
|
||||||
|
float4 res = (-7.0f).xxxx;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct tint_symbol {
|
||||||
|
float4 value : SV_Position;
|
||||||
|
};
|
||||||
|
|
||||||
|
float4 vertex_main_inner() {
|
||||||
|
refract_8c192a();
|
||||||
|
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() {
|
||||||
|
refract_8c192a();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
[numthreads(1, 1, 1)]
|
||||||
|
void compute_main() {
|
||||||
|
refract_8c192a();
|
||||||
|
return;
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
void refract_8c192a() {
|
||||||
|
float4 res = (-7.0f).xxxx;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct tint_symbol {
|
||||||
|
float4 value : SV_Position;
|
||||||
|
};
|
||||||
|
|
||||||
|
float4 vertex_main_inner() {
|
||||||
|
refract_8c192a();
|
||||||
|
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() {
|
||||||
|
refract_8c192a();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
[numthreads(1, 1, 1)]
|
||||||
|
void compute_main() {
|
||||||
|
refract_8c192a();
|
||||||
|
return;
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
#version 310 es
|
||||||
|
|
||||||
|
void refract_8c192a() {
|
||||||
|
vec4 res = vec4(-7.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 vertex_main() {
|
||||||
|
refract_8c192a();
|
||||||
|
return vec4(0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
gl_PointSize = 1.0;
|
||||||
|
vec4 inner_result = vertex_main();
|
||||||
|
gl_Position = inner_result;
|
||||||
|
gl_Position.y = -(gl_Position.y);
|
||||||
|
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#version 310 es
|
||||||
|
precision mediump float;
|
||||||
|
|
||||||
|
void refract_8c192a() {
|
||||||
|
vec4 res = vec4(-7.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void fragment_main() {
|
||||||
|
refract_8c192a();
|
||||||
|
}
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
fragment_main();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#version 310 es
|
||||||
|
|
||||||
|
void refract_8c192a() {
|
||||||
|
vec4 res = vec4(-7.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void compute_main() {
|
||||||
|
refract_8c192a();
|
||||||
|
}
|
||||||
|
|
||||||
|
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 refract_8c192a() {
|
||||||
|
float4 res = float4(-7.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct tint_symbol {
|
||||||
|
float4 value [[position]];
|
||||||
|
};
|
||||||
|
|
||||||
|
float4 vertex_main_inner() {
|
||||||
|
refract_8c192a();
|
||||||
|
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() {
|
||||||
|
refract_8c192a();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
kernel void compute_main() {
|
||||||
|
refract_8c192a();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,65 @@
|
|||||||
|
; SPIR-V
|
||||||
|
; Version: 1.3
|
||||||
|
; Generator: Google Tint Compiler; 0
|
||||||
|
; Bound: 31
|
||||||
|
; Schema: 0
|
||||||
|
OpCapability Shader
|
||||||
|
OpMemoryModel Logical GLSL450
|
||||||
|
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||||
|
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||||
|
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||||
|
OpExecutionMode %fragment_main OriginUpperLeft
|
||||||
|
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||||
|
OpName %value "value"
|
||||||
|
OpName %vertex_point_size "vertex_point_size"
|
||||||
|
OpName %refract_8c192a "refract_8c192a"
|
||||||
|
OpName %res "res"
|
||||||
|
OpName %vertex_main_inner "vertex_main_inner"
|
||||||
|
OpName %vertex_main "vertex_main"
|
||||||
|
OpName %fragment_main "fragment_main"
|
||||||
|
OpName %compute_main "compute_main"
|
||||||
|
OpDecorate %value BuiltIn Position
|
||||||
|
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||||
|
%float = OpTypeFloat 32
|
||||||
|
%v4float = OpTypeVector %float 4
|
||||||
|
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||||
|
%5 = OpConstantNull %v4float
|
||||||
|
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||||
|
%_ptr_Output_float = OpTypePointer Output %float
|
||||||
|
%8 = OpConstantNull %float
|
||||||
|
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||||
|
%void = OpTypeVoid
|
||||||
|
%9 = OpTypeFunction %void
|
||||||
|
%float_n7 = OpConstant %float -7
|
||||||
|
%14 = OpConstantComposite %v4float %float_n7 %float_n7 %float_n7 %float_n7
|
||||||
|
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||||
|
%17 = OpTypeFunction %v4float
|
||||||
|
%float_1 = OpConstant %float 1
|
||||||
|
%refract_8c192a = OpFunction %void None %9
|
||||||
|
%12 = OpLabel
|
||||||
|
%res = OpVariable %_ptr_Function_v4float Function %5
|
||||||
|
OpStore %res %14
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%vertex_main_inner = OpFunction %v4float None %17
|
||||||
|
%19 = OpLabel
|
||||||
|
%20 = OpFunctionCall %void %refract_8c192a
|
||||||
|
OpReturnValue %5
|
||||||
|
OpFunctionEnd
|
||||||
|
%vertex_main = OpFunction %void None %9
|
||||||
|
%22 = OpLabel
|
||||||
|
%23 = OpFunctionCall %v4float %vertex_main_inner
|
||||||
|
OpStore %value %23
|
||||||
|
OpStore %vertex_point_size %float_1
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%fragment_main = OpFunction %void None %9
|
||||||
|
%26 = OpLabel
|
||||||
|
%27 = OpFunctionCall %void %refract_8c192a
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%compute_main = OpFunction %void None %9
|
||||||
|
%29 = OpLabel
|
||||||
|
%30 = OpFunctionCall %void %refract_8c192a
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
@ -0,0 +1,19 @@
|
|||||||
|
fn refract_8c192a() {
|
||||||
|
var res = refract(vec4(1.0), vec4(1.0), 1.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@vertex
|
||||||
|
fn vertex_main() -> @builtin(position) vec4<f32> {
|
||||||
|
refract_8c192a();
|
||||||
|
return vec4<f32>();
|
||||||
|
}
|
||||||
|
|
||||||
|
@fragment
|
||||||
|
fn fragment_main() {
|
||||||
|
refract_8c192a();
|
||||||
|
}
|
||||||
|
|
||||||
|
@compute @workgroup_size(1)
|
||||||
|
fn compute_main() {
|
||||||
|
refract_8c192a();
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
void refract_cbc1d2() {
|
void refract_cbc1d2() {
|
||||||
float3 res = refract((1.0f).xxx, (1.0f).xxx, 1.0f);
|
float3 res = (-5.0f).xxx;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tint_symbol {
|
struct tint_symbol {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
void refract_cbc1d2() {
|
void refract_cbc1d2() {
|
||||||
float3 res = refract((1.0f).xxx, (1.0f).xxx, 1.0f);
|
float3 res = (-5.0f).xxx;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tint_symbol {
|
struct tint_symbol {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#version 310 es
|
#version 310 es
|
||||||
|
|
||||||
void refract_cbc1d2() {
|
void refract_cbc1d2() {
|
||||||
vec3 res = refract(vec3(1.0f), vec3(1.0f), 1.0f);
|
vec3 res = vec3(-5.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
vec4 vertex_main() {
|
vec4 vertex_main() {
|
||||||
@ -21,7 +21,7 @@ void main() {
|
|||||||
precision mediump float;
|
precision mediump float;
|
||||||
|
|
||||||
void refract_cbc1d2() {
|
void refract_cbc1d2() {
|
||||||
vec3 res = refract(vec3(1.0f), vec3(1.0f), 1.0f);
|
vec3 res = vec3(-5.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fragment_main() {
|
void fragment_main() {
|
||||||
@ -35,7 +35,7 @@ void main() {
|
|||||||
#version 310 es
|
#version 310 es
|
||||||
|
|
||||||
void refract_cbc1d2() {
|
void refract_cbc1d2() {
|
||||||
vec3 res = refract(vec3(1.0f), vec3(1.0f), 1.0f);
|
vec3 res = vec3(-5.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void compute_main() {
|
void compute_main() {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
using namespace metal;
|
using namespace metal;
|
||||||
void refract_cbc1d2() {
|
void refract_cbc1d2() {
|
||||||
float3 res = refract(float3(1.0f), float3(1.0f), 1.0f);
|
float3 res = float3(-5.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tint_symbol {
|
struct tint_symbol {
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
; SPIR-V
|
; SPIR-V
|
||||||
; Version: 1.3
|
; Version: 1.3
|
||||||
; Generator: Google Tint Compiler; 0
|
; Generator: Google Tint Compiler; 0
|
||||||
; Bound: 34
|
; Bound: 33
|
||||||
; Schema: 0
|
; Schema: 0
|
||||||
OpCapability Shader
|
OpCapability Shader
|
||||||
%15 = OpExtInstImport "GLSL.std.450"
|
|
||||||
OpMemoryModel Logical GLSL450
|
OpMemoryModel Logical GLSL450
|
||||||
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||||
@ -32,37 +31,37 @@
|
|||||||
%void = OpTypeVoid
|
%void = OpTypeVoid
|
||||||
%9 = OpTypeFunction %void
|
%9 = OpTypeFunction %void
|
||||||
%v3float = OpTypeVector %float 3
|
%v3float = OpTypeVector %float 3
|
||||||
%float_1 = OpConstant %float 1
|
%float_n5 = OpConstant %float -5
|
||||||
%17 = OpConstantComposite %v3float %float_1 %float_1 %float_1
|
%15 = OpConstantComposite %v3float %float_n5 %float_n5 %float_n5
|
||||||
%_ptr_Function_v3float = OpTypePointer Function %v3float
|
%_ptr_Function_v3float = OpTypePointer Function %v3float
|
||||||
%20 = OpConstantNull %v3float
|
%18 = OpConstantNull %v3float
|
||||||
%21 = OpTypeFunction %v4float
|
%19 = OpTypeFunction %v4float
|
||||||
|
%float_1 = OpConstant %float 1
|
||||||
%refract_cbc1d2 = OpFunction %void None %9
|
%refract_cbc1d2 = OpFunction %void None %9
|
||||||
%12 = OpLabel
|
%12 = OpLabel
|
||||||
%res = OpVariable %_ptr_Function_v3float Function %20
|
%res = OpVariable %_ptr_Function_v3float Function %18
|
||||||
%13 = OpExtInst %v3float %15 Refract %17 %17 %float_1
|
OpStore %res %15
|
||||||
OpStore %res %13
|
|
||||||
OpReturn
|
OpReturn
|
||||||
OpFunctionEnd
|
OpFunctionEnd
|
||||||
%vertex_main_inner = OpFunction %v4float None %21
|
%vertex_main_inner = OpFunction %v4float None %19
|
||||||
%23 = OpLabel
|
%21 = OpLabel
|
||||||
%24 = OpFunctionCall %void %refract_cbc1d2
|
%22 = OpFunctionCall %void %refract_cbc1d2
|
||||||
OpReturnValue %5
|
OpReturnValue %5
|
||||||
OpFunctionEnd
|
OpFunctionEnd
|
||||||
%vertex_main = OpFunction %void None %9
|
%vertex_main = OpFunction %void None %9
|
||||||
%26 = OpLabel
|
%24 = OpLabel
|
||||||
%27 = OpFunctionCall %v4float %vertex_main_inner
|
%25 = OpFunctionCall %v4float %vertex_main_inner
|
||||||
OpStore %value %27
|
OpStore %value %25
|
||||||
OpStore %vertex_point_size %float_1
|
OpStore %vertex_point_size %float_1
|
||||||
OpReturn
|
OpReturn
|
||||||
OpFunctionEnd
|
OpFunctionEnd
|
||||||
%fragment_main = OpFunction %void None %9
|
%fragment_main = OpFunction %void None %9
|
||||||
%29 = OpLabel
|
%28 = OpLabel
|
||||||
%30 = OpFunctionCall %void %refract_cbc1d2
|
%29 = OpFunctionCall %void %refract_cbc1d2
|
||||||
OpReturn
|
OpReturn
|
||||||
OpFunctionEnd
|
OpFunctionEnd
|
||||||
%compute_main = OpFunction %void None %9
|
%compute_main = OpFunction %void None %9
|
||||||
%32 = OpLabel
|
%31 = OpLabel
|
||||||
%33 = OpFunctionCall %void %refract_cbc1d2
|
%32 = OpFunctionCall %void %refract_cbc1d2
|
||||||
OpReturn
|
OpReturn
|
||||||
OpFunctionEnd
|
OpFunctionEnd
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
void refract_cd905f() {
|
void refract_cd905f() {
|
||||||
float2 res = refract((1.0f).xx, (1.0f).xx, 1.0f);
|
float2 res = (-3.0f).xx;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tint_symbol {
|
struct tint_symbol {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
void refract_cd905f() {
|
void refract_cd905f() {
|
||||||
float2 res = refract((1.0f).xx, (1.0f).xx, 1.0f);
|
float2 res = (-3.0f).xx;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tint_symbol {
|
struct tint_symbol {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#version 310 es
|
#version 310 es
|
||||||
|
|
||||||
void refract_cd905f() {
|
void refract_cd905f() {
|
||||||
vec2 res = refract(vec2(1.0f), vec2(1.0f), 1.0f);
|
vec2 res = vec2(-3.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
vec4 vertex_main() {
|
vec4 vertex_main() {
|
||||||
@ -21,7 +21,7 @@ void main() {
|
|||||||
precision mediump float;
|
precision mediump float;
|
||||||
|
|
||||||
void refract_cd905f() {
|
void refract_cd905f() {
|
||||||
vec2 res = refract(vec2(1.0f), vec2(1.0f), 1.0f);
|
vec2 res = vec2(-3.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fragment_main() {
|
void fragment_main() {
|
||||||
@ -35,7 +35,7 @@ void main() {
|
|||||||
#version 310 es
|
#version 310 es
|
||||||
|
|
||||||
void refract_cd905f() {
|
void refract_cd905f() {
|
||||||
vec2 res = refract(vec2(1.0f), vec2(1.0f), 1.0f);
|
vec2 res = vec2(-3.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void compute_main() {
|
void compute_main() {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
using namespace metal;
|
using namespace metal;
|
||||||
void refract_cd905f() {
|
void refract_cd905f() {
|
||||||
float2 res = refract(float2(1.0f), float2(1.0f), 1.0f);
|
float2 res = float2(-3.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tint_symbol {
|
struct tint_symbol {
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
; SPIR-V
|
; SPIR-V
|
||||||
; Version: 1.3
|
; Version: 1.3
|
||||||
; Generator: Google Tint Compiler; 0
|
; Generator: Google Tint Compiler; 0
|
||||||
; Bound: 34
|
; Bound: 33
|
||||||
; Schema: 0
|
; Schema: 0
|
||||||
OpCapability Shader
|
OpCapability Shader
|
||||||
%15 = OpExtInstImport "GLSL.std.450"
|
|
||||||
OpMemoryModel Logical GLSL450
|
OpMemoryModel Logical GLSL450
|
||||||
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||||
@ -32,37 +31,37 @@
|
|||||||
%void = OpTypeVoid
|
%void = OpTypeVoid
|
||||||
%9 = OpTypeFunction %void
|
%9 = OpTypeFunction %void
|
||||||
%v2float = OpTypeVector %float 2
|
%v2float = OpTypeVector %float 2
|
||||||
%float_1 = OpConstant %float 1
|
%float_n3 = OpConstant %float -3
|
||||||
%17 = OpConstantComposite %v2float %float_1 %float_1
|
%15 = OpConstantComposite %v2float %float_n3 %float_n3
|
||||||
%_ptr_Function_v2float = OpTypePointer Function %v2float
|
%_ptr_Function_v2float = OpTypePointer Function %v2float
|
||||||
%20 = OpConstantNull %v2float
|
%18 = OpConstantNull %v2float
|
||||||
%21 = OpTypeFunction %v4float
|
%19 = OpTypeFunction %v4float
|
||||||
|
%float_1 = OpConstant %float 1
|
||||||
%refract_cd905f = OpFunction %void None %9
|
%refract_cd905f = OpFunction %void None %9
|
||||||
%12 = OpLabel
|
%12 = OpLabel
|
||||||
%res = OpVariable %_ptr_Function_v2float Function %20
|
%res = OpVariable %_ptr_Function_v2float Function %18
|
||||||
%13 = OpExtInst %v2float %15 Refract %17 %17 %float_1
|
OpStore %res %15
|
||||||
OpStore %res %13
|
|
||||||
OpReturn
|
OpReturn
|
||||||
OpFunctionEnd
|
OpFunctionEnd
|
||||||
%vertex_main_inner = OpFunction %v4float None %21
|
%vertex_main_inner = OpFunction %v4float None %19
|
||||||
%23 = OpLabel
|
%21 = OpLabel
|
||||||
%24 = OpFunctionCall %void %refract_cd905f
|
%22 = OpFunctionCall %void %refract_cd905f
|
||||||
OpReturnValue %5
|
OpReturnValue %5
|
||||||
OpFunctionEnd
|
OpFunctionEnd
|
||||||
%vertex_main = OpFunction %void None %9
|
%vertex_main = OpFunction %void None %9
|
||||||
%26 = OpLabel
|
%24 = OpLabel
|
||||||
%27 = OpFunctionCall %v4float %vertex_main_inner
|
%25 = OpFunctionCall %v4float %vertex_main_inner
|
||||||
OpStore %value %27
|
OpStore %value %25
|
||||||
OpStore %vertex_point_size %float_1
|
OpStore %vertex_point_size %float_1
|
||||||
OpReturn
|
OpReturn
|
||||||
OpFunctionEnd
|
OpFunctionEnd
|
||||||
%fragment_main = OpFunction %void None %9
|
%fragment_main = OpFunction %void None %9
|
||||||
%29 = OpLabel
|
%28 = OpLabel
|
||||||
%30 = OpFunctionCall %void %refract_cd905f
|
%29 = OpFunctionCall %void %refract_cd905f
|
||||||
OpReturn
|
OpReturn
|
||||||
OpFunctionEnd
|
OpFunctionEnd
|
||||||
%compute_main = OpFunction %void None %9
|
%compute_main = OpFunction %void None %9
|
||||||
%32 = OpLabel
|
%31 = OpLabel
|
||||||
%33 = OpFunctionCall %void %refract_cd905f
|
%32 = OpFunctionCall %void %refract_cd905f
|
||||||
OpReturn
|
OpReturn
|
||||||
OpFunctionEnd
|
OpFunctionEnd
|
||||||
|
43
test/tint/builtins/gen/literal/refract/cf1629.wgsl
Normal file
43
test/tint/builtins/gen/literal/refract/cf1629.wgsl
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
// Copyright 2022 The Tint Authors.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// File generated by tools/src/cmd/gen
|
||||||
|
// using the template:
|
||||||
|
// test/tint/builtins/gen/gen.wgsl.tmpl
|
||||||
|
//
|
||||||
|
// Do not modify this file directly
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
// fn refract(vec<2, fa>, vec<2, fa>, fa) -> vec<2, fa>
|
||||||
|
fn refract_cf1629() {
|
||||||
|
var res = refract(vec2(1.), vec2(1.), 1.);
|
||||||
|
}
|
||||||
|
|
||||||
|
@vertex
|
||||||
|
fn vertex_main() -> @builtin(position) vec4<f32> {
|
||||||
|
refract_cf1629();
|
||||||
|
return vec4<f32>();
|
||||||
|
}
|
||||||
|
|
||||||
|
@fragment
|
||||||
|
fn fragment_main() {
|
||||||
|
refract_cf1629();
|
||||||
|
}
|
||||||
|
|
||||||
|
@compute @workgroup_size(1)
|
||||||
|
fn compute_main() {
|
||||||
|
refract_cf1629();
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
void refract_cf1629() {
|
||||||
|
float2 res = (-3.0f).xx;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct tint_symbol {
|
||||||
|
float4 value : SV_Position;
|
||||||
|
};
|
||||||
|
|
||||||
|
float4 vertex_main_inner() {
|
||||||
|
refract_cf1629();
|
||||||
|
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() {
|
||||||
|
refract_cf1629();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
[numthreads(1, 1, 1)]
|
||||||
|
void compute_main() {
|
||||||
|
refract_cf1629();
|
||||||
|
return;
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
void refract_cf1629() {
|
||||||
|
float2 res = (-3.0f).xx;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct tint_symbol {
|
||||||
|
float4 value : SV_Position;
|
||||||
|
};
|
||||||
|
|
||||||
|
float4 vertex_main_inner() {
|
||||||
|
refract_cf1629();
|
||||||
|
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() {
|
||||||
|
refract_cf1629();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
[numthreads(1, 1, 1)]
|
||||||
|
void compute_main() {
|
||||||
|
refract_cf1629();
|
||||||
|
return;
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
#version 310 es
|
||||||
|
|
||||||
|
void refract_cf1629() {
|
||||||
|
vec2 res = vec2(-3.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 vertex_main() {
|
||||||
|
refract_cf1629();
|
||||||
|
return vec4(0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
gl_PointSize = 1.0;
|
||||||
|
vec4 inner_result = vertex_main();
|
||||||
|
gl_Position = inner_result;
|
||||||
|
gl_Position.y = -(gl_Position.y);
|
||||||
|
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#version 310 es
|
||||||
|
precision mediump float;
|
||||||
|
|
||||||
|
void refract_cf1629() {
|
||||||
|
vec2 res = vec2(-3.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void fragment_main() {
|
||||||
|
refract_cf1629();
|
||||||
|
}
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
fragment_main();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#version 310 es
|
||||||
|
|
||||||
|
void refract_cf1629() {
|
||||||
|
vec2 res = vec2(-3.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void compute_main() {
|
||||||
|
refract_cf1629();
|
||||||
|
}
|
||||||
|
|
||||||
|
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 refract_cf1629() {
|
||||||
|
float2 res = float2(-3.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct tint_symbol {
|
||||||
|
float4 value [[position]];
|
||||||
|
};
|
||||||
|
|
||||||
|
float4 vertex_main_inner() {
|
||||||
|
refract_cf1629();
|
||||||
|
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() {
|
||||||
|
refract_cf1629();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
kernel void compute_main() {
|
||||||
|
refract_cf1629();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,67 @@
|
|||||||
|
; SPIR-V
|
||||||
|
; Version: 1.3
|
||||||
|
; Generator: Google Tint Compiler; 0
|
||||||
|
; Bound: 33
|
||||||
|
; Schema: 0
|
||||||
|
OpCapability Shader
|
||||||
|
OpMemoryModel Logical GLSL450
|
||||||
|
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||||
|
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||||
|
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||||
|
OpExecutionMode %fragment_main OriginUpperLeft
|
||||||
|
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||||
|
OpName %value "value"
|
||||||
|
OpName %vertex_point_size "vertex_point_size"
|
||||||
|
OpName %refract_cf1629 "refract_cf1629"
|
||||||
|
OpName %res "res"
|
||||||
|
OpName %vertex_main_inner "vertex_main_inner"
|
||||||
|
OpName %vertex_main "vertex_main"
|
||||||
|
OpName %fragment_main "fragment_main"
|
||||||
|
OpName %compute_main "compute_main"
|
||||||
|
OpDecorate %value BuiltIn Position
|
||||||
|
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||||
|
%float = OpTypeFloat 32
|
||||||
|
%v4float = OpTypeVector %float 4
|
||||||
|
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||||
|
%5 = OpConstantNull %v4float
|
||||||
|
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||||
|
%_ptr_Output_float = OpTypePointer Output %float
|
||||||
|
%8 = OpConstantNull %float
|
||||||
|
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||||
|
%void = OpTypeVoid
|
||||||
|
%9 = OpTypeFunction %void
|
||||||
|
%v2float = OpTypeVector %float 2
|
||||||
|
%float_n3 = OpConstant %float -3
|
||||||
|
%15 = OpConstantComposite %v2float %float_n3 %float_n3
|
||||||
|
%_ptr_Function_v2float = OpTypePointer Function %v2float
|
||||||
|
%18 = OpConstantNull %v2float
|
||||||
|
%19 = OpTypeFunction %v4float
|
||||||
|
%float_1 = OpConstant %float 1
|
||||||
|
%refract_cf1629 = OpFunction %void None %9
|
||||||
|
%12 = OpLabel
|
||||||
|
%res = OpVariable %_ptr_Function_v2float Function %18
|
||||||
|
OpStore %res %15
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%vertex_main_inner = OpFunction %v4float None %19
|
||||||
|
%21 = OpLabel
|
||||||
|
%22 = OpFunctionCall %void %refract_cf1629
|
||||||
|
OpReturnValue %5
|
||||||
|
OpFunctionEnd
|
||||||
|
%vertex_main = OpFunction %void None %9
|
||||||
|
%24 = OpLabel
|
||||||
|
%25 = OpFunctionCall %v4float %vertex_main_inner
|
||||||
|
OpStore %value %25
|
||||||
|
OpStore %vertex_point_size %float_1
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%fragment_main = OpFunction %void None %9
|
||||||
|
%28 = OpLabel
|
||||||
|
%29 = OpFunctionCall %void %refract_cf1629
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%compute_main = OpFunction %void None %9
|
||||||
|
%31 = OpLabel
|
||||||
|
%32 = OpFunctionCall %void %refract_cf1629
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
@ -0,0 +1,19 @@
|
|||||||
|
fn refract_cf1629() {
|
||||||
|
var res = refract(vec2(1.0), vec2(1.0), 1.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@vertex
|
||||||
|
fn vertex_main() -> @builtin(position) vec4<f32> {
|
||||||
|
refract_cf1629();
|
||||||
|
return vec4<f32>();
|
||||||
|
}
|
||||||
|
|
||||||
|
@fragment
|
||||||
|
fn fragment_main() {
|
||||||
|
refract_cf1629();
|
||||||
|
}
|
||||||
|
|
||||||
|
@compute @workgroup_size(1)
|
||||||
|
fn compute_main() {
|
||||||
|
refract_cf1629();
|
||||||
|
}
|
43
test/tint/builtins/gen/literal/refract/d7569b.wgsl
Normal file
43
test/tint/builtins/gen/literal/refract/d7569b.wgsl
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
// Copyright 2022 The Tint Authors.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// File generated by tools/src/cmd/gen
|
||||||
|
// using the template:
|
||||||
|
// test/tint/builtins/gen/gen.wgsl.tmpl
|
||||||
|
//
|
||||||
|
// Do not modify this file directly
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
// fn refract(vec<3, fa>, vec<3, fa>, fa) -> vec<3, fa>
|
||||||
|
fn refract_d7569b() {
|
||||||
|
var res = refract(vec3(1.), vec3(1.), 1.);
|
||||||
|
}
|
||||||
|
|
||||||
|
@vertex
|
||||||
|
fn vertex_main() -> @builtin(position) vec4<f32> {
|
||||||
|
refract_d7569b();
|
||||||
|
return vec4<f32>();
|
||||||
|
}
|
||||||
|
|
||||||
|
@fragment
|
||||||
|
fn fragment_main() {
|
||||||
|
refract_d7569b();
|
||||||
|
}
|
||||||
|
|
||||||
|
@compute @workgroup_size(1)
|
||||||
|
fn compute_main() {
|
||||||
|
refract_d7569b();
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
void refract_d7569b() {
|
||||||
|
float3 res = (-5.0f).xxx;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct tint_symbol {
|
||||||
|
float4 value : SV_Position;
|
||||||
|
};
|
||||||
|
|
||||||
|
float4 vertex_main_inner() {
|
||||||
|
refract_d7569b();
|
||||||
|
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() {
|
||||||
|
refract_d7569b();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
[numthreads(1, 1, 1)]
|
||||||
|
void compute_main() {
|
||||||
|
refract_d7569b();
|
||||||
|
return;
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
void refract_d7569b() {
|
||||||
|
float3 res = (-5.0f).xxx;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct tint_symbol {
|
||||||
|
float4 value : SV_Position;
|
||||||
|
};
|
||||||
|
|
||||||
|
float4 vertex_main_inner() {
|
||||||
|
refract_d7569b();
|
||||||
|
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() {
|
||||||
|
refract_d7569b();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
[numthreads(1, 1, 1)]
|
||||||
|
void compute_main() {
|
||||||
|
refract_d7569b();
|
||||||
|
return;
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
#version 310 es
|
||||||
|
|
||||||
|
void refract_d7569b() {
|
||||||
|
vec3 res = vec3(-5.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 vertex_main() {
|
||||||
|
refract_d7569b();
|
||||||
|
return vec4(0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
gl_PointSize = 1.0;
|
||||||
|
vec4 inner_result = vertex_main();
|
||||||
|
gl_Position = inner_result;
|
||||||
|
gl_Position.y = -(gl_Position.y);
|
||||||
|
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#version 310 es
|
||||||
|
precision mediump float;
|
||||||
|
|
||||||
|
void refract_d7569b() {
|
||||||
|
vec3 res = vec3(-5.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void fragment_main() {
|
||||||
|
refract_d7569b();
|
||||||
|
}
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
fragment_main();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#version 310 es
|
||||||
|
|
||||||
|
void refract_d7569b() {
|
||||||
|
vec3 res = vec3(-5.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void compute_main() {
|
||||||
|
refract_d7569b();
|
||||||
|
}
|
||||||
|
|
||||||
|
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 refract_d7569b() {
|
||||||
|
float3 res = float3(-5.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct tint_symbol {
|
||||||
|
float4 value [[position]];
|
||||||
|
};
|
||||||
|
|
||||||
|
float4 vertex_main_inner() {
|
||||||
|
refract_d7569b();
|
||||||
|
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() {
|
||||||
|
refract_d7569b();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
kernel void compute_main() {
|
||||||
|
refract_d7569b();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,67 @@
|
|||||||
|
; SPIR-V
|
||||||
|
; Version: 1.3
|
||||||
|
; Generator: Google Tint Compiler; 0
|
||||||
|
; Bound: 33
|
||||||
|
; Schema: 0
|
||||||
|
OpCapability Shader
|
||||||
|
OpMemoryModel Logical GLSL450
|
||||||
|
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||||
|
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||||
|
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||||
|
OpExecutionMode %fragment_main OriginUpperLeft
|
||||||
|
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||||
|
OpName %value "value"
|
||||||
|
OpName %vertex_point_size "vertex_point_size"
|
||||||
|
OpName %refract_d7569b "refract_d7569b"
|
||||||
|
OpName %res "res"
|
||||||
|
OpName %vertex_main_inner "vertex_main_inner"
|
||||||
|
OpName %vertex_main "vertex_main"
|
||||||
|
OpName %fragment_main "fragment_main"
|
||||||
|
OpName %compute_main "compute_main"
|
||||||
|
OpDecorate %value BuiltIn Position
|
||||||
|
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||||
|
%float = OpTypeFloat 32
|
||||||
|
%v4float = OpTypeVector %float 4
|
||||||
|
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||||
|
%5 = OpConstantNull %v4float
|
||||||
|
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||||
|
%_ptr_Output_float = OpTypePointer Output %float
|
||||||
|
%8 = OpConstantNull %float
|
||||||
|
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||||
|
%void = OpTypeVoid
|
||||||
|
%9 = OpTypeFunction %void
|
||||||
|
%v3float = OpTypeVector %float 3
|
||||||
|
%float_n5 = OpConstant %float -5
|
||||||
|
%15 = OpConstantComposite %v3float %float_n5 %float_n5 %float_n5
|
||||||
|
%_ptr_Function_v3float = OpTypePointer Function %v3float
|
||||||
|
%18 = OpConstantNull %v3float
|
||||||
|
%19 = OpTypeFunction %v4float
|
||||||
|
%float_1 = OpConstant %float 1
|
||||||
|
%refract_d7569b = OpFunction %void None %9
|
||||||
|
%12 = OpLabel
|
||||||
|
%res = OpVariable %_ptr_Function_v3float Function %18
|
||||||
|
OpStore %res %15
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%vertex_main_inner = OpFunction %v4float None %19
|
||||||
|
%21 = OpLabel
|
||||||
|
%22 = OpFunctionCall %void %refract_d7569b
|
||||||
|
OpReturnValue %5
|
||||||
|
OpFunctionEnd
|
||||||
|
%vertex_main = OpFunction %void None %9
|
||||||
|
%24 = OpLabel
|
||||||
|
%25 = OpFunctionCall %v4float %vertex_main_inner
|
||||||
|
OpStore %value %25
|
||||||
|
OpStore %vertex_point_size %float_1
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%fragment_main = OpFunction %void None %9
|
||||||
|
%28 = OpLabel
|
||||||
|
%29 = OpFunctionCall %void %refract_d7569b
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%compute_main = OpFunction %void None %9
|
||||||
|
%31 = OpLabel
|
||||||
|
%32 = OpFunctionCall %void %refract_d7569b
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
@ -0,0 +1,19 @@
|
|||||||
|
fn refract_d7569b() {
|
||||||
|
var res = refract(vec3(1.0), vec3(1.0), 1.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@vertex
|
||||||
|
fn vertex_main() -> @builtin(position) vec4<f32> {
|
||||||
|
refract_d7569b();
|
||||||
|
return vec4<f32>();
|
||||||
|
}
|
||||||
|
|
||||||
|
@fragment
|
||||||
|
fn fragment_main() {
|
||||||
|
refract_d7569b();
|
||||||
|
}
|
||||||
|
|
||||||
|
@compute @workgroup_size(1)
|
||||||
|
fn compute_main() {
|
||||||
|
refract_d7569b();
|
||||||
|
}
|
46
test/tint/builtins/gen/var/refract/8c192a.wgsl
Normal file
46
test/tint/builtins/gen/var/refract/8c192a.wgsl
Normal file
@ -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
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
// fn refract(vec<4, fa>, vec<4, fa>, fa) -> vec<4, fa>
|
||||||
|
fn refract_8c192a() {
|
||||||
|
const arg_0 = vec4(1.);
|
||||||
|
const arg_1 = vec4(1.);
|
||||||
|
const arg_2 = 1.;
|
||||||
|
var res = refract(arg_0, arg_1, arg_2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@vertex
|
||||||
|
fn vertex_main() -> @builtin(position) vec4<f32> {
|
||||||
|
refract_8c192a();
|
||||||
|
return vec4<f32>();
|
||||||
|
}
|
||||||
|
|
||||||
|
@fragment
|
||||||
|
fn fragment_main() {
|
||||||
|
refract_8c192a();
|
||||||
|
}
|
||||||
|
|
||||||
|
@compute @workgroup_size(1)
|
||||||
|
fn compute_main() {
|
||||||
|
refract_8c192a();
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
void refract_8c192a() {
|
||||||
|
float4 res = (-7.0f).xxxx;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct tint_symbol {
|
||||||
|
float4 value : SV_Position;
|
||||||
|
};
|
||||||
|
|
||||||
|
float4 vertex_main_inner() {
|
||||||
|
refract_8c192a();
|
||||||
|
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() {
|
||||||
|
refract_8c192a();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
[numthreads(1, 1, 1)]
|
||||||
|
void compute_main() {
|
||||||
|
refract_8c192a();
|
||||||
|
return;
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
void refract_8c192a() {
|
||||||
|
float4 res = (-7.0f).xxxx;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct tint_symbol {
|
||||||
|
float4 value : SV_Position;
|
||||||
|
};
|
||||||
|
|
||||||
|
float4 vertex_main_inner() {
|
||||||
|
refract_8c192a();
|
||||||
|
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() {
|
||||||
|
refract_8c192a();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
[numthreads(1, 1, 1)]
|
||||||
|
void compute_main() {
|
||||||
|
refract_8c192a();
|
||||||
|
return;
|
||||||
|
}
|
49
test/tint/builtins/gen/var/refract/8c192a.wgsl.expected.glsl
Normal file
49
test/tint/builtins/gen/var/refract/8c192a.wgsl.expected.glsl
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
#version 310 es
|
||||||
|
|
||||||
|
void refract_8c192a() {
|
||||||
|
vec4 res = vec4(-7.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 vertex_main() {
|
||||||
|
refract_8c192a();
|
||||||
|
return vec4(0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
gl_PointSize = 1.0;
|
||||||
|
vec4 inner_result = vertex_main();
|
||||||
|
gl_Position = inner_result;
|
||||||
|
gl_Position.y = -(gl_Position.y);
|
||||||
|
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#version 310 es
|
||||||
|
precision mediump float;
|
||||||
|
|
||||||
|
void refract_8c192a() {
|
||||||
|
vec4 res = vec4(-7.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void fragment_main() {
|
||||||
|
refract_8c192a();
|
||||||
|
}
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
fragment_main();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#version 310 es
|
||||||
|
|
||||||
|
void refract_8c192a() {
|
||||||
|
vec4 res = vec4(-7.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void compute_main() {
|
||||||
|
refract_8c192a();
|
||||||
|
}
|
||||||
|
|
||||||
|
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||||
|
void main() {
|
||||||
|
compute_main();
|
||||||
|
return;
|
||||||
|
}
|
33
test/tint/builtins/gen/var/refract/8c192a.wgsl.expected.msl
Normal file
33
test/tint/builtins/gen/var/refract/8c192a.wgsl.expected.msl
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
void refract_8c192a() {
|
||||||
|
float4 res = float4(-7.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct tint_symbol {
|
||||||
|
float4 value [[position]];
|
||||||
|
};
|
||||||
|
|
||||||
|
float4 vertex_main_inner() {
|
||||||
|
refract_8c192a();
|
||||||
|
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() {
|
||||||
|
refract_8c192a();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
kernel void compute_main() {
|
||||||
|
refract_8c192a();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,65 @@
|
|||||||
|
; SPIR-V
|
||||||
|
; Version: 1.3
|
||||||
|
; Generator: Google Tint Compiler; 0
|
||||||
|
; Bound: 31
|
||||||
|
; Schema: 0
|
||||||
|
OpCapability Shader
|
||||||
|
OpMemoryModel Logical GLSL450
|
||||||
|
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||||
|
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||||
|
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||||
|
OpExecutionMode %fragment_main OriginUpperLeft
|
||||||
|
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||||
|
OpName %value "value"
|
||||||
|
OpName %vertex_point_size "vertex_point_size"
|
||||||
|
OpName %refract_8c192a "refract_8c192a"
|
||||||
|
OpName %res "res"
|
||||||
|
OpName %vertex_main_inner "vertex_main_inner"
|
||||||
|
OpName %vertex_main "vertex_main"
|
||||||
|
OpName %fragment_main "fragment_main"
|
||||||
|
OpName %compute_main "compute_main"
|
||||||
|
OpDecorate %value BuiltIn Position
|
||||||
|
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||||
|
%float = OpTypeFloat 32
|
||||||
|
%v4float = OpTypeVector %float 4
|
||||||
|
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||||
|
%5 = OpConstantNull %v4float
|
||||||
|
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||||
|
%_ptr_Output_float = OpTypePointer Output %float
|
||||||
|
%8 = OpConstantNull %float
|
||||||
|
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||||
|
%void = OpTypeVoid
|
||||||
|
%9 = OpTypeFunction %void
|
||||||
|
%float_n7 = OpConstant %float -7
|
||||||
|
%14 = OpConstantComposite %v4float %float_n7 %float_n7 %float_n7 %float_n7
|
||||||
|
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||||
|
%17 = OpTypeFunction %v4float
|
||||||
|
%float_1 = OpConstant %float 1
|
||||||
|
%refract_8c192a = OpFunction %void None %9
|
||||||
|
%12 = OpLabel
|
||||||
|
%res = OpVariable %_ptr_Function_v4float Function %5
|
||||||
|
OpStore %res %14
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%vertex_main_inner = OpFunction %v4float None %17
|
||||||
|
%19 = OpLabel
|
||||||
|
%20 = OpFunctionCall %void %refract_8c192a
|
||||||
|
OpReturnValue %5
|
||||||
|
OpFunctionEnd
|
||||||
|
%vertex_main = OpFunction %void None %9
|
||||||
|
%22 = OpLabel
|
||||||
|
%23 = OpFunctionCall %v4float %vertex_main_inner
|
||||||
|
OpStore %value %23
|
||||||
|
OpStore %vertex_point_size %float_1
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%fragment_main = OpFunction %void None %9
|
||||||
|
%26 = OpLabel
|
||||||
|
%27 = OpFunctionCall %void %refract_8c192a
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%compute_main = OpFunction %void None %9
|
||||||
|
%29 = OpLabel
|
||||||
|
%30 = OpFunctionCall %void %refract_8c192a
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
22
test/tint/builtins/gen/var/refract/8c192a.wgsl.expected.wgsl
Normal file
22
test/tint/builtins/gen/var/refract/8c192a.wgsl.expected.wgsl
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
fn refract_8c192a() {
|
||||||
|
const arg_0 = vec4(1.0);
|
||||||
|
const arg_1 = vec4(1.0);
|
||||||
|
const arg_2 = 1.0;
|
||||||
|
var res = refract(arg_0, arg_1, arg_2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@vertex
|
||||||
|
fn vertex_main() -> @builtin(position) vec4<f32> {
|
||||||
|
refract_8c192a();
|
||||||
|
return vec4<f32>();
|
||||||
|
}
|
||||||
|
|
||||||
|
@fragment
|
||||||
|
fn fragment_main() {
|
||||||
|
refract_8c192a();
|
||||||
|
}
|
||||||
|
|
||||||
|
@compute @workgroup_size(1)
|
||||||
|
fn compute_main() {
|
||||||
|
refract_8c192a();
|
||||||
|
}
|
46
test/tint/builtins/gen/var/refract/cf1629.wgsl
Normal file
46
test/tint/builtins/gen/var/refract/cf1629.wgsl
Normal file
@ -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
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
// fn refract(vec<2, fa>, vec<2, fa>, fa) -> vec<2, fa>
|
||||||
|
fn refract_cf1629() {
|
||||||
|
const arg_0 = vec2(1.);
|
||||||
|
const arg_1 = vec2(1.);
|
||||||
|
const arg_2 = 1.;
|
||||||
|
var res = refract(arg_0, arg_1, arg_2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@vertex
|
||||||
|
fn vertex_main() -> @builtin(position) vec4<f32> {
|
||||||
|
refract_cf1629();
|
||||||
|
return vec4<f32>();
|
||||||
|
}
|
||||||
|
|
||||||
|
@fragment
|
||||||
|
fn fragment_main() {
|
||||||
|
refract_cf1629();
|
||||||
|
}
|
||||||
|
|
||||||
|
@compute @workgroup_size(1)
|
||||||
|
fn compute_main() {
|
||||||
|
refract_cf1629();
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
void refract_cf1629() {
|
||||||
|
float2 res = (-3.0f).xx;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct tint_symbol {
|
||||||
|
float4 value : SV_Position;
|
||||||
|
};
|
||||||
|
|
||||||
|
float4 vertex_main_inner() {
|
||||||
|
refract_cf1629();
|
||||||
|
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() {
|
||||||
|
refract_cf1629();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
[numthreads(1, 1, 1)]
|
||||||
|
void compute_main() {
|
||||||
|
refract_cf1629();
|
||||||
|
return;
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
void refract_cf1629() {
|
||||||
|
float2 res = (-3.0f).xx;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct tint_symbol {
|
||||||
|
float4 value : SV_Position;
|
||||||
|
};
|
||||||
|
|
||||||
|
float4 vertex_main_inner() {
|
||||||
|
refract_cf1629();
|
||||||
|
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() {
|
||||||
|
refract_cf1629();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
[numthreads(1, 1, 1)]
|
||||||
|
void compute_main() {
|
||||||
|
refract_cf1629();
|
||||||
|
return;
|
||||||
|
}
|
49
test/tint/builtins/gen/var/refract/cf1629.wgsl.expected.glsl
Normal file
49
test/tint/builtins/gen/var/refract/cf1629.wgsl.expected.glsl
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
#version 310 es
|
||||||
|
|
||||||
|
void refract_cf1629() {
|
||||||
|
vec2 res = vec2(-3.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 vertex_main() {
|
||||||
|
refract_cf1629();
|
||||||
|
return vec4(0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
gl_PointSize = 1.0;
|
||||||
|
vec4 inner_result = vertex_main();
|
||||||
|
gl_Position = inner_result;
|
||||||
|
gl_Position.y = -(gl_Position.y);
|
||||||
|
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#version 310 es
|
||||||
|
precision mediump float;
|
||||||
|
|
||||||
|
void refract_cf1629() {
|
||||||
|
vec2 res = vec2(-3.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void fragment_main() {
|
||||||
|
refract_cf1629();
|
||||||
|
}
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
fragment_main();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#version 310 es
|
||||||
|
|
||||||
|
void refract_cf1629() {
|
||||||
|
vec2 res = vec2(-3.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void compute_main() {
|
||||||
|
refract_cf1629();
|
||||||
|
}
|
||||||
|
|
||||||
|
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||||
|
void main() {
|
||||||
|
compute_main();
|
||||||
|
return;
|
||||||
|
}
|
33
test/tint/builtins/gen/var/refract/cf1629.wgsl.expected.msl
Normal file
33
test/tint/builtins/gen/var/refract/cf1629.wgsl.expected.msl
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
void refract_cf1629() {
|
||||||
|
float2 res = float2(-3.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct tint_symbol {
|
||||||
|
float4 value [[position]];
|
||||||
|
};
|
||||||
|
|
||||||
|
float4 vertex_main_inner() {
|
||||||
|
refract_cf1629();
|
||||||
|
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() {
|
||||||
|
refract_cf1629();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
kernel void compute_main() {
|
||||||
|
refract_cf1629();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,67 @@
|
|||||||
|
; SPIR-V
|
||||||
|
; Version: 1.3
|
||||||
|
; Generator: Google Tint Compiler; 0
|
||||||
|
; Bound: 33
|
||||||
|
; Schema: 0
|
||||||
|
OpCapability Shader
|
||||||
|
OpMemoryModel Logical GLSL450
|
||||||
|
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||||
|
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||||
|
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||||
|
OpExecutionMode %fragment_main OriginUpperLeft
|
||||||
|
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||||
|
OpName %value "value"
|
||||||
|
OpName %vertex_point_size "vertex_point_size"
|
||||||
|
OpName %refract_cf1629 "refract_cf1629"
|
||||||
|
OpName %res "res"
|
||||||
|
OpName %vertex_main_inner "vertex_main_inner"
|
||||||
|
OpName %vertex_main "vertex_main"
|
||||||
|
OpName %fragment_main "fragment_main"
|
||||||
|
OpName %compute_main "compute_main"
|
||||||
|
OpDecorate %value BuiltIn Position
|
||||||
|
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||||
|
%float = OpTypeFloat 32
|
||||||
|
%v4float = OpTypeVector %float 4
|
||||||
|
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||||
|
%5 = OpConstantNull %v4float
|
||||||
|
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||||
|
%_ptr_Output_float = OpTypePointer Output %float
|
||||||
|
%8 = OpConstantNull %float
|
||||||
|
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||||
|
%void = OpTypeVoid
|
||||||
|
%9 = OpTypeFunction %void
|
||||||
|
%v2float = OpTypeVector %float 2
|
||||||
|
%float_n3 = OpConstant %float -3
|
||||||
|
%15 = OpConstantComposite %v2float %float_n3 %float_n3
|
||||||
|
%_ptr_Function_v2float = OpTypePointer Function %v2float
|
||||||
|
%18 = OpConstantNull %v2float
|
||||||
|
%19 = OpTypeFunction %v4float
|
||||||
|
%float_1 = OpConstant %float 1
|
||||||
|
%refract_cf1629 = OpFunction %void None %9
|
||||||
|
%12 = OpLabel
|
||||||
|
%res = OpVariable %_ptr_Function_v2float Function %18
|
||||||
|
OpStore %res %15
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%vertex_main_inner = OpFunction %v4float None %19
|
||||||
|
%21 = OpLabel
|
||||||
|
%22 = OpFunctionCall %void %refract_cf1629
|
||||||
|
OpReturnValue %5
|
||||||
|
OpFunctionEnd
|
||||||
|
%vertex_main = OpFunction %void None %9
|
||||||
|
%24 = OpLabel
|
||||||
|
%25 = OpFunctionCall %v4float %vertex_main_inner
|
||||||
|
OpStore %value %25
|
||||||
|
OpStore %vertex_point_size %float_1
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%fragment_main = OpFunction %void None %9
|
||||||
|
%28 = OpLabel
|
||||||
|
%29 = OpFunctionCall %void %refract_cf1629
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%compute_main = OpFunction %void None %9
|
||||||
|
%31 = OpLabel
|
||||||
|
%32 = OpFunctionCall %void %refract_cf1629
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
22
test/tint/builtins/gen/var/refract/cf1629.wgsl.expected.wgsl
Normal file
22
test/tint/builtins/gen/var/refract/cf1629.wgsl.expected.wgsl
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
fn refract_cf1629() {
|
||||||
|
const arg_0 = vec2(1.0);
|
||||||
|
const arg_1 = vec2(1.0);
|
||||||
|
const arg_2 = 1.0;
|
||||||
|
var res = refract(arg_0, arg_1, arg_2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@vertex
|
||||||
|
fn vertex_main() -> @builtin(position) vec4<f32> {
|
||||||
|
refract_cf1629();
|
||||||
|
return vec4<f32>();
|
||||||
|
}
|
||||||
|
|
||||||
|
@fragment
|
||||||
|
fn fragment_main() {
|
||||||
|
refract_cf1629();
|
||||||
|
}
|
||||||
|
|
||||||
|
@compute @workgroup_size(1)
|
||||||
|
fn compute_main() {
|
||||||
|
refract_cf1629();
|
||||||
|
}
|
46
test/tint/builtins/gen/var/refract/d7569b.wgsl
Normal file
46
test/tint/builtins/gen/var/refract/d7569b.wgsl
Normal file
@ -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
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
// fn refract(vec<3, fa>, vec<3, fa>, fa) -> vec<3, fa>
|
||||||
|
fn refract_d7569b() {
|
||||||
|
const arg_0 = vec3(1.);
|
||||||
|
const arg_1 = vec3(1.);
|
||||||
|
const arg_2 = 1.;
|
||||||
|
var res = refract(arg_0, arg_1, arg_2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@vertex
|
||||||
|
fn vertex_main() -> @builtin(position) vec4<f32> {
|
||||||
|
refract_d7569b();
|
||||||
|
return vec4<f32>();
|
||||||
|
}
|
||||||
|
|
||||||
|
@fragment
|
||||||
|
fn fragment_main() {
|
||||||
|
refract_d7569b();
|
||||||
|
}
|
||||||
|
|
||||||
|
@compute @workgroup_size(1)
|
||||||
|
fn compute_main() {
|
||||||
|
refract_d7569b();
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
void refract_d7569b() {
|
||||||
|
float3 res = (-5.0f).xxx;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct tint_symbol {
|
||||||
|
float4 value : SV_Position;
|
||||||
|
};
|
||||||
|
|
||||||
|
float4 vertex_main_inner() {
|
||||||
|
refract_d7569b();
|
||||||
|
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() {
|
||||||
|
refract_d7569b();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
[numthreads(1, 1, 1)]
|
||||||
|
void compute_main() {
|
||||||
|
refract_d7569b();
|
||||||
|
return;
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
void refract_d7569b() {
|
||||||
|
float3 res = (-5.0f).xxx;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct tint_symbol {
|
||||||
|
float4 value : SV_Position;
|
||||||
|
};
|
||||||
|
|
||||||
|
float4 vertex_main_inner() {
|
||||||
|
refract_d7569b();
|
||||||
|
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() {
|
||||||
|
refract_d7569b();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
[numthreads(1, 1, 1)]
|
||||||
|
void compute_main() {
|
||||||
|
refract_d7569b();
|
||||||
|
return;
|
||||||
|
}
|
49
test/tint/builtins/gen/var/refract/d7569b.wgsl.expected.glsl
Normal file
49
test/tint/builtins/gen/var/refract/d7569b.wgsl.expected.glsl
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
#version 310 es
|
||||||
|
|
||||||
|
void refract_d7569b() {
|
||||||
|
vec3 res = vec3(-5.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 vertex_main() {
|
||||||
|
refract_d7569b();
|
||||||
|
return vec4(0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
gl_PointSize = 1.0;
|
||||||
|
vec4 inner_result = vertex_main();
|
||||||
|
gl_Position = inner_result;
|
||||||
|
gl_Position.y = -(gl_Position.y);
|
||||||
|
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#version 310 es
|
||||||
|
precision mediump float;
|
||||||
|
|
||||||
|
void refract_d7569b() {
|
||||||
|
vec3 res = vec3(-5.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void fragment_main() {
|
||||||
|
refract_d7569b();
|
||||||
|
}
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
fragment_main();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#version 310 es
|
||||||
|
|
||||||
|
void refract_d7569b() {
|
||||||
|
vec3 res = vec3(-5.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void compute_main() {
|
||||||
|
refract_d7569b();
|
||||||
|
}
|
||||||
|
|
||||||
|
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||||
|
void main() {
|
||||||
|
compute_main();
|
||||||
|
return;
|
||||||
|
}
|
33
test/tint/builtins/gen/var/refract/d7569b.wgsl.expected.msl
Normal file
33
test/tint/builtins/gen/var/refract/d7569b.wgsl.expected.msl
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
void refract_d7569b() {
|
||||||
|
float3 res = float3(-5.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct tint_symbol {
|
||||||
|
float4 value [[position]];
|
||||||
|
};
|
||||||
|
|
||||||
|
float4 vertex_main_inner() {
|
||||||
|
refract_d7569b();
|
||||||
|
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() {
|
||||||
|
refract_d7569b();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
kernel void compute_main() {
|
||||||
|
refract_d7569b();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,67 @@
|
|||||||
|
; SPIR-V
|
||||||
|
; Version: 1.3
|
||||||
|
; Generator: Google Tint Compiler; 0
|
||||||
|
; Bound: 33
|
||||||
|
; Schema: 0
|
||||||
|
OpCapability Shader
|
||||||
|
OpMemoryModel Logical GLSL450
|
||||||
|
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||||
|
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||||
|
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||||
|
OpExecutionMode %fragment_main OriginUpperLeft
|
||||||
|
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||||
|
OpName %value "value"
|
||||||
|
OpName %vertex_point_size "vertex_point_size"
|
||||||
|
OpName %refract_d7569b "refract_d7569b"
|
||||||
|
OpName %res "res"
|
||||||
|
OpName %vertex_main_inner "vertex_main_inner"
|
||||||
|
OpName %vertex_main "vertex_main"
|
||||||
|
OpName %fragment_main "fragment_main"
|
||||||
|
OpName %compute_main "compute_main"
|
||||||
|
OpDecorate %value BuiltIn Position
|
||||||
|
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||||
|
%float = OpTypeFloat 32
|
||||||
|
%v4float = OpTypeVector %float 4
|
||||||
|
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||||
|
%5 = OpConstantNull %v4float
|
||||||
|
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||||
|
%_ptr_Output_float = OpTypePointer Output %float
|
||||||
|
%8 = OpConstantNull %float
|
||||||
|
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||||
|
%void = OpTypeVoid
|
||||||
|
%9 = OpTypeFunction %void
|
||||||
|
%v3float = OpTypeVector %float 3
|
||||||
|
%float_n5 = OpConstant %float -5
|
||||||
|
%15 = OpConstantComposite %v3float %float_n5 %float_n5 %float_n5
|
||||||
|
%_ptr_Function_v3float = OpTypePointer Function %v3float
|
||||||
|
%18 = OpConstantNull %v3float
|
||||||
|
%19 = OpTypeFunction %v4float
|
||||||
|
%float_1 = OpConstant %float 1
|
||||||
|
%refract_d7569b = OpFunction %void None %9
|
||||||
|
%12 = OpLabel
|
||||||
|
%res = OpVariable %_ptr_Function_v3float Function %18
|
||||||
|
OpStore %res %15
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%vertex_main_inner = OpFunction %v4float None %19
|
||||||
|
%21 = OpLabel
|
||||||
|
%22 = OpFunctionCall %void %refract_d7569b
|
||||||
|
OpReturnValue %5
|
||||||
|
OpFunctionEnd
|
||||||
|
%vertex_main = OpFunction %void None %9
|
||||||
|
%24 = OpLabel
|
||||||
|
%25 = OpFunctionCall %v4float %vertex_main_inner
|
||||||
|
OpStore %value %25
|
||||||
|
OpStore %vertex_point_size %float_1
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%fragment_main = OpFunction %void None %9
|
||||||
|
%28 = OpLabel
|
||||||
|
%29 = OpFunctionCall %void %refract_d7569b
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%compute_main = OpFunction %void None %9
|
||||||
|
%31 = OpLabel
|
||||||
|
%32 = OpFunctionCall %void %refract_d7569b
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
22
test/tint/builtins/gen/var/refract/d7569b.wgsl.expected.wgsl
Normal file
22
test/tint/builtins/gen/var/refract/d7569b.wgsl.expected.wgsl
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
fn refract_d7569b() {
|
||||||
|
const arg_0 = vec3(1.0);
|
||||||
|
const arg_1 = vec3(1.0);
|
||||||
|
const arg_2 = 1.0;
|
||||||
|
var res = refract(arg_0, arg_1, arg_2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@vertex
|
||||||
|
fn vertex_main() -> @builtin(position) vec4<f32> {
|
||||||
|
refract_d7569b();
|
||||||
|
return vec4<f32>();
|
||||||
|
}
|
||||||
|
|
||||||
|
@fragment
|
||||||
|
fn fragment_main() {
|
||||||
|
refract_d7569b();
|
||||||
|
}
|
||||||
|
|
||||||
|
@compute @workgroup_size(1)
|
||||||
|
fn compute_main() {
|
||||||
|
refract_d7569b();
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user